using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using CruiserTerminal.Patches; using Dawn; using Dawn.Internal; using FovAdjust; using GameNetcodeStuff; using GeneralImprovements; using HarmonyLib; using InteractiveTerminalAPI.UI; using InteractiveTerminalAPI.UI.Application; using LethalConstellations.PluginCore; using LethalLevelLoader; using LobbyCompatibility.Enums; using LobbyCompatibility.Features; using Microsoft.CodeAnalysis; using OpenBodyCams; using OpenLib; using OpenLib.Common; using OpenLib.Compat; using OpenLib.ConfigManager; using OpenLib.CoreMethods; using OpenLib.Events; using OpenLib.InteractiveMenus; using OpenLib.Menus; using ShipInventoryUpdated.Objects; using ShipInventoryUpdated.Scripts; using TMPro; using TerminalStuff.CommandHandling; using TerminalStuff.Compatibility; using TerminalStuff.Configs; using TerminalStuff.EventSub; using TerminalStuff.MoonsTweaks; using TerminalStuff.Networking; using TerminalStuff.Patching; using TerminalStuff.SpecialStuff; using TerminalStuff.StoreTweaks; using TerminalStuff.Util; using TerminalStuff.VisualElements; using TwoRadarMaps; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.InputSystem.LowLevel; using UnityEngine.TextCore.LowLevel; using UnityEngine.UI; using UnityEngine.Video; using WeatherTweaks; using darmuhsTerminalStuff.NetcodePatcher; using suitsTerminal.OfTerminal; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("com.github.darmuh.suitsTerminal")] [assembly: IgnoresAccessChecksTo("com.github.teamxiaolan.dawnlib.compatibility")] [assembly: IgnoresAccessChecksTo("com.github.teamxiaolan.dawnlib")] [assembly: IgnoresAccessChecksTo("com.github.teamxiaolan.dawnlib.dusk")] [assembly: IgnoresAccessChecksTo("com.github.teamxiaolan.dawnlib.interfaces")] [assembly: IgnoresAccessChecksTo("InteractiveTerminalAPI")] [assembly: IgnoresAccessChecksTo("LethalLevelLoader")] [assembly: IgnoresAccessChecksTo("LethalLevelLoader.Patcher")] [assembly: IgnoresAccessChecksTo("WeatherTweaks")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("darmuh")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("3.10.1")] [assembly: AssemblyInformationalVersion("3.10.1+3d2a1201a83d99e27f46fb9b24c36664955f4552")] [assembly: AssemblyProduct("darmuhsTerminalStuff")] [assembly: AssemblyTitle("darmuhsTerminalStuff")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("3.10.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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 BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace TutorialNameSpace { internal class Tutorial { internal static void AddMyCommands() { AddingThings.AddBasicCommand("command1", "command1", "command 1 text", false, true, "", ""); } internal static void OnTerminalAwake(Terminal instance) { AddMyCommands(); } internal static void Subscribers() { EventManager.TerminalAwake.AddListener((ParameterEvent)OnTerminalAwake); } } } namespace TerminalStuff { internal class AdminCommands { internal static PlayerControllerB playerToKick; internal static bool kickEnum; internal static string KickPlayersAsk() { TerminalGeneral.CancelConfirmation = true; playerToKick = null; string afterKeyword = StringStuff.GetAfterKeyword(StringStuff.GetKeywordsPerConfigItem(KeywordConfigs.KickKeywords.Value)); if (!AmIHost(out string displayText)) { return displayText; } if (afterKeyword.Length < 1) { string text = PlayerNameAndIDList(); return "You must specify a player name or ID to kick them!\n\tKickable Players:\n(id) PlayerName" + text + "\n\n"; } if (ulong.TryParse(afterKeyword, out var result)) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.playerClientId == result && (Object)(object)StartOfRound.Instance.localPlayerController != (Object)(object)val && val.isPlayerControlled) { TerminalGeneral.CancelConfirmation = false; playerToKick = val; displayText = "Kick " + val.playerUsername + " from the lobby?\n\n\n\n\n\n\n\n\n\n\nPlease CONFIRM or DENY.\n\n"; Loggers.LogInfo("valid player to kick from id"); return displayText; } } } else { Loggers.LogDebug("ulong failed parse"); string text2 = afterKeyword.ToLower(); PlayerControllerB[] allPlayerScripts2 = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts2) { if (Misc.CompareStringsInvariant(val2.playerUsername, text2, true)) { TerminalGeneral.CancelConfirmation = false; playerToKick = val2; return "Kick " + val2.playerUsername + " from the lobby?\n\n\n\n\n\n\n\n\n\n\nPlease CONFIRM or DENY.\n\n"; } } } return "Unable to find player to kick by name or id - " + afterKeyword + "\n\n"; } private static string PlayerNameAndIDList() { StringBuilder stringBuilder = new StringBuilder(); if (Bools.StartIsLocalPlayerNull()) { return stringBuilder.ToString(); } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if ((Object)(object)StartOfRound.Instance.localPlayerController != (Object)(object)val && val.isPlayerControlled) { stringBuilder.Append($"\n({val.playerClientId}) {val.playerUsername}\n"); } } return stringBuilder.ToString(); } internal static bool AmIHost(out string displayText) { displayText = ""; if (Bools.GameIsLocalPlayerNull() || !((NetworkBehaviour)GameNetworkManager.Instance.localPlayerController).IsHost) { displayText = "You do not have permission to kick players from this lobby, you are NOT the host.\n\n"; Plugin.Log.LogWarning((object)"Somehow non-host player could try to kick others, error handled."); return false; } return true; } internal static string KickPlayerConfirm() { int playerToKickID = GetPlayerToKickID(playerToKick); ((MonoBehaviour)Plugin.instance.Terminal).StartCoroutine(KickYes(playerToKickID)); return "Kick Player Action Confirmed.\n\n\tKicking player: " + playerToKick.playerUsername + "\n\n"; } internal static string KickPlayerDeny() { string result = "Cancelling kick player action for player:" + playerToKick.playerUsername + "\n\n"; playerToKick = null; return result; } internal static int GetPlayerToKickID(PlayerControllerB matchingPlayer) { int result = -1; for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++) { if (StartOfRound.Instance.allPlayerScripts[i].playerUsername == matchingPlayer.playerUsername) { result = i; break; } } return result; } internal static IEnumerator KickYes(int playerNum) { if (!kickEnum) { kickEnum = true; Loggers.LogDebug("We made it to the kick event!!"); Loggers.LogDebug("playerObjIdForTerminal = " + playerNum); Plugin.instance.Terminal.QuitTerminal(true); yield return (object)new WaitForSeconds(0.1f); StartOfRound.Instance.KickPlayer(playerNum); Loggers.LogDebug("kicked"); kickEnum = false; } } } internal class AllTheLootStuff { internal static string GetLootSimple() { Loggers.LogDebug("calculating loot value next"); float num = CalculateLootValue(); string text; if (Plugin.instance.ShipInventory) { int inventoryValue = ShipInventoryCompat.GetInventoryValue(); text = $"Total Value on Ship: ${num}\n\nTotal Value in Ship Inventory: ${inventoryValue}"; } else { text = $"Total Value on Ship: ${num}"; } Loggers.LogDebug("loot calculated"); return text + "\n\n"; } internal static string DetailedLootCommand() { OtherPatches.LoadGrabbablesOnShip.LoadAllItems(); StringBuilder stringBuilder = new StringBuilder(); Dictionary dictionary = new Dictionary(); int totalCredsWorth = 0; foreach (GrabbableObject item in OtherPatches.LoadGrabbablesOnShip.ItemsOnShip) { string itemName = item.itemProperties.itemName; int scrapValue = item.scrapValue; if (item.itemProperties.isScrap) { string text = $"{itemName} ({scrapValue} credits)"; Loggers.LogDebug(text + "added to output"); totalCredsWorth += scrapValue; dictionary[text] = ((!dictionary.TryGetValue(text, out var value)) ? 1 : (value + 1)); } } foreach (KeyValuePair item2 in dictionary) { if (item2.Value > 1) { stringBuilder.AppendLine($"{item2.Key} [x{item2.Value}]"); } else { stringBuilder.AppendLine(item2.Key ?? ""); } } if (Plugin.instance.ShipInventory) { ShipInventoryCompat.GetInventoryItems(out List itemsInventory); StringBuilder arg = ShipInventoryItems(itemsInventory, ref totalCredsWorth); return $"Scrap on ship (not stored):\n\n{stringBuilder}Scrap stored in Ship Inventory:\n\n{arg}\n\n\tTotal Value: {totalCredsWorth}\n\n"; } return $"Scrap on ship:\n\n{stringBuilder}\n\n\tTotal Value: {totalCredsWorth}\n\n"; } private static StringBuilder ShipInventoryItems(List inventory, ref int totalCredsWorth) { StringBuilder stringBuilder = new StringBuilder(); Dictionary dictionary = new Dictionary(); foreach (Item item in inventory) { if (item.isScrap) { string itemName = item.itemName; int creditsWorth = item.creditsWorth; string text = $"{itemName} ({creditsWorth} credits)"; Loggers.LogDebug(text + "added to output"); totalCredsWorth += creditsWorth; dictionary[text] = ((!dictionary.TryGetValue(text, out var value)) ? 1 : (value + 1)); } } foreach (KeyValuePair item2 in dictionary) { if (item2.Value > 1) { stringBuilder.AppendLine($"{item2.Key} [x{item2.Value}]"); } else { stringBuilder.AppendLine(item2.Key ?? ""); } } return stringBuilder; } private static float CalculateLootValue() { List list = (from obj in GameObject.Find("/Environment/HangarShip").GetComponentsInChildren() where ((Object)obj).name != "ClipboardManual" && ((Object)obj).name != "StickyNoteItem" && ((Object)obj).name != "Key(Clone)" select obj).ToList(); Loggers.LogDebug("Calculating total ship scrap value."); CollectionExtensions.Do((IEnumerable)list, (Action)delegate(GrabbableObject scrap) { Plugin.Log.LogDebug((object)$"{((Object)scrap).name} - ${scrap.scrapValue}"); }); return list.Sum((GrabbableObject scrap) => scrap.scrapValue); } } internal class ColorCommands { internal static Color? CustomFlashColor; internal static string flashLightColor = string.Empty; internal static bool usingHexCode = false; internal static bool RainbowFlash = false; private static GameObject _frontlight1 = null; private static GameObject _frontlight2 = null; private static GameObject _midlight1 = null; private static GameObject _midlight2 = null; private static GameObject _backlight1 = null; private static GameObject _backlight2 = null; internal static GameObject FrontLight1 { get { if ((Object)(object)_frontlight1 == (Object)null) { _frontlight1 = GameObject.Find("Environment/HangarShip/ShipElectricLights/Area Light (3)"); } return _frontlight1; } } internal static GameObject FrontLight2 { get { if ((Object)(object)_frontlight2 == (Object)null) { _frontlight2 = GameObject.Find("Environment/HangarShip/ShipElectricLights/Area Light (9)"); } return _frontlight2; } } internal static GameObject MidLight1 { get { if ((Object)(object)_midlight1 == (Object)null) { _midlight1 = GameObject.Find("Environment/HangarShip/ShipElectricLights/Area Light (4)"); } return _midlight1; } } internal static GameObject MidLight2 { get { if ((Object)(object)_midlight2 == (Object)null) { _midlight2 = GameObject.Find("Environment/HangarShip/ShipElectricLights/Area Light (8)"); } return _midlight2; } } internal static GameObject BackLight1 { get { if ((Object)(object)_backlight1 == (Object)null) { _backlight1 = GameObject.Find("Environment/HangarShip/ShipElectricLights/Area Light (5)"); } return _backlight1; } } internal static GameObject BackLight2 { get { if ((Object)(object)_backlight2 == (Object)null) { _backlight2 = GameObject.Find("Environment/HangarShip/ShipElectricLights/Area Light (7)"); } return _backlight2; } } internal static void SetLightColors(List objects, Color newColor) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (objects.Count == 0) { return; } foreach (GameObject @object in objects) { if ((Object)(object)@object.GetComponent() != (Object)null) { @object.GetComponent().color = newColor; } } } internal static void FlashLightCommandAction(out string displayText) { //IL_001e: 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_0023: 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) RainbowFlash = false; Color val = (Color)(((??)CustomFlashColor) ?? Color.white); Loggers.LogInfo($"got {flashLightColor} - {val}"); displayText = "The next time you turn on your flashlight, the color will be set to " + flashLightColor + "!\n\n"; } internal static void SetCustomColor(string colorKeyword, out Color? customColor) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) if (IsHexColorCode(colorKeyword)) { usingHexCode = true; customColor = HexToColor("#" + colorKeyword); return; } customColor = colorKeyword.ToLower() switch { "white" => Color.white, "normal" => Color.white, "default" => Color.white, "red" => Color.red, "blue" => Color.blue, "yellow" => Color.yellow, "cyan" => Color.cyan, "magenta" => Color.magenta, "green" => Color.green, "purple" => Color32.op_Implicit(new Color32((byte)144, (byte)100, (byte)254, (byte)1)), "lime" => Color32.op_Implicit(new Color32((byte)166, (byte)254, (byte)0, (byte)1)), "pink" => Color32.op_Implicit(new Color32((byte)242, (byte)0, (byte)254, (byte)1)), "maroon" => Color32.op_Implicit(new Color32((byte)114, (byte)3, (byte)3, (byte)1)), "orange" => Color32.op_Implicit(new Color32(byte.MaxValue, (byte)117, (byte)24, (byte)1)), "sasstro" => Color32.op_Implicit(new Color32((byte)212, (byte)148, (byte)180, (byte)1)), "samstro" => Color32.op_Implicit(new Color32((byte)180, (byte)203, (byte)240, (byte)1)), _ => null, }; } internal static bool IsHexColorCode(string input) { return Regex.IsMatch(input, "^(?:[0-9a-fA-F]{3}){1,2}$"); } internal static Color HexToColor(string hex) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Misc.HexToColor(hex); } internal static string ShipColorBase() { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) string afterKeyword = StringStuff.GetAfterKeyword(StringStuff.GetKeywordsPerConfigItem(KeywordConfigs.ScolorKeywords.Value)); if (afterKeyword.Length < 1) { string result = ShipColorList(); Loggers.WARNING("not enough words for the command!"); return result; } if (Misc.StringContainsInvariant(afterKeyword, "list", true)) { string result2 = ShipColorList(); Loggers.LogInfo("list requested"); return result2; } string[] words = afterKeyword.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (!ShipColorCommon(words, out string displayText, out string targetColor, out Color newColor)) { return displayText; } if (Misc.StringContainsInvariant(afterKeyword, "all", true)) { NetHandler.Instance.ShipColorAllRpc(newColor, targetColor); return displayText; } if (Misc.StringContainsInvariant(afterKeyword, "front", true)) { NetHandler.Instance.ShipColorFrontRpc(newColor, targetColor); return displayText; } if (Misc.StringContainsInvariant(afterKeyword, "mid", true)) { NetHandler.Instance.ShipColorMidRpc(newColor, targetColor); return displayText; } if (Misc.StringContainsInvariant(afterKeyword, "back", true)) { NetHandler.Instance.ShipColorBackRpc(newColor, targetColor); return displayText; } Loggers.WARNING("failed to grab specific part of ship lights to change"); return ShipColorList(); } internal static bool ShipColorCommon(string[] words, out string displayText, out string targetColor, out Color newColor) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //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) if (words.Length < 2) { displayText = ShipColorList(); Loggers.LogInfo("not enough words for the command, returning list!"); targetColor = string.Empty; newColor = Color.white; return false; } targetColor = words[1]; Loggers.LogInfo("Attempting to set " + words[0] + " ship light colors to " + targetColor); SetCustomColor(targetColor, out var customColor); if (customColor.HasValue && targetColor != null) { newColor = customColor.Value; displayText = "Color of " + words[0] + " ship lights set to " + targetColor + "!\n\n"; return true; } targetColor = ""; newColor = Color.white; displayText = "Unable to set " + words[0] + " ship light color...\n\tInvalid color [" + targetColor + "] detected!\n\n"; Loggers.WARNING("invalid color for the color command!"); return false; } internal static string ShipColorList() { string text = StringStuff.GetKeywordsPerConfigItem(KeywordConfigs.ScolorKeywords.Value)[0]; return "========= Ship Lights Color Options List =========\nColor Name: \"command used\"\n\nDefault: \"" + text + " all normal\" or \"" + text + " all default\"\nRed: \"" + text + " back red\"\nGreen: \"" + text + " mid green\"\nBlue: \"" + text + " front blue\"\nYellow: \"" + text + " middle yellow\"\nCyan: \"" + text + " all cyan\"\nMagenta: \"" + text + " back magenta\"\nPurple: \"" + text + " mid purple\"\nLime: \"" + text + " all lime\"\nPink: \"" + text + " front pink\"\nMaroon: \"" + text + " middle maroon\"\nOrange: \"" + text + " back orange\"\nSasstro's Color: \"" + text + " all sasstro\"\nSamstro's Color: \"" + text + " all samstro\"\nANY HEXCODE: \"" + text + " all FF00FF\"\n\n\n"; } internal static string FlashColorBase() { string afterKeyword = StringStuff.GetAfterKeyword(StringStuff.GetKeywordsPerConfigItem(KeywordConfigs.FcolorKeywords.Value)); if (afterKeyword.Length < 1) { string result = FlashColorList(); Loggers.WARNING("getting list, not enough words for color command!"); return result; } if (Misc.StringContainsInvariant(afterKeyword, "list", true)) { string result = FlashColorList(); Loggers.LogInfo("displaying flashcolor list"); return result; } if (Misc.StringContainsInvariant(afterKeyword, "rainbow", true)) { string result = FlashColorRainbow(); Loggers.LogInfo("running rainbow command"); return result; } if (Misc.StringContainsInvariant(afterKeyword, "normal", true) || Misc.StringContainsInvariant(afterKeyword, "default", true)) { Loggers.LogInfo("Player no longer wants a custom flashlight color!"); CustomFlashColor = null; RainbowFlash = false; return "Flashlight color preference set back to default!\n\nFlashlight's with the default color will no longer be updated!\n\n"; } string text = afterKeyword.TrimStart(); Loggers.LogInfo("Attempting to set flashlight color to " + text); SetCustomColor(text, out CustomFlashColor); flashLightColor = text; if (CustomFlashColor.HasValue) { Loggers.LogInfo("Using flashlight color: " + text); NetHandler.Instance.EndFlashRainbow = true; FlashLightCommandAction(out string displayText); return displayText; } string result2 = "Unable to set flashlight color...\n\tInvalid color: [" + text + "] detected!\n\n"; Loggers.WARNING("invalid color for the color command!"); return result2; } internal static string FlashColorList() { string text = StringStuff.GetKeywordsPerConfigItem(KeywordConfigs.FcolorKeywords.Value)[0]; return "========= Flashlight Color Options List =========\nColor Name: \"command used\"\n\nDefault: \"" + text + " normal\" or \"" + text + " default\"\nRed: \"" + text + " red\"\nGreen: \"" + text + " green\"\nBlue: \"" + text + " blue\"\nYellow: \"" + text + " yellow\"\nCyan: \"" + text + " cyan\"\nMagenta: \"" + text + " magenta\"\nPurple: \"" + text + " purple\"\nLime: \"" + text + " lime\"\nPink: \"" + text + " pink\"\nMaroon: \"" + text + " maroon\"\nOrange: \"" + text + " orange\"\nSasstro's Color: \"" + text + " sasstro\"\nSamstro's Color: \"" + text + " samstro\"\n\nRainbow Color (animated): \"" + text + " rainbow\"\nANY HEXCODE: \"" + text + " FF00FF\"\n\n"; } internal static string FlashColorRainbow() { if (Bools.StartIsLocalPlayerNull()) { return ""; } if (DoIhaveFlash(StartOfRound.Instance.localPlayerController)) { NetHandler.Instance.CycleThroughRainbowFlash(); return "Flashlight color set to Rainbow Mode! (performance may vary)\n\n"; } RainbowFlash = true; return "The next flashlight you hold will be set to rainbow mode! (performance may vary)\n\n"; } private static bool DoIhaveFlash(PlayerControllerB player) { GrabbableObject[] itemSlots = player.ItemSlots; foreach (GrabbableObject val in itemSlots) { if (val is FlashlightItem) { return true; } } return false; } } internal class CostCommands { internal static bool vitalsUpgradeEnabled = false; internal static bool enemyScanUpgradeEnabled = false; internal static List storeCart = new List(); internal static Dictionary itemsIndexed = new Dictionary(); internal static bool CheckUnlockableStatus(string itemName) { foreach (UnlockableItem unlockable in StartOfRound.Instance.unlockablesList.unlockables) { if (unlockable.unlockableName == itemName && (unlockable.alreadyUnlocked || unlockable.hasBeenUnlockedByPlayer)) { Loggers.LogDebug("Upgrade: " + itemName + " already unlocked. Setting variable to true"); return true; } } Loggers.LogDebug("Upgrade: " + itemName + " is NOT unlocked already"); return false; } internal static bool CheckUnlockableStatus(int itemID) { if (itemID >= StartOfRound.Instance.unlockablesList.unlockables.Count) { return false; } UnlockableItem val = StartOfRound.Instance.unlockablesList.unlockables[itemID]; if (!val.alreadyUnlocked && !val.hasBeenUnlockedByPlayer) { Loggers.LogDebug($"Upgrade ID: {itemID} has not been unlocked. Setting variable to true"); return true; } return false; } internal static void UpdateUnlockStatus() { enemyScanUpgradeEnabled = false; vitalsUpgradeEnabled = false; foreach (string item in SaveManager.AllUpgradesUnlocked) { Loggers.LogDebug("Updating upgrade status for " + item); if (item == "BioscanPatch") { enemyScanUpgradeEnabled = true; } else if (item == "VitalsPatch") { vitalsUpgradeEnabled = true; } else { Loggers.WARNING("Unexpected upgrade unlock name [ " + item + " ]"); } } } internal static string BioscanCommand() { if ((Object)(object)RoundManager.Instance != (Object)null) { int count = RoundManager.Instance.SpawnedEnemies.Count; int groupCredits = Plugin.instance.Terminal.groupCredits; int value = Commands.BioScanCost.Value; string result; if (ShouldRunBioscan2(groupCredits, value)) { int newCreds = CalculateNewCredits(groupCredits, value, Plugin.instance.Terminal); List livingEnemiesList = GetLivingEnemiesList(); string text = FilterLivingEnemies(livingEnemiesList); string bioscanResult = GetBioscanResult(count, value, newCreds, text); result = bioscanResult; Loggers.LogInfo("Living Enemies(filtered): " + text); return result; } if (groupCredits >= value) { int newCreds2 = CalculateNewCredits(groupCredits, value, Plugin.instance.Terminal); string basicBioscanResult = GetBasicBioscanResult(count, value, newCreds2); result = basicBioscanResult; Loggers.LogInfo("v1 scanner utilized, only numbers shown"); return result; } result = "Not enough credits to run Biomatter Scanner.\n"; Loggers.LogInfo("brokeboy detected"); return result; } return "Cannot scan for Biomatter at this time.\n"; } private static bool ShouldRunBioscan2(int getCreds, int costCreds) { if (enemyScanUpgradeEnabled) { return getCreds >= costCreds; } return false; } private static string GetBasicBioscanResult(int scannedEnemies, int costCreds, int newCreds) { return $"Biomatter scanner charged {costCreds} credits and has detected [{scannedEnemies}] non-employee organic objects.\n\nYour new balance is ■{newCreds} Credits.\n"; } private static List GetLivingEnemiesList() { return RoundManager.Instance.SpawnedEnemies.Where((EnemyAI enemy) => !enemy.isEnemyDead).ToList(); } private static string FilterLivingEnemies(List livingEnemies) { string input = string.Join(Environment.NewLine, livingEnemies.Select((EnemyAI enemy) => ((object)enemy).ToString())); string pattern = "\\([^)]*\\)"; return Regex.Replace(input, pattern, string.Empty); } private static string GetBioscanResult(int scannedEnemies, int costCreds, int newCreds, string filteredLivingEnemiesString) { string text = $"Biomatter scanner charged {costCreds} credits and has detected [{scannedEnemies}] non-employee organic objects.\n\n"; if (!string.IsNullOrEmpty(filteredLivingEnemiesString)) { text += $"Your new balance is ■{newCreds} Credits.\n\nDetailed scan has defined these objects as the following in the registry: \n{filteredLivingEnemiesString}\n"; } else { text += $"Your new balance is ■{newCreds} Credits.\n"; Loggers.LogInfo("v1 scanner utilized, only numbers shown"); } return text; } internal static string VitalsCommand() { PlayerControllerB targetedPlayer = GameStuff.TerminalMapRenderer.targetedPlayer; if ((Object)(object)targetedPlayer == (Object)null) { return "Vitals command malfunctioning...\n\n"; } int groupCredits = Plugin.instance.Terminal.groupCredits; int costCreds = GetCostCreds(vitalsUpgradeEnabled); string playerUsername = targetedPlayer.playerUsername; Loggers.LogInfo("playername: " + playerUsername); if (ShouldDisplayVitals(targetedPlayer, groupCredits, costCreds)) { int newCreds = CalculateNewCredits(groupCredits, costCreds, Plugin.instance.Terminal); string vitalsInfo = GetVitalsInfo(targetedPlayer); string creditsInfo = GetCreditsInfo(newCreds); if (!vitalsUpgradeEnabled) { return $"Charged ■{costCreds} Credits. \n{vitalsInfo}\n{creditsInfo}"; } return vitalsInfo + "\n" + creditsInfo; } return ConfigSettings.VitalsPoorString.Value + "\n"; } internal static int GetCostCreds(bool upgradeStatus) { if (!upgradeStatus) { return Commands.VitalsCost.Value; } return 0; } internal static string AskBioscanUpgrade() { if (!enemyScanUpgradeEnabled) { return $"Purchase the BioScanner 2.0 Upgrade Patch?\nThis software update is available for {Commands.BioScanUpgradeCost.Value} Credits.\n\n\n\n\n\n\n\n\n\n\nPlease CONFIRM or DENY.\n"; } TerminalGeneral.CancelConfirmation = true; return "BioScanner software has already been updated to the latest patch (2.0).\n\n"; } internal static string AskVitalsUpgrade() { if (!vitalsUpgradeEnabled) { return $"Purchase the Vitals Scanner 2.0 Patch?\nThis software update is available for {Commands.VitalsUpgradeCost.Value} Credits.\n\n\n\n\n\n\n\n\n\n\nPlease CONFIRM or DENY.\n"; } TerminalGeneral.CancelConfirmation = true; return "Vitals Scanner software has already been updated to the latest patch (2.0).\n\n"; } internal static string PerformBioscanUpgrade() { if (!enemyScanUpgradeEnabled) { int num = Plugin.instance.Terminal.groupCredits - Commands.BioScanUpgradeCost.Value; string result = $"Biomatter Scanner software has been updated to the latest patch (2.0) and now provides more detailed information!\n\nYour new balance is ■{num} Credits\n"; SaveManager.NewUnlock("BioscanPatch"); Plugin.instance.Terminal.SyncGroupCreditsServerRpc(num, Plugin.instance.Terminal.numberOfItemsInDropship); Plugin.instance.Terminal.PlayTerminalAudioServerRpc(0); return result; } return "BioScanner software has already been updated to the latest patch (2.0).\n\n"; } internal static string GetRefund() { int numberOfItemsInDropship = Plugin.instance.Terminal.numberOfItemsInDropship; Item[] buyables = Plugin.instance.Terminal.buyableItemsList; List returnlist = new List(); int num = 0; Loggers.LogInfo($"buyables: {buyables.Length}, deliverables: {numberOfItemsInDropship}, storeCart: {storeCart.Count}"); StoreRefundList.storeRefundItems = new List(); if (numberOfItemsInDropship > 0) { foreach (int num2 in storeCart) { if (num2 <= buyables.Length) { StoreRefundItem storeRefundItem = StoreRefundList.storeRefundItems.FirstOrDefault((StoreRefundItem i) => (Object)(object)i.item == (Object)(object)buyables[num2]); if (storeRefundItem != null) { storeRefundItem.count++; Loggers.LogDebug($"Updating refundItem ({storeRefundItem.item.itemName}) count to {storeRefundItem.count}"); } else { Loggers.LogDebug("Creating refundItem for " + buyables[num2].itemName + "!"); storeRefundItem = new StoreRefundItem(buyables[num2], 1); storeRefundItem.GetValue(buyables, num2); StoreRefundList.storeRefundItems.Add(storeRefundItem); } num += storeRefundItem.value; Loggers.LogDebug($"Adding {storeRefundItem.item.itemName} ${storeRefundItem.value} to refund list"); } else { Loggers.WARNING($"Unable to add item at index {num2} to refund list! (out of index)"); } } CollectionExtensions.Do((IEnumerable)StoreRefundList.storeRefundItems, (Action)delegate(StoreRefundItem x) { returnlist.Add($"${x.value} {x.item.itemName} x {x.count}\n"); }); Loggers.LogDebug($"old creds: {Plugin.instance.Terminal.groupCredits}"); int num3 = Plugin.instance.Terminal.groupCredits + num; Plugin.instance.Terminal.groupCredits = num3; Loggers.LogDebug($"new creds: {num3}"); Plugin.instance.Terminal.orderedItemsFromTerminal.Clear(); storeCart.Clear(); NetHandler.Instance.SyncDropShipRpc(isRefund: true); NetHandler.Instance.SyncHostCreditsRpc(num3, 0); string arg = ListToStringBuild(returnlist); Loggers.LogInfo($"Refund total: ${num}"); string result = $"Cancelling order for:\n{arg}\nYou have been refunded ■{num} Credits!\n"; Plugin.instance.Terminal.PlayTerminalAudioServerRpc(0); return result; } return "No ordered items detected on the dropship.\n\n"; } private static string ListToStringBuild(List list) { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < list.Count; i++) { stringBuilder.Append(list[i]); } return stringBuilder.ToString(); } internal static string PerformVitalsUpgrade() { if (!vitalsUpgradeEnabled) { int num = Plugin.instance.Terminal.groupCredits - Commands.VitalsUpgradeCost.Value; SaveManager.NewUnlock("VitalsPatch"); string result = $"Vitals Scanner software has been updated to the latest patch (2.0) and no longer requires credits to scan.\n\nYour new balance is ■{num} credits\n"; Plugin.instance.Terminal.SyncGroupCreditsServerRpc(num, Plugin.instance.Terminal.numberOfItemsInDropship); Plugin.instance.Terminal.PlayTerminalAudioServerRpc(0); return result; } return "Update already purchased.\n"; } private static bool ShouldDisplayVitals(PlayerControllerB playerInfo, int getCreds, int costCreds) { if (!playerInfo.isPlayerDead) { if (getCreds < costCreds) { return vitalsUpgradeEnabled; } return true; } return false; } internal static int CalculateNewCredits(int getCreds, int costCreds, Terminal frompatch) { int num = (frompatch.groupCredits = getCreds - costCreds); NetHandler.Instance.SyncHostCreditsRpc(num, frompatch.numberOfItemsInDropship); return num; } private static string GetVitalsInfo(PlayerControllerB playerInfo) { int health = playerInfo.health; float carryWeight = playerInfo.carryWeight; float insanityLevel = playerInfo.insanityLevel; bool flag = playerInfo.ItemSlots.Any((GrabbableObject item) => item is FlashlightItem); float num = Mathf.RoundToInt(Mathf.Clamp(carryWeight - 1f, 0f, 100f) * 105f); string text = $"{playerInfo.playerUsername} Vitals:\n\n Health: {health}\n Weight: {num}\n Sanity: {insanityLevel}"; if (flag) { float num2 = Mathf.RoundToInt(playerInfo.pocketedFlashlight.insertedBattery.charge * 100f); text += $"\n Flashlight Battery Percentage: {num2}%"; } return text; } private static string GetCreditsInfo(int newCreds) { return $"Your new balance is ■{newCreds} Credits.\n"; } } internal class DynamicCommands { internal static bool newParsedValue; internal static bool validFovNum; internal static bool fovEnum; public static int ParsedValue { get; internal set; } public static string Linktext { get; internal set; } internal static string BindKeyToCommand() { string[] words = StringStuff.GetWords(); ShortcutBindings.BindToCommand(words, words.Length, out string displayText); return displayText; } internal static string UnBindKeyToCommand() { string[] words = StringStuff.GetWords(); ShortcutBindings.UnbindKey(words, words.Length, out string displayText); return displayText; } internal static string FovPrompt() { if (!Plugin.instance.FovAdjust) { validFovNum = false; string result = "Unable to change your fov at this time...\n\tRequired mod [FOVAdjust] is not loaded!\n\n"; Loggers.WARNING("not enough words for the fov command!"); return result; } string afterKeyword = StringStuff.GetAfterKeyword(StringStuff.GetKeywordsPerConfigItem(KeywordConfigs.FovKeywords.Value)); if (afterKeyword.Length < 1) { validFovNum = false; string result2 = "Unable to change your fov at this time...\n\tInvalid input detected, no digits were provided!\n\n"; Loggers.WARNING("not enough words for the fov command!"); return result2; } if (int.TryParse(afterKeyword, out var result3)) { newParsedValue = true; validFovNum = true; Loggers.LogDebug("))))))))))))))))))Integer Established"); ParsedValue = result3; return $"Set your FOV to {ParsedValue}?\n\n\n\n\n\n\n\n\n\n\n\nPlease CONFIRM or DENY.\n"; } validFovNum = false; string result4 = "Unable to change your fov at this time...\n\tInvalid input detected!\n\tInput: " + afterKeyword + "\n\n"; Loggers.WARNING("there are no digits for the fov command!"); return result4; } internal static string FovConfirm() { if (validFovNum) { Loggers.LogInfo("Valid fov value detected, returning fov command action"); FovNodeText(out string displayText); return displayText; } Loggers.LogInfo("attempting to confirm invalid fov. Returning error"); return Plugin.instance.Terminal.terminalNodes.specialNodes[5].displayText; } internal static string FovDeny() { if (validFovNum) { Loggers.LogInfo("Valid fov value detected, but fov has been canceled"); return $"Fov change to {ParsedValue} has been canceled.\n\n\n"; } Loggers.LogInfo("attempting to confirm invalid fov. Returning error"); return Plugin.instance.Terminal.terminalNodes.specialNodes[5].displayText; } private static void FovNodeText(out string displayText) { TerminalNode currentNode = Plugin.instance.Terminal.currentNode; if (!Plugin.instance.FovAdjust) { displayText = "FovAdjust mod is not installed, command can not be run.\n"; return; } int parsedValue = ParsedValue; float num = parsedValue; if (num != 0f && num >= 66f && num <= 130f && newParsedValue) { currentNode.clearPreviousText = true; displayText = "Setting FOV to - " + parsedValue + "\n\n"; ((MonoBehaviour)Plugin.instance.Terminal).StartCoroutine(FovEnum(Plugin.instance.Terminal, num)); } else { displayText = "Fov can only be set between 66 and 130\n"; } } private static IEnumerator FovEnum(Terminal term, float number) { if (!fovEnum) { fovEnum = true; yield return (object)new WaitForSeconds(0.5f); FovAdjustStuff.FovAdjustFunc(term, number); fovEnum = false; } } } internal class GambaCommands { internal static bool validGambleValue; internal static string Ask2Gamble() { Loggers.LogInfo("Ask2Gamble"); string afterKeyword = StringStuff.GetAfterKeyword(StringStuff.GetKeywordsPerConfigItem(KeywordConfigs.GambleKeywords.Value)); if (afterKeyword.Length < 1) { TerminalGeneral.CancelConfirmation = true; validGambleValue = false; string result = "Unable to gamble at this time...\n\tInvalid input detected, no digits were provided!\n\n"; Loggers.WARNING("not enough words for the gamble command!"); return result; } if (int.TryParse(afterKeyword, out var result2)) { if (result2 < 0 || result2 > 100) { return BadInputGamble(afterKeyword); } DynamicCommands.newParsedValue = true; validGambleValue = true; Loggers.LogInfo("))))))))))))))))))Integer Established"); DynamicCommands.ParsedValue = result2; return $"Gamble {DynamicCommands.ParsedValue}% of your credits?\n\n\n\n\n\n\n\n\n\n\n\nPlease CONFIRM or DENY.\n"; } return BadInputGamble(afterKeyword); } internal static string BadInputGamble(string val) { TerminalGeneral.CancelConfirmation = true; validGambleValue = false; string result = "Unable to gamble at this time...\n\tInvalid input detected!\n\tInput: " + val + "\n\n"; Loggers.WARNING("there are no digits for the gamble command!"); return result; } internal static string GambleConfirm() { if (validGambleValue) { Loggers.LogInfo("Valid gamble value detected, returning gamble command action"); BasicGambleCommand(out string displayText); return displayText; } Loggers.LogInfo("attempting to confirm invalid gamble. Returning error"); return Plugin.instance.Terminal.terminalNodes.specialNodes[5].displayText; } internal static string GambleDeny() { if (validGambleValue) { Loggers.LogInfo("Valid gamble value detected, but gamble has been canceled"); return $"Gamble for {DynamicCommands.ParsedValue}% of your credits has been canceled.\n\n\n"; } Loggers.LogInfo("attempting to confirm invalid gamble. Returning error"); return Plugin.instance.Terminal.terminalNodes.specialNodes[5].displayText; } internal static void BasicGambleCommand(out string displayText) { float num = DynamicCommands.ParsedValue; if (!DynamicCommands.newParsedValue || num < 0f || num > 100f) { Loggers.LogInfo("Invalid percentage value. Telling user."); displayText = "Invalid gamble percentage, please input a value between 0 and 100.\n\n"; return; } if (Plugin.instance.Terminal.groupCredits <= ConfigSettings.GambleMinimum.Value) { Loggers.LogInfo("Invalid percentage value. Telling user."); displayText = ConfigSettings.GamblePoorString.Value + "\n\n"; return; } (int, string) tuple = Gamble(Plugin.instance.Terminal.groupCredits, num); Plugin.instance.Terminal.groupCredits = tuple.Item1; NetHandler.Instance.SyncHostCreditsRpc(tuple.Item1, Plugin.instance.Terminal.numberOfItemsInDropship); DynamicCommands.newParsedValue = false; displayText = tuple.Item2; } private static (int newGroupCredits, string displayText) Gamble(int currentGroupCredits, float percentage) { percentage = Mathf.Clamp(percentage, 0f, 100f); int num = (int)((float)currentGroupCredits * (percentage / 100f)); float value = Random.value; float value2 = Random.value; if (value < value2) { string item = $"Congratulations! You won ■{num} credits!\n\nYour new balance is ■{currentGroupCredits + num} Credits.\n"; return (newGroupCredits: currentGroupCredits + num, displayText: item); } int num2 = currentGroupCredits - num; if (ConfigSettings.GamblePityMode.Value && num2 == 0) { if (ConfigSettings.GamblePityCredits.Value <= 60) { string item2 = $"Sorry, you lost ■{num} credits.\n\nHowever, you've received {ConfigSettings.GamblePityCredits.Value} Pity Credits.\n\nYour new balance is ■{ConfigSettings.GamblePityCredits.Value} Credits.\n"; return (newGroupCredits: ConfigSettings.GamblePityCredits.Value, displayText: item2); } string item3 = $"Sorry, you lost ■{num} credits.\n\nUnfortunately we're also fresh out of Pity Credits due to malicious actors.\n\nYour new balance is ■{num2} Credits.\n"; return (newGroupCredits: currentGroupCredits - num, displayText: item3); } string item4 = $"Sorry, you lost ■{num} credits.\n\nYour new balance is ■{num2} Credits.\n"; return (newGroupCredits: currentGroupCredits - num, displayText: item4); } } internal class LevelCommands { internal static List bannedWeather = new List(); internal static List bannedWeatherConfig = new List(); internal static string RouteRandomCommand() { //IL_00c5: Unknown result type (might be due to invalid IL or missing references) if (Plugin.instance.Terminal.groupCredits < ConfigSettings.RouteRandomCost.Value) { return $"You cannot afford to run the 'route random' command.\n\n\tRoute Random Cost: [{ConfigSettings.RouteRandomCost.Value}]\n\tYour credits: [{Plugin.instance.Terminal.groupCredits}]\n\n\n"; } bannedWeatherConfig = StringStuff.GetKeywordsPerConfigItem(ConfigSettings.RouteRandomBannedWeather.Value); bannedWeather = StringStuff.GetListToLower(bannedWeatherConfig); List list = new List(); SelectableLevel[] moonsCatalogueList = Plugin.instance.Terminal.moonsCatalogueList; foreach (SelectableLevel val in moonsCatalogueList) { if (bannedWeather.Contains(((object)Unsafe.As(ref val.currentWeather)/*cast due to .constrained prefix*/).ToString().ToLower())) { Loggers.LogInfo($"{val.PlanetName} has banned weather: {val.currentWeather}"); } else if (ConfigSettings.RouteOnlyInCurrentConstellation.Value && Plugin.instance.Constellations) { if (ConstellationsCompat.IsLevelInConstellation(val)) { list.Add(val); Loggers.LogInfo("Added " + val.PlanetName + " to valid random planets within the current constellation!"); } } else { list.Add(val); Loggers.LogInfo("Added " + val.PlanetName + " to valid random planets"); } } if (list.Count < 1) { return "Route Random was unable to select a valid moon and you have not been charged.\n\nThis may be due to all moons have banned weather attributes...\n\n\n"; } Random random = new Random(); int index = random.Next(0, list.Count); Loggers.LogInfo(list[index].PlanetName + " has been chosen!"); StartOfRound.Instance.ChangeLevelServerRpc(list[index].levelID, Plugin.instance.Terminal.groupCredits); StartOfRound.Instance.SetMapScreenInfoToCurrentLevel(); int num = CostCommands.CalculateNewCredits(Plugin.instance.Terminal.groupCredits, ConfigSettings.RouteRandomCost.Value, Plugin.instance.Terminal); return $"Your new balance is ■{num} Credits.\n\nRoute Random has chosen {list[index].PlanetName}!\n\n\tEnjoy!\n\n"; } } internal class SuitCommands { internal static void GetRandomSuit(out string displayText) { List list = new List(); List list2 = new List(); list = Resources.FindObjectsOfTypeAll().ToList(); displayText = string.Empty; if (list.Count > 1) { list = list.OrderBy((UnlockableSuit suit) => suit.suitID).ToList(); list.RemoveAll((UnlockableSuit suit) => suit.syncedSuitID.Value < 0); list2 = StartOfRound.Instance.unlockablesList.unlockables; Random random = new Random(); if (list2 != null) { for (int num = 0; num < list2.Count; num++) { int index = random.Next(0, list.Count); UnlockableSuit val = list[index]; if ((Object)(object)val != (Object)null && list2[val.syncedSuitID.Value] != null) { string unlockableName = list2[val.syncedSuitID.Value].unlockableName; val.SwitchSuitToThis((PlayerControllerB)null); displayText = "Changing suit to " + unlockableName + "!\n"; return; } } displayText = "A suit could not be found.\n"; Plugin.Log.LogInfo((object)"Random suit ID was invalid or null"); } else { displayText = "A suit could not be found.\n"; Plugin.Log.LogInfo((object)"Unlockables are null"); } } else { displayText = "Not enough suits detected.\n"; Plugin.Log.LogInfo((object)"allsuits count too low"); } } } public static class TerminalEvents { internal static string lastText = ""; internal static string VideoErrorMessage = ""; public static bool clockDisabledByCommand = false; internal static bool quitTerminalEnum = false; internal static Color transparent = new Color(0f, 0f, 0f, 0f); public static TerminalSettings terminalSettings { get; internal set; } = new TerminalSettings(); internal static List PurchasePacks { get; set; } = new List(); internal static void CreateStorePacks() { if (!Commands.TerminalPurchasePacks.Value || ConfigSettings.PurchasePackCommands.Value == "") { return; } Dictionary keywordAndItemNames = StringStuff.GetKeywordAndItemNames(ConfigSettings.PurchasePackCommands.Value); if (keywordAndItemNames.Count == 0) { return; } foreach (KeyValuePair item in keywordAndItemNames) { Loggers.LogDebug("setting " + item.Key + " keyword to purchase pack with items: " + item.Value); if (PurchasePacks.Count != 0) { CommandManager val = ((IEnumerable)PurchasePacks).FirstOrDefault((Func)((CommandManager p) => p.KeywordList.Contains(item.Key))); if (val != null) { val.RegisterCommand(); continue; } } CommandManager val2 = Commands.AddLocalCommmandManualWords(item.Key + "_PP", Commands.TerminalPurchasePacks, new List(1) { item.Key }, StorePacks.AskPurchasePack, "Comfort", clearText: true, addAtAwake: false); Commands.AddStoreCommand(val2, item.Key ?? "", 0, StorePacks.CompletePurchasePack, () => "You have cancelled the purchase of Purchase Pack [" + item.Key + "].\n\n", 0, alwaysInStock: true); val2.RegisterCommand(); PurchasePacks.Add(val2); StorePlus.ExcludedNodesFromAutoGen.Add(val2.terminalNode); StorePacks storePacks = StorePacksInfo.AllPacks.FirstOrDefault((StorePacks s) => s.Name == item.Key); if (storePacks != null) { storePacks.UpdateExisting(item.Value, val2); } else { storePacks = new StorePacks(item.Key, item.Value, val2); } } } internal static TerminalNode GetNodeFromList(string query, Dictionary nodeListing) { foreach (KeyValuePair item in nodeListing) { if (item.Key == query) { return item.Value; } } return null; } internal static string RandomSuit() { SuitCommands.GetRandomSuit(out string displayText); return displayText; } internal static string QuitTerminalCommand() { string result = ConfigSettings.QuitString.Value ?? ""; ((MonoBehaviour)Plugin.instance.Terminal).StartCoroutine(TerminalQuitter(Plugin.instance.Terminal)); return result; } internal static IEnumerator TerminalQuitter(Terminal terminal) { if (!quitTerminalEnum) { if (Plugin.instance.CruiserTerm && CruiserTerm.Status()) { quitTerminalEnum = true; yield return (object)new WaitForSeconds(0.5f); CruiserTerm.Quit(); quitTerminalEnum = false; } else { quitTerminalEnum = true; yield return (object)new WaitForSeconds(0.5f); terminal.QuitTerminal(true); quitTerminalEnum = false; } } } internal static string ClockToggle() { if ((Object)(object)TerminalClockStuff.textComponent == (Object)null) { return "Unable to find Terminal Clock component!\n\n"; } if (StartOfRound.Instance.inShipPhase) { return "Unable to determine time zone while in Orbit!\n\n"; } if (!clockDisabledByCommand && TerminalClockStuff.IsClockVisible()) { Loggers.LogDebug("Disabling clock via command!"); clockDisabledByCommand = true; TerminalClockStuff.SetClockVisible(visible: false); return "Terminal Clock [DISABLED].\n"; } Loggers.LogDebug("Enabling clock via command!"); clockDisabledByCommand = false; TerminalClockStuff.SetClockVisible(visible: true); return "Terminal Clock [ENABLED].\n"; } internal static string GetCleanedScreenText(Terminal __instance) { string text = __instance.screenText.text; int textAdded = __instance.textAdded; int length = text.Length; int num = length - textAdded; string s = text.Substring(num, length - num); return RemovePunctuation(s); } private static string RemovePunctuation(string s) { StringBuilder stringBuilder = new StringBuilder(); foreach (char c in s) { if (!char.IsPunctuation(c)) { stringBuilder.Append(c); } } return stringBuilder.ToString().ToLower(); } internal static void ShouldLockPlayerCamera(bool value, PlayerControllerB localPlayer) { if (QoLConfig.LockCameraInTerminal.Value && (Object)(object)localPlayer != (Object)null) { localPlayer.disableLookInput = !value; Loggers.LogInfo($"ShouldLockPlayerCamera set to: {!value}"); } } internal static void ShouldDisableTerminalLight(bool value, string setting) { if (!(setting == "nochange") && ((Behaviour)Plugin.instance.Terminal.terminalLight).enabled == value) { ((Behaviour)Plugin.instance.Terminal.terminalLight).enabled = !value; Loggers.LogInfo($"terminalLight set to {!value} for setting: {setting}"); } } internal static string RefreshCustomizationCommand() { string result = "Refreshing TerminalCustomization from config.\n\n"; TerminalCustomizer.TerminalCustomization(); return result; } internal static int PlayerNameToTargetInt(string query, List radarTargets) { query = query.TrimStart(); if (query.Length <= 2) { return -1; } Dictionary dictionary = new Dictionary(); for (int i = 0; i < radarTargets.Count; i++) { if (MoreCamStuff.TargetIsValid(radarTargets[i])) { if (Misc.StringStartsWithInvariant(radarTargets[i].name, query.Substring(0, 2), true)) { int num = Levenshtein.Distance(query, radarTargets[i].name); Loggers.LogDebug($"TargetNum {i} has score {num}"); dictionary.Add(i, num); continue; } Loggers.LogDebug("name [ " + radarTargets[i].name + " ] does not match start of query [ " + query.Substring(0, 2) + " ]"); } } if (dictionary.Count == 0) { return -1; } return dictionary.OrderBy((KeyValuePair x) => x.Value).First().Key; } internal static string PlayerNameToTargetString(string query, List radarTargets) { query = query.TrimStart(); if (query.Length <= 2) { return ""; } Dictionary dictionary = new Dictionary(); for (int i = 0; i < radarTargets.Count; i++) { if (MoreCamStuff.TargetIsValid(radarTargets[i])) { if (Misc.StringStartsWithInvariant(radarTargets[i].name, query.Substring(0, 2), true)) { int num = Levenshtein.Distance(query, radarTargets[i].name); Loggers.LogDebug($"TargetNum {i} has score {num}"); dictionary.Add(radarTargets[i].name, num); continue; } Loggers.LogDebug("name [ " + radarTargets[i].name + " ] does not match start of query [ " + query.Substring(0, 2) + " ]"); } } if (dictionary.Count == 0) { return ""; } return dictionary.OrderBy((KeyValuePair x) => x.Value).First().Key; } internal static void LoadAndSync(TerminalNode node) { if (!((Object)(object)node == (Object)null)) { Plugin.instance.Terminal.LoadNewNode(node); Loggers.LogDebug("Loading node!"); if (ConfigSettings.NetworkedNodes.Value && !((Object)(object)NetHandler.Instance == (Object)null)) { Loggers.LogDebug("Syncing with TerminalStuff!"); TerminalParse.NetSync(node); } } } } public class TerminalSettings { public TerminalNode startPage; public string startPageValue { get; internal set; } = string.Empty; internal void StartPage(string entry) { startPageValue = entry; startPage = null; if (!Misc.StringStartsWithInvariant(startPageValue, "none", true) && startPageValue.Length >= 2) { TerminalKeyword val = default(TerminalKeyword); if (DynamicBools.TryGetKeyword(startPageValue, ref val)) { startPage = val.specialKeywordResult; } else { Loggers.WARNING("Unable to find matching keyword for start page - " + entry); } } } } public static class ConfigSettings { public static ConfigEntry TerminalCustomization { get; internal set; } public static ConfigEntry LogLevel { get; internal set; } public static ConfigEntry CamsUseDetectedMods { get; internal set; } public static ConfigEntry ObcRequireUpgrade { get; internal set; } public static ConfigEntry ObcResolutionMirror { get; internal set; } public static ConfigEntry ObcResolutionBodyCam { get; internal set; } public static ConfigEntry MirrorZoom { get; internal set; } public static ConfigEntry Mirror2DStyle { get; internal set; } public static ConfigEntry ModNetworking { get; internal set; } public static ConfigEntry NetworkedNodes { get; internal set; } public static ConfigEntry CanOpenDoorInSpace { get; internal set; } public static ConfigEntry DoorOpenString { get; internal set; } public static ConfigEntry DoorCloseString { get; internal set; } public static ConfigEntry DoorSpaceString { get; internal set; } public static ConfigEntry QuitString { get; internal set; } public static ConfigEntry LeverString { get; internal set; } public static ConfigEntry VideoStartString { get; internal set; } public static ConfigEntry VideoStopString { get; internal set; } public static ConfigEntry TpMessageString { get; internal set; } public static ConfigEntry ItpMessageString { get; internal set; } public static ConfigEntry VitalsPoorString { get; internal set; } public static ConfigEntry VitalsUpgradePoor { get; internal set; } public static ConfigEntry HealIsFullString { get; internal set; } public static ConfigEntry HealString { get; internal set; } public static ConfigEntry CamOnString { get; internal set; } public static ConfigEntry CamOffString { get; internal set; } public static ConfigEntry MapOnString { get; internal set; } public static ConfigEntry MapOffString { get; internal set; } public static ConfigEntry OverlayOnString { get; internal set; } public static ConfigEntry OverlayOffString { get; internal set; } public static ConfigEntry MiniMapOnString { get; internal set; } public static ConfigEntry MiniMapOffString { get; internal set; } public static ConfigEntry MiniCamsOnString { get; internal set; } public static ConfigEntry MiniCamsOffString { get; internal set; } public static ConfigEntry GambleMinimum { get; internal set; } public static ConfigEntry GamblePityMode { get; internal set; } public static ConfigEntry GamblePityCredits { get; internal set; } public static ConfigEntry GamblePoorString { get; internal set; } public static ConfigEntry VideoFolderPath { get; internal set; } public static ConfigEntry VideoSync { get; internal set; } public static ConfigEntry AlwaysUniqueVideo { get; internal set; } public static ConfigEntry KeepMonitoringNodes { get; internal set; } public static ConfigEntry MonitoringDefaultView { get; internal set; } public static ConfigEntry OverlayOpacity { get; internal set; } public static ConfigEntry CustomLink { get; internal set; } public static ConfigEntry CustomLink2 { get; internal set; } public static ConfigEntry CustomLinkHint { get; internal set; } public static ConfigEntry CustomLink2Hint { get; internal set; } public static ConfigEntry RouteRandomBannedWeather { get; internal set; } public static ConfigEntry RouteRandomCost { get; internal set; } public static ConfigEntry RouteOnlyInCurrentConstellation { get; internal set; } public static ConfigEntry PurchasePackCommands { get; internal set; } public static ConfigEntry CruiserTerminalFilterType { get; internal set; } public static ConfigEntry CruiserKeywordList { get; internal set; } public static void BindConfigSettings() { ModNetworking = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Networking", "ModNetworking", true, "Disable this if you want to disable networking and use this mod as a Client-sided mod"); NetworkedNodes = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Networking", "NetworkedNodes", true, "Enable networked Always-On Display & displaying synced terminal nodes"); LogLevel = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Debug", "ExtensiveLogging", (LoggingLevel)8, "Set the logging level for DarmuhsTerminalStuff (this mod)."); PurchasePackCommands = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Comfort Configuration", "PurchasePackCommands", "Essentials:pro,shov,walkie;PortalPack:teleporter,inverse", "List of purchase pack commands to create. Format is command:item1,item2,etc.;next command:item1,item2"); Loggers.LogDebug("network configs section done"); Loggers.LogDebug("keybind configs section done"); CamsUseDetectedMods = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Extras Configuration", "CamsUseDetectedMods", true, "With this enabled, this mod will detect if another mod that adds player cams is enabled and use the mod's camera for all cams commands. Currently detects the following: Helmet Cameras by Rick Arg, Body Cameras by Solo, OpenBodyCams by Zaggy1024"); ObcRequireUpgrade = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Extras Configuration", "ObcRequireUpgrade", true, "With this enabled (and CamsUseDetectedMods), cams views will not be available until the bodycam upgrade from OpenBodyCams has been unlocked."); RouteRandomBannedWeather = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Fun Configuration", "RouteRandomBannedWeather", "Eclipsed;Flooded;Foggy", "This semi-colon separated list will be used to exclude moons from the route random command"); RouteRandomCost = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Fun Configuration", "RouteRandomCost", 100, "Flat rate for running the route random command to get a random moon...", 0, 99999); RouteOnlyInCurrentConstellation = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Fun Configuration", "RouteOnlyInCurrentConstellation", true, "When LethalConstellations mod is present, setting this to true will only choose a random moon within the current constellation"); Loggers.LogDebug("cost configs section done"); KeywordConfigs.Init(); DoorOpenString = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Controls Configuration", "DoorOpenString", "Opening door.", "Message returned on door (open) command."); DoorCloseString = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Controls Configuration", "DoorCloseString", "Closing door.", "Message returned on door (close) command."); DoorSpaceString = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Controls Configuration", "DoorSpaceString", "Can't open doors in space.", "Message returned on door (inSpace) command."); CanOpenDoorInSpace = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Controls Configuration", "CanOpenDoorInSpace", true, "Allow/Disallow for using the terminal to press the button to open the door in space.\nDoes not change whether the door can actually be opened."); QuitString = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Comfort Configuration", "QuitString", "goodbye!", "Message returned on quit command."); LeverString = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Controls Configuration", "LeverString", "PULLING THE LEVER!!!", "Message returned on lever pull command."); VideoStartString = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Fun Configuration", "VideoStartString", "lol.", "Message displayed when first playing a video."); VideoStopString = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Fun Configuration", "VideoStopString", "No more lol.", "Message displayed if you want to end video playback early."); TpMessageString = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Controls Configuration", "TpMessageString", "Teleport Button pressed.", "Message returned when TP command is run."); ItpMessageString = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Controls Configuration", "ItpMessageString", "Inverse Teleport Button pressed.", "Message returned when ITP command is run."); VitalsPoorString = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Upgrades", "VitalsPoorString", "You can't afford to run this command.", "Message returned when you don't have enough credits to run the command."); VitalsUpgradePoor = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Upgrades", "VitalsUpgradePoor", "You can't afford to upgrade the Vitals Scanner.", "Message returned when you don't have enough credits to unlock the vitals scanner upgrade."); HealIsFullString = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Comfort Configuration", "HealIsFullString", "You are full health!", "Message returned when heal command is run and player is already full health."); HealString = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Comfort Configuration", "HealString", "The terminal healed you?!?", "Message returned when heal command is run and player is healed."); CamOnString = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Extras Configuration", "CamOnString", "(CAMS)", "Message returned when enabling Cams command (cams)."); CamOffString = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Extras Configuration", "CamOffString", "Cameras disabled.", "Message returned when disabling Cams command (cams)."); MapOnString = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Extras Configuration", "MapOnString", "(MAP)", "Message returned when enabling map command (map)."); MapOffString = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Extras Configuration", "MapOffString", "Map View disabled.", "Message returned when disabling map command (map)."); OverlayOnString = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Extras Configuration", "OverlayOnString", "(Overlay)", "Message returned when enabling Overlay command (overlay)."); OverlayOffString = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Extras Configuration", "OverlayOffString", "Overlay disabled.", "Message returned when disabling Overlay command (overlay)."); MiniMapOnString = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Extras Configuration", "MiniMapOnString", "(MiniMap)", "Message returned when enabling minimap command (minimap)."); MiniMapOffString = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Extras Configuration", "MiniMapOffString", "MiniMap disabled.", "Message returned when disabling minimap command (minimap)."); MiniCamsOnString = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Extras Configuration", "MiniCamsOnString", "(MiniCams)", "Message returned when enabling minicams command (minicams)."); MiniCamsOffString = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Extras Configuration", "MiniCamsOffString", "MiniCams disabled.", "Message returned when disabling minicams command (minicams)."); CustomLink = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Extras Configuration", "CustomLink", "https://thunderstore.io/c/lethal-company/p/darmuh/darmuhsTerminalStuff/", "URL to send players to when using the \"link\" command."); CustomLinkHint = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Extras Configuration", "CustomLinkHint", "Go to the thunderstore listing for this mod.", "Hint given to players in extras menu for \"link\" command."); CustomLink2 = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Extras Configuration", "CustomLink2", "https://github.com/darmuh/TerminalStuff", "URL to send players to when using the second \"link\" command."); CustomLink2Hint = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Extras Configuration", "CustomLink2Hint", "Go to the github for this mod.", "Hint given to players in extras menu for \"link\" command."); GambleMinimum = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Fun Configuration", "GambleMinimum", 0, "Credits needed to start gambling, 0 means you can gamble everything."); GamblePityMode = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Fun Configuration", "GamblePityMode", false, "Enable Gamble Pity Mode, which gives credits back to those who lose everything."); GamblePityCredits = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Fun Configuration", "GamblePityCredits", 10, "If Gamble Pity Mode is enabled, specify how much Pity Credits are given to losers. (Max: 60)", 0, 60); GamblePoorString = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Fun Configuration", "GamblePoorString", "You don't meet the minimum credits requirement to gamble.", "Message returned when your credits is less than the GambleMinimum set."); VideoFolderPath = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Fun Configuration", "VideoFolderPath", "darmuh-darmuhsTerminalVideos", "Folder name where videos will be pulled from, needs to be in BepInEx/plugins"); VideoSync = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Fun Configuration", "VideoSync", true, "When networking is enabled, this setting will sync videos being played on the terminal for all players whose terminal screen is on."); AlwaysUniqueVideo = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Fun Configuration", "AlwaysUniqueVideo", true, "When enabled, this setting will shuffle all of the videos into a list. Each time a video command is run it will play a video from the list until it reaches the end of the list. Then a new re-shuffled list will be created."); ObcResolutionMirror = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Extras Configuration", "ObcResolutionMirror", "1000; 700", "Set the resolution of the Mirror Camera created with OpenBodyCams for darmuhsTerminalStuff"); ObcResolutionBodyCam = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Extras Configuration", "ObcResolutionBodyCam", "1000; 700", "Set the resolution of the Body Camera created with OpenBodyCams for darmuhsTerminalStuff"); MirrorZoom = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Extras Configuration", "MirrorZoom", 3.4f, "Set the mirror zoom level, the higher the value the more zoomed out the mirror will be.\nThis requires [Mirror2DStyle] to be enabled", 0.2f, 9f); Mirror2DStyle = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Extras Configuration", "Mirror2DStyle", false, "Change whether the mirror will use Orthographic (2D) Styling.\n Old versions of this mod had this enabled by default."); KeepMonitoringNodes = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Extras Configuration", "KeepMonitoringNodes", "Fov, Radar Zoom, Door Button, Lightswitch, Always-On Toggle, Use Inverse Teleporter, Use Teleporter, Clear, Danger, Vitals, Heal, Loot, Random Suit, Clock toggle, Previous, SwitchRadarCamPlayer 1, SwitchedCam, switchDummy, EnteredCode, FlashedRadarBooster, SendSignalTranslator, GeneralError, ParserError1, ParserError2, ParserError3, PingedRadarBooster, SendSignalTranslator, FinishedRadarBooster", "Comma-separate listing of TerminalNode names that will NOT hide monitoring. Set to \"everything\" to never hide monitoring"); MonitoringDefaultView = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Extras Configuration", "MonitoringDefaultView", "Map", "Set the default monitoring view to use when using the switch/previous commands and there is no active monitoring view.\nSet to \"None\" to not automatically enable any views when switch/previous commands are used.", new AcceptableValueList(new string[6] { "None", "Map", "Cams", "Minicams", "Minimap", "Overlay" })); OverlayOpacity = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "Extras Configuration", "OverlayOpacity", 10, "Opacity percentage for Overlay View.", 0, 100); CruiserTerminalConfigs(); QoLConfig.Init(); CustomizeConfig.Init(); MoonsPlusConfig.Init(); StorePlusConfig.Init(); Loggers.LogInfo("end of config setup"); ConfigSetup.RemoveOrphanedEntries(((BaseUnityPlugin)Plugin.instance).Config); Loggers.LogDebug("Main config load COMPLETE"); Commands.CommandDefinitions(); } public static void CruiserTerminalConfigs() { CruiserTerminalFilterType = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "CruiserTerminal", "Cruiser Terminal Filter Type", "Deny", "Use this to set whether the Cruiser Keyword List is a list of keywords to permit or deny", new AcceptableValueList(new string[2] { "Deny", "Permit" })); CruiserKeywordList = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "CruiserTerminal", "Cruiser Terminal Keyword List", "mirror, reflection, show mirror, restart, tp, use teleporter, teleport, itp, use inverse, inverse, door, lights, toggle lights, lol, play video, route random, random moon, refresh colors, paintme, customize, scolor, fcolor, lever, link, link2, fov, restart, reset", "Comma-separated listing of keywords to permit OR deny depending on Cruiser Terminal Filter Type"); } } [BepInDependency("darmuh.OpenLib", "0.4.3")] [BepInPlugin("darmuh.TerminalStuff", "darmuhsTerminalStuff", "3.10.1")] public class Plugin : BaseUnityPlugin { public static Plugin instance = null; internal NetworkClass Networker; internal static ManualLogSource Log = null; public bool LobbyCompat; public bool LateGameUpgrades; public bool CruiserTerm; public bool splitViewCreated; internal bool removeTab; internal Terminal Terminal; internal static bool refreshNodes = false; private static List _allnodescached = new List(); public const string Id = "darmuh.TerminalStuff"; public bool FovAdjust => Chainloader.PluginInfos.ContainsKey("Rozebud.FovAdjust"); public bool HelmetCamsMod => Chainloader.PluginInfos.ContainsKey("RickArg.lethalcompany.helmetcameras"); public bool SolosBodyCamsMod => Chainloader.PluginInfos.ContainsKey("SolosBodycams"); public bool OpenBodyCamsMod => Chainloader.PluginInfos.ContainsKey("Zaggy1024.OpenBodyCams"); public bool TwoRadarMapsMod => Chainloader.PluginInfos.ContainsKey("Zaggy1024.TwoRadarMaps"); public bool suitsTerminal => Chainloader.PluginInfos.ContainsKey("darmuh.suitsTerminal"); public bool TerminalFormatter => Chainloader.PluginInfos.ContainsKey("TerminalFormatter"); public bool Constellations => Chainloader.PluginInfos.ContainsKey("com.github.darmuh.LethalConstellations"); public bool ShipInventory => Chainloader.PluginInfos.ContainsKey("ShipInventory"); public bool ITAPI => Chainloader.PluginInfos.ContainsKey("WhiteSpike.InteractiveTerminalAPI"); public bool LethalLevelLoader => Chainloader.PluginInfos.ContainsKey("imabatby.lethallevelloader"); public bool WeatherTweaks => Chainloader.PluginInfos.ContainsKey("WeatherTweaks"); public bool GenImprovements => Chainloader.PluginInfos.ContainsKey("ShaosilGaming.GeneralImprovements"); public bool DawnLibPresent => Chainloader.PluginInfos.ContainsKey("com.github.teamxiaolan.dawnlib"); public bool DawnLLLCombo { get { if (DawnLibPresent) { return LethalLevelLoader; } return false; } } public bool NoLevelLoader { get { if (!DawnLibPresent) { return !LethalLevelLoader; } return false; } } internal static List Allnodes { get { if (_allnodescached.Count == 0) { _allnodescached = LogicHandling.GetAllNodes(); } if (refreshNodes) { _allnodescached = LogicHandling.RefreshAllNodes(); refreshNodes = false; } return _allnodescached; } set { } } public static string Name => "darmuhsTerminalStuff"; public static string Version => "3.10.1"; private void Awake() { instance = this; Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)"darmuhsTerminalStuff is loaded with version 3.10.1!\nUpgrading your terminal!!!"); ConfigSettings.BindConfigSettings(); VideoManager.Load(); Subscribers.Subscribe(); ((BaseUnityPlugin)this).Config.ConfigReloaded += OnConfigReloaded; ((BaseUnityPlugin)this).Config.SettingChanged += OnSettingChanged; Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); Networker = new NetworkClass("darmuhsTerminalStuff NetHandler", ConfigSettings.ModNetworking); } internal void OnSettingChanged(object sender, SettingChangedEventArgs settingChangedArg) { Loggers.LogDebug("CONFIG SETTING CHANGE EVENT"); StuffForLibrary.ConfigSettingChange(); TerminalStart.InitiateTerminalStuff(); if (settingChangedArg.ChangedSetting.Definition.Section == "StorePlus") { StorePlusConfig.UpdateLists(); } _ = settingChangedArg.ChangedSetting; } internal void OnConfigReloaded(object sender, EventArgs e) { Loggers.LogDebug("Config has been reloaded!"); } internal static void PatchLog(string message) { Log.LogInfo((object)message); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "darmuhsTerminalStuff"; public const string PLUGIN_NAME = "darmuhsTerminalStuff"; public const string PLUGIN_VERSION = "3.10.1"; } } namespace TerminalStuff.VisualElements { internal class AlwaysOnStuff { internal static bool delayOff; internal static ScreenSettings screenSettings; internal static void IsPlayerDead() { if (!Bools.StartIsLocalPlayerNull() && StartOfRound.Instance.localPlayerController.isPlayerDead && DisableScreenOnDeath() && ((Component)Plugin.instance.Terminal.terminalUIScreen).gameObject.activeSelf) { ((Component)Plugin.instance.Terminal.terminalUIScreen).gameObject.SetActive(false); } } internal static void OnSpecateShipCheck() { if (!DisableScreenOnDeath() && screenSettings.Dynamic && !Bools.StartIsLocalPlayerNull()) { Loggers.LogDebug($"Spectated Player detected in ship [ {StartOfRound.Instance.localPlayerController.spectatedPlayerScript.isInHangarShipRoom} ]"); if (screenSettings.inUse && !((Component)Plugin.instance.Terminal.terminalUIScreen).gameObject.activeSelf && !((Component)Plugin.instance.Terminal.terminalUIScreen).gameObject.activeSelf && StartOfRound.Instance.localPlayerController.spectatedPlayerScript.isInHangarShipRoom && Plugin.instance.Terminal.placeableObject.inUse) { SetScreenPlus(visible: true); } if (!((Component)Plugin.instance.Terminal.terminalUIScreen).gameObject.activeSelf && StartOfRound.Instance.localPlayerController.spectatedPlayerScript.isInHangarShipRoom) { SetScreenPlus(visible: true); } else if (((Component)Plugin.instance.Terminal.terminalUIScreen).gameObject.activeSelf && !StartOfRound.Instance.localPlayerController.spectatedPlayerScript.isInHangarShipRoom) { SetScreenPlus(visible: false); } } } internal static void SetScreenPlus(bool visible) { ((Component)Plugin.instance.Terminal.terminalUIScreen).gameObject.SetActive(visible); if (!StartOfRound.Instance.inShipPhase && !TerminalEvents.clockDisabledByCommand) { TerminalClockStuff.SetClockVisible(visible); } else { TerminalClockStuff.SetClockVisible(visible: false); } if ((ViewCommands.AnyActiveMonitoring() && Plugin.instance.splitViewCreated) || ViewCommands.CurrentView == ViewCommands.ViewMode.Mirror) { Loggers.LogInfo("Adjusting camera views to screen status"); SplitViewChecks.ShowCameraView(visible); } } internal static void PlayerShipChanged() { if (Bools.StartIsLocalPlayerNull() || screenSettings == null) { return; } Loggers.LogDebug($"Player detected in ship change - {StartOfRound.Instance.localPlayerController.isInHangarShipRoom}"); if (StartOfRound.Instance.localPlayerController.isPlayerDead && DisableScreenOnDeath() && ((Component)Plugin.instance.Terminal.terminalUIScreen).gameObject.activeSelf) { SetScreenPlus(visible: false); } if (StartOfRound.Instance.localPlayerController.isInHangarShipRoom) { if (screenSettings.Dynamic && !screenSettings.inUse) { if (!((Component)Plugin.instance.Terminal.terminalUIScreen).gameObject.activeSelf) { SetScreenPlus(visible: true); } } else if (screenSettings.inUse && TerminalUpdatePatch.inUse && !((Component)Plugin.instance.Terminal.terminalUIScreen).gameObject.activeSelf) { SetScreenPlus(visible: true); } } else { if (!screenSettings.Dynamic) { return; } Loggers.LogDebug($"disabling screen - screenSetting Dynamic {screenSettings.Dynamic}"); if (((Component)Plugin.instance.Terminal.terminalUIScreen).gameObject.activeSelf) { if (QoLConfig.ScreenOffDelay.Value < 1) { SetScreenPlus(visible: false); } else { ((MonoBehaviour)Plugin.instance).StartCoroutine(DelayScreenOff(QoLConfig.ScreenOffDelay.Value)); } } } } internal static IEnumerator DelayScreenOff(int delay) { if (delayOff) { yield break; } delayOff = true; yield return (object)new WaitForSeconds((float)delay); if (!Bools.StartIsLocalPlayerNull()) { if (!StartOfRound.Instance.localPlayerController.isInHangarShipRoom) { SetScreenPlus(visible: false); } delayOff = false; } } internal static bool DisableScreenOnDeath() { if (QoLConfig.ScreenOnWhileDead.Value || Bools.StartIsLocalPlayerNull()) { return false; } return StartOfRound.Instance.localPlayerController.isPlayerDead; } } internal class ScreenSettings { internal bool AlwaysOn; internal bool Dynamic; internal bool inUse; internal void Update(string setting) { if (Misc.CompareStringsInvariant(setting, "alwayson", true)) { AlwaysOn = true; Dynamic = false; inUse = false; } else if (Misc.CompareStringsInvariant(setting, "inship", true)) { AlwaysOn = true; Dynamic = true; inUse = false; } else if (Misc.CompareStringsInvariant(setting, "inuse", true)) { AlwaysOn = true; Dynamic = true; inUse = true; } else { AlwaysOn = false; Dynamic = false; inUse = false; } Loggers.LogDebug("ScreenSettings set to: " + setting); } internal ScreenSettings(string setting) { Update(setting); } } public class CamEvents { internal static CamsClass CamsThings = new CamsClass(); public static CustomEvent UpdateCamsEvent = new CustomEvent(); public static CustomEvent UpdateTarget = new CustomEvent(); internal static RawImage MiniScreenImage = null; private static GameObject? _playerMonitorCam; internal static GameObject CameraHolder { get { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown if ((Object)(object)_playerMonitorCam == (Object)null) { _playerMonitorCam = new GameObject("darmuhsTerminalStuff - PlayerCam Holder"); } return _playerMonitorCam; } set { _playerMonitorCam = value; } } internal static void SetTextures(Texture texture, Texture mini = null) { Plugin.instance.Terminal.terminalImage.texture = texture; if ((Object)(object)mini != (Object)null) { MiniScreenImage.texture = mini; } } internal static void UpdateStyle(Texture main, float mainOpacity, Texture mini = null, float miniOpacity = 0f, bool isOverlay = false) { if ((Object)(object)mini == (Object)null) { SetTextures(main); SetRawImageTransparency(Plugin.instance.Terminal.terminalImage, mainOpacity); SetRawImageDimensions(((Graphic)Plugin.instance.Terminal.terminalImage).rectTransform, isFullScreen: true); SetMiniScreenImageEnabled(enabled: false); } else { SetMiniScreenImageEnabled(enabled: true); SetTextures(main, mini); SetRawImageTransparency(Plugin.instance.Terminal.terminalImage, mainOpacity); SetRawImageTransparency(MiniScreenImage, miniOpacity); SetRawImageDimensions(((Graphic)MiniScreenImage).rectTransform, isOverlay); SetRawImageDimensions(((Graphic)Plugin.instance.Terminal.terminalImage).rectTransform, isFullScreen: true); } } internal static void StyleNone() { Plugin.instance.Terminal.displayingPersistentImage = null; SetTextures(null); SetMiniScreenImageEnabled(enabled: false); MoreCamStuff.ToggleCameraState(enabled: false); } private static void SetMiniScreenImageEnabled(bool enabled) { if (!((Object)(object)MiniScreenImage == (Object)null)) { ((Behaviour)MiniScreenImage).enabled = enabled; } } internal static void OnUpdateCamsEvent(ViewCommands.ViewMode mode) { Loggers.LogDebug("UpdateCams Event!"); switch (mode) { case ViewCommands.ViewMode.None: StyleNone(); break; case ViewCommands.ViewMode.Map: MoreCamStuff.ToggleCameraState(enabled: false); CamsThings.radarTexture = (Texture)(object)UpdateRadarTexture(); UpdateStyle(CamsThings.radarTexture, 1f); break; case ViewCommands.ViewMode.Camera: CamsThings.camsTexture = UpdateCamsTexture(); UpdateStyle(CamsThings.camsTexture, 1f); break; case ViewCommands.ViewMode.MiniCams: CamsThings.radarTexture = (Texture)(object)UpdateRadarTexture(); CamsThings.camsTexture = UpdateCamsTexture(); UpdateStyle(CamsThings.radarTexture, 1f, CamsThings.camsTexture, 0.7f); break; case ViewCommands.ViewMode.MiniMap: CamsThings.radarTexture = (Texture)(object)UpdateRadarTexture(); CamsThings.camsTexture = UpdateCamsTexture(); UpdateStyle(CamsThings.camsTexture, 1f, CamsThings.radarTexture, 0.7f); break; case ViewCommands.ViewMode.Overlay: CamsThings.radarTexture = (Texture)(object)UpdateRadarTexture(); CamsThings.camsTexture = UpdateCamsTexture(); UpdateStyle(CamsThings.radarTexture, 1f, CamsThings.camsTexture, (float)ConfigSettings.OverlayOpacity.Value / 100f, isOverlay: true); break; case ViewCommands.ViewMode.Mirror: UpdateStyle(GetMirrorTexture(), 1f); break; default: MoreCamStuff.ToggleCameraState(enabled: false); SetMiniScreenImageEnabled(enabled: false); break; } Loggers.LogMessage($"Mode set to - [ {mode} ] OnUpdateCamsEvent"); ViewCommands.CurrentView = mode; } private static RenderTexture UpdateRadarTexture() { return GameStuff.TerminalMapRenderer.cam.targetTexture; } private static Texture UpdateCamsTexture() { Loggers.LogDebug("Updating Cams"); if (MoreCamStuff.IsExternalCamsPresent()) { return MoreCamStuff.GetPlayerCamsFromExternalMod(GameStuff.TerminalMapRenderer.targetTransformIndex); } return MoreCamStuff.UpdateCamsTarget(GameStuff.TerminalMapRenderer.targetTransformIndex); } private static void SetRawImageTransparency(RawImage rawImage, float Opacity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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) //IL_000f: 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_0022: Unknown result type (might be due to invalid IL or missing references) Color color = ((Graphic)rawImage).color; Color color2 = default(Color); ((Color)(ref color2))..ctor(color.r, color.g, color.b, Opacity); ((Graphic)rawImage).color = color2; } internal static void SetRawImageDimensions(RectTransform rectTrans, bool isFullScreen) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (isFullScreen) { rectTrans.sizeDelta = new Vector2(425f, 280f); rectTrans.anchoredPosition = new Vector2(0f, -25f); } else { rectTrans.sizeDelta = new Vector2(180f, 100f); rectTrans.anchoredPosition = new Vector2(123f, 90f); } } internal static Texture GetMirrorTexture() { if (Plugin.instance.OpenBodyCamsMod && ConfigSettings.CamsUseDetectedMods.Value) { Loggers.LogDebug("Sending to OBC for camera info"); OpenBodyCamFuncs.OpenBodyCamsMirrorStatus(true, ConfigSettings.ObcResolutionMirror.Value, ConfigSettings.MirrorZoom.Value, ConfigSettings.Mirror2DStyle.Value, ref CamStuff.ObcCameraHolder); return OpenBodyCamFuncs.GetTexture(OpenBodyCamFuncs.TerminalMirrorCam); } return (Texture)(object)HomebrewMirror(); } private static RenderTexture HomebrewMirror() { if ((Object)(object)ViewCommands.playerCam == (Object)null) { Loggers.LogInfo("Creating home-brew PlayerCam"); GameObject cameraHolder = CameraHolder; ViewCommands.playerCam = CamStuff.HomebrewCam(ref ViewCommands.mycamTexture, ref cameraHolder); CameraHolder = cameraHolder; } CamStuff.HomebrewCameraState(true, ViewCommands.playerCam); CamStuff.CamInitMirror(CameraHolder, ViewCommands.playerCam, ConfigSettings.MirrorZoom.Value, ConfigSettings.Mirror2DStyle.Value); return ViewCommands.playerCam.targetTexture; } internal static void SetMirrorState(bool active) { if (Plugin.instance.OpenBodyCamsMod && ConfigSettings.CamsUseDetectedMods.Value) { OpenBodyCamFuncs.OpenBodyCamsMirrorStatus(active, ConfigSettings.ObcResolutionMirror.Value, ConfigSettings.MirrorZoom.Value, ConfigSettings.Mirror2DStyle.Value, ref CamStuff.ObcCameraHolder); } else { CamStuff.HomebrewCameraState(active, ViewCommands.playerCam); } } } public class CamsClass { public Texture radarTexture; public Texture camsTexture; } internal class CustomAutoSize : MonoBehaviour { internal RectTransform rect; internal TextMeshProUGUI textMesh; internal int cachedLength; internal float cachedFontSize; internal float fontSizeMultiplier = 1f; internal bool initialized; internal void SetValues(RectTransform rTrans, ref TextMeshProUGUI textComp, Vector2 anchor, Vector3 size) { //IL_0015: 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_0023: Unknown result type (might be due to invalid IL or missing references) rect = rTrans; textMesh = textComp; rect.anchoredPosition = anchor; rect.sizeDelta = Vector2.op_Implicit(size); ((Transform)((TMP_Text)textComp).rectTransform).SetParent((Transform)(object)rect); Init(); } internal void Init() { //IL_002c: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) Loggers.LogDebug("Init CustomAutoSize!"); if (!((Object)(object)textMesh == (Object)null) && !initialized) { ((TMP_Text)textMesh).rectTransform.anchoredPosition = Vector2.zero; ((TMP_Text)textMesh).rectTransform.anchorMin = Vector2.zero; ((TMP_Text)textMesh).rectTransform.anchorMax = Vector2.one; ((TMP_Text)textMesh).rectTransform.sizeDelta = Vector2.zero; ((TMP_Text)textMesh).margin = new Vector4(-3f, 0f, 1f, 0f); ((TMP_Text)textMesh).enableAutoSizing = true; initialized = true; } } internal void Update() { //IL_00d0: 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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)textMesh == (Object)null) && ((TMP_Text)textMesh).text != null && initialized && !((Object)(object)rect == (Object)null) && cachedLength != ((TMP_Text)textMesh).text.Length) { Loggers.LogDebug("Updating rectTransform y value!"); if (cachedFontSize != ((TMP_Text)textMesh).fontSize) { fontSizeMultiplier = ((TMP_Text)textMesh).fontSize / 18f; cachedFontSize = ((TMP_Text)textMesh).fontSize; } int num = Mathf.Clamp(((TMP_Text)textMesh).text.Length - 2, 0, 9); int num2 = 10 * num; int num3 = 200 - 5 * num; num3 *= -1; rect.sizeDelta = new Vector2((float)(32 + num2), rect.sizeDelta.y); rect.anchoredPosition = new Vector2((float)num3, rect.anchoredPosition.y); cachedLength = ((TMP_Text)textMesh).text.Length; } } } internal class MoreCamStuff { internal static List DontHideMonitoringNodes { get { List keywordsPerConfigItem = CommonStringStuff.GetKeywordsPerConfigItem(ConfigSettings.KeepMonitoringNodes.Value, ','); foreach (CommandManager specialCommand in Commands.GetSpecialCommands()) { keywordsPerConfigItem.Add(specialCommand.Name); } return keywordsPerConfigItem; } } internal static void CheckVisualPersistance(string nodeName) { VideoPersist(nodeName); CamPersistance(nodeName); } private static void VideoPersist(string nodeName) { if (ViewCommands.isVideoPlaying && nodeName != "darmuh's videoPlayer") { AllMyTerminalPatches.FixVideoPatch.OnVideoEnd(); ViewCommands.isVideoPlaying = false; Loggers.LogInfo("disabling video"); } } private static void CamPersistance(string nodeName) { if (ViewCommands.CurrentView != ViewCommands.ViewMode.Vanilla && (ViewCommands.CurrentView != ViewCommands.ViewMode.None || !(nodeName == "ViewInsideShipCam 1")) && !Misc.DoesListHaveInvariant(DontHideMonitoringNodes, nodeName, true) && CanHideCams()) { CamEvents.UpdateCamsEvent.Invoke(ViewCommands.ViewMode.None); Loggers.LogInfo("disabling ANY cams views"); } } internal static bool IsViewNode(TerminalNode node) { List specialCommands = Commands.GetSpecialCommands(); if (specialCommands.Count == 0) { return false; } foreach (CommandManager item in specialCommands) { if ((Object)(object)item.terminalNode == (Object)(object)node) { return true; } } Loggers.LogDebug("this node is not a view node, resetting instance variables"); return false; } internal static bool CanHideCams() { return !string.IsNullOrEmpty(ConfigSettings.KeepMonitoringNodes.Value); } internal static Texture GetPlayerCamsFromExternalMod(int newTarget) { if (Plugin.instance.OpenBodyCamsMod) { Loggers.LogDebug("Sending to OBC for camera info"); OpenBodyCamFuncs.UpdateCamsTarget(ConfigSettings.ObcResolutionBodyCam.Value); return OpenBodyCamFuncs.GetTexture(OpenBodyCamFuncs.TerminalBodyCam); } if (Plugin.instance.SolosBodyCamsMod || Plugin.instance.HelmetCamsMod) { Loggers.LogDebug("Grabbing monitor texture for other external bodycams mods"); return PlayerCamsCompatibility.PlayerCamTexture(); } Loggers.LogDebug("No external mods detected, defaulting to internal cams system."); return UpdateCamsTarget(newTarget); } internal static bool IsExternalCamsPresent() { if (ConfigSettings.CamsUseDetectedMods.Value && (Plugin.instance.HelmetCamsMod || Plugin.instance.SolosBodyCamsMod || Plugin.instance.OpenBodyCamsMod)) { return true; } return false; } internal static Texture UpdateCamsTarget(int targetNum) { if (ConfigSettings.CamsUseDetectedMods.Value && (Plugin.instance.HelmetCamsMod || Plugin.instance.OpenBodyCamsMod || Plugin.instance.SolosBodyCamsMod)) { return PlayerCamsCompatibility.PlayerCamTexture(); } if (!GameStuff.TerminalMapRenderer.radarTargets[targetNum].isNonPlayer) { Loggers.LogDebug($"Using internal mod camera on valid player - {targetNum}"); return (Texture)(object)PlayerCamTexture(targetNum); } Loggers.LogDebug("Using internal mod camera on valid non-player"); return (Texture)(object)RadarCamTexture(targetNum); } private static RenderTexture PlayerCamTexture(int targetPlayer) { //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ViewCommands.playerCam == (Object)null) { GameObject cameraHolder = CamEvents.CameraHolder; Loggers.LogInfo("Creating home-brew PlayerCam"); ViewCommands.playerCam = CamStuff.HomebrewCam(ref ViewCommands.mycamTexture, ref cameraHolder); CamEvents.CameraHolder = cameraHolder; } ViewCommands.playerCam.orthographic = false; ToggleCameraState(enabled: true); ViewCommands.playerCam.cameraType = (CameraType)1; PlayerControllerB component = ((Component)GameStuff.TerminalMapRenderer.radarTargets[targetPlayer].transform).gameObject.GetComponent(); Transform transform; if ((Object)(object)component != (Object)null) { transform = ((Component)component.gameplayCamera).transform; Loggers.LogInfo("Valid player for cams update " + component.playerUsername); } else { transform = GameStuff.TerminalMapRenderer.radarTargets[targetPlayer].transform; Loggers.LogInfo($"Invalid player{targetPlayer} for cams update, sending to backup trasnsform"); } ((Component)ViewCommands.playerCam).transform.rotation = transform.rotation; ((Component)ViewCommands.playerCam).transform.position = ((Component)transform).transform.position; ViewCommands.playerCam.farClipPlane = 25f; ViewCommands.playerCam.nearClipPlane = 0.5f; ViewCommands.playerCam.fieldOfView = 90f; ((Component)ViewCommands.playerCam).transform.SetParent(((Component)transform).transform); return ViewCommands.playerCam.targetTexture; } private static RenderTexture RadarCamTexture(int targetNum) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ViewCommands.playerCam == (Object)null) { GameObject cameraHolder = CamEvents.CameraHolder; Loggers.LogInfo("Creating home-brew PlayerCam"); ViewCommands.playerCam = CamStuff.HomebrewCam(ref ViewCommands.mycamTexture, ref cameraHolder); } ViewCommands.playerCam.orthographic = false; ToggleCameraState(enabled: true); ViewCommands.playerCam.cameraType = (CameraType)2; Transform transform = GameStuff.TerminalMapRenderer.radarTargets[targetNum].transform; ((Component)ViewCommands.playerCam).transform.rotation = transform.rotation; ((Component)ViewCommands.playerCam).transform.position = ((Component)transform).transform.position; ViewCommands.playerCam.farClipPlane = 50f; ViewCommands.playerCam.nearClipPlane = 0.4f; ViewCommands.playerCam.fieldOfView = 110f; ((Component)ViewCommands.playerCam).transform.SetParent(((Component)transform).transform); return ViewCommands.playerCam.targetTexture; } internal static int GetNextValidTarget(List targets, int initialIndex) { int count = targets.Count; for (int i = 1; i < count; i++) { int num = (initialIndex + i) % count; if (TargetIsValid(targets[num])) { return num; } } return initialIndex; } internal static int GetPrevValidTarget(List targets, int initialIndex) { int count = targets.Count; int num = initialIndex; Loggers.LogDebug($"Count: {targets.Count}"); Loggers.LogDebug($"initialIndex: {initialIndex}"); if (initialIndex == 0) { num = count; Loggers.LogDebug($"initialIndex is 0, setting nextTarget to {num}"); } for (int i = 1; i < count; i++) { int num2 = (num - i) % count; Loggers.LogDebug($"{num2} = {num} - {i} % {count}"); Loggers.LogDebug($"{num2} + {count} % {count}"); num2 = (num2 + count) % count; Loggers.LogDebug($"= {num2}"); if (TargetIsValid(targets[num2])) { return num2; } } return initialIndex; } internal static bool TargetIsValid(TransformAndName target) { if (target == null) { return false; } Transform transform = target.transform; if ((Object)(object)transform == (Object)null) { Loggers.LogInfo("not a valid target"); return false; } PlayerControllerB component = ((Component)((Component)transform).transform).GetComponent(); if ((Object)(object)component == (Object)null) { Loggers.LogInfo("Null player component, must be radar (returning true)"); return true; } if (!component.isPlayerControlled && !component.isPlayerDead) { Loggers.LogInfo($"player is not player controlled and is not dead, redirect to enemy: {(Object)(object)component.redirectToEnemy != (Object)null}"); return (Object)(object)component.redirectToEnemy != (Object)null; } Loggers.LogInfo("TargetIsValid, no specific conditions met"); return true; } internal static void OnTargetSwitch(int newTarget) { Loggers.LogDebug("Target Switch Event!"); if (ViewCommands.AnyActiveMonitoring() && newTarget <= GameStuff.TerminalMapRenderer.radarTargets.Count) { if (!IsExternalCamsPresent()) { Loggers.LogInfo("Updating homebrew target"); UpdateCamsTarget(newTarget); } else if (Plugin.instance.OpenBodyCamsMod && !OpenBodyCamFuncs.ShowingBodyCam) { Loggers.LogInfo("OBC Terminal Body Cam is NOT active"); } else { GetPlayerCamsFromExternalMod(newTarget); } } } internal static void ToggleCameraState(bool enabled) { if (!ConfigSettings.CamsUseDetectedMods.Value || (!Plugin.instance.HelmetCamsMod && !Plugin.instance.OpenBodyCamsMod && !Plugin.instance.SolosBodyCamsMod)) { CamEvents.CameraHolder.SetActive(enabled); CamStuff.HomebrewCameraState(enabled, ViewCommands.playerCam); } } } internal class SplitViewChecks { internal static bool replacedViewMon = false; internal static CommandManager viewMon = new CommandManager("View Monitor Not Available", new List(1) { "view monitor" }, (Func)ViewCommands.NoVanillaView, (ConfigEntry)null, 0, true) { AddAtAwake = false }; private static void HandleVanillaMap(bool shouldRemove) { if (shouldRemove) { ReplaceViewMonitor(); } } private static void ReplaceViewMonitor() { if (!DynamicBools.TryGetKeyword("view monitor")) { viewMon.RegisterCommand(); Loggers.LogDebug("Added view monitor warning"); } else { Loggers.LogDebug("keyword already exists!"); } } public static void InitSplitViewObjects() { if (!Bools.ShouldAddCamsLogic()) { HandleVanillaMap(shouldRemove: false); return; } if (Plugin.instance.OpenBodyCamsMod && OpenBodyCamsCompatibility.IsCreatingCommands()) { Loggers.LogInfo("Not replacing 'view monitor' command, as OpenBodyCams is creating terminal commands"); return; } HandleVanillaMap(shouldRemove: true); if ((Object)(object)Plugin.instance.Terminal.terminalImage == (Object)null || Plugin.instance.splitViewCreated) { Loggers.LogInfo("Original terminalImage not found or split view already created"); return; } CamEvents.MiniScreenImage = Object.Instantiate(Plugin.instance.Terminal.terminalImage, ((Component)Plugin.instance.Terminal.terminalImage).transform); if ((Object)(object)((Component)CamEvents.MiniScreenImage).gameObject.GetComponent() != (Object)null) { VideoPlayer component = ((Component)CamEvents.MiniScreenImage).GetComponent(); Object.Destroy((Object)(object)component); Loggers.LogDebug("extraPlayer deleted"); } ((Object)((Component)CamEvents.MiniScreenImage).gameObject).name = "MiniScreen"; ((Object)((Component)Plugin.instance.Terminal.terminalImage).gameObject).name = "terminalImage"; Plugin.instance.splitViewCreated = true; } internal static void DisableVanillaViewMonitor(bool disableImage = true) { Loggers.LogDebug("disabling vanilla view monitor"); Plugin.instance.Terminal.displayingPersistentImage = null; ((Behaviour)Plugin.instance.Terminal.terminalImage).enabled = !disableImage; } internal static void ShowCameraView(bool state) { if (ConfigSettings.CamsUseDetectedMods.Value && Plugin.instance.OpenBodyCamsMod) { TerminalQuit.OBCTerminalCameraStatus(state); } else { CamStuff.HomebrewCameraState(state, ViewCommands.playerCam); } } } internal class TerminalCustomizer { internal static bool defaultsCached; internal static Image terminalBackground; internal static Image moneyBG; private static void SetTerminalBodyColors() { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) if (!CustomizeConfig.TerminalCustomization.Value) { return; } MeshRenderer component = GameObject.Find("Environment/HangarShip/Terminal").GetComponent(); if ((Object)(object)component != (Object)null) { if (((Renderer)component).materials.Length <= 3) { ((Renderer)component).materials[0].color = ColorCommands.HexToColor(CustomizeConfig.TerminalColor.Value); ((Renderer)component).materials[1].color = ColorCommands.HexToColor(CustomizeConfig.TerminalButtonsColor.Value); } else { Loggers.WARNING("termMesh does not have expected number of materials, only setting terminal body color"); ((Renderer)component).material.color = ColorCommands.HexToColor(CustomizeConfig.TerminalColor.Value); } } else { Loggers.WARNING("customization failure: termMesh is null"); } } private static void GetTerminalBodyColors() { //IL_0084: 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) //IL_008e: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) if (!CustomizeConfig.TerminalCustomization.Value) { return; } MeshRenderer component = GameObject.Find("Environment/HangarShip/Terminal").GetComponent(); if ((Object)(object)component != (Object)null) { if (((Renderer)component).materials.Length <= 3) { CustomTerminalStuff.TerminalBody = ((Renderer)component).materials[0].color; AnnounceColor(CustomTerminalStuff.TerminalBody, "CustomTerminalStuff.TerminalBody"); CustomTerminalStuff.TerminalButtonsColor = ((Renderer)component).materials[1].color; AnnounceColor(CustomTerminalStuff.TerminalButtonsColor, "CustomTerminalStuff.TerminalButtonsColor"); } else { Loggers.WARNING("termMesh does not have expected number of materials, only setting terminal body color"); CustomTerminalStuff.TerminalBody = ((Renderer)component).material.color; AnnounceColor(CustomTerminalStuff.TerminalBody, "CustomTerminalStuff.TerminalBody"); } } else { Loggers.WARNING("customization failure: termMesh is null\nFailed to get TerminalBody & TerminalButtonsColor"); } } private static void SetTerminalKeyboardColors() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (CustomizeConfig.TerminalCustomization.Value) { MeshRenderer component = GameObject.Find("Environment/HangarShip/Terminal/Terminal.003").GetComponent(); if ((Object)(object)component != (Object)null) { ((Renderer)component).material.color = ColorCommands.HexToColor(CustomizeConfig.TerminalKeyboardColor.Value); } else { Loggers.WARNING("customization failure: kbMesh is null"); } } } private static void GetTerminalKeyboardColors() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (CustomizeConfig.TerminalCustomization.Value) { MeshRenderer component = GameObject.Find("Environment/HangarShip/Terminal/Terminal.003").GetComponent(); if ((Object)(object)component != (Object)null) { CustomTerminalStuff.TerminalKeyboard = ((Renderer)component).material.color; AnnounceColor(CustomTerminalStuff.TerminalKeyboard, "CustomTerminalStuff.TerminalKeyboard"); } else { Loggers.WARNING("customization failure: kbMesh is null\nFailed to get TerminalKeyboard color"); } } } internal static void StartNode() { Loggers.LogDebug("Updating home displaytext"); TerminalStart.startNode = Plugin.instance.Terminal.terminalNodes.specialNodes.ToArray()[1]; TerminalStart.startNode.displayText = CustomizeConfig.HomeLine1.Value + "\n" + CustomizeConfig.HomeLine2.Value + "\n" + CustomizeConfig.HomeHelpLines.Value + "\n" + CustomizeConfig.HomeTextArt.Value + "\n" + CustomizeConfig.HomeLine3.Value + "\n\n"; } private static void AutoResizeMoneyBG() { //IL_0053: 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_006c: Unknown result type (might be due to invalid IL or missing references) if (CustomizeConfig.AutoResizeMoneyBG.Value && !((Object)(object)moneyBG == (Object)null)) { CustomAutoSize customAutoSize = ((Component)moneyBG).gameObject.AddComponent(); customAutoSize.SetValues(((Graphic)moneyBG).rectTransform, ref Plugin.instance.Terminal.topRightText, new Vector2(-195f, ((Graphic)moneyBG).rectTransform.anchoredPosition.y), new Vector3(34f, 22f)); } } private static void SetMoneyBGStuff(Color moneyBGColor) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) ((Graphic)moneyBG).color = moneyBGColor; AutoResizeMoneyBG(); } private static void GetMoneyBG(Color moneyBGColor) { //IL_0092: Unknown result type (might be due to invalid IL or missing references) if (((Component)Plugin.instance.Terminal.terminalUIScreen).gameObject.transform.GetChild(0).childCount >= 6) { if ((Object)(object)((Component)((Component)Plugin.instance.Terminal.terminalUIScreen).gameObject.transform.GetChild(0).GetChild(5)).gameObject.GetComponent() != (Object)null) { moneyBG = ((Component)((Component)Plugin.instance.Terminal.terminalUIScreen).gameObject.transform.GetChild(0).GetChild(5)).gameObject.GetComponent(); SetMoneyBGStuff(moneyBGColor); } } else { Loggers.WARNING("Unable to set TerminalMoneyBG customizations!!"); } } internal static void TerminalCustomization() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) StartNode(); if (CustomizeConfig.TerminalCustomization.Value) { if (!defaultsCached) { CacheDefaults(); } SetTerminalBodyColors(); SetTerminalKeyboardColors(); FontStuff.GetAndSetFont(); Color val = SetColorFor(CustomizeConfig.TerminalMoneyBGColor.Value, CustomTerminalStuff.MoneyBG, CustomizeConfig.TerminalMoneyBGAlpha.Value); if ((Object)(object)moneyBG != (Object)null) { SetMoneyBGStuff(val); } else { GetMoneyBG(val); } ((Graphic)Plugin.instance.Terminal.screenText.textComponent).color = SetColorFor(CustomizeConfig.TerminalTextColor.Value, CustomTerminalStuff.TerminalText); ((Graphic)Plugin.instance.Terminal.topRightText).color = SetColorFor(CustomizeConfig.TerminalMoneyColor.Value, CustomTerminalStuff.MoneyText); Plugin.instance.Terminal.screenText.caretColor = SetColorFor(CustomizeConfig.TerminalCaretColor.Value, CustomTerminalStuff.TextCaret); if (Plugin.instance.suitsTerminal) { SuitsTerminalCompatibility.SetCaretColor(Plugin.instance.Terminal.screenText.caretColor); } ((Graphic)((Selectable)Plugin.instance.Terminal.scrollBarVertical).image).color = SetColorFor(CustomizeConfig.TerminalScrollbarColor.Value, CustomTerminalStuff.Scrollbar); ((Graphic)((Component)Plugin.instance.Terminal.scrollBarVertical).gameObject.GetComponent()).color = SetColorFor(CustomizeConfig.TerminalScrollBGColor.Value, CustomTerminalStuff.ScrollbarBackground); Plugin.instance.Terminal.terminalLight.color = SetColorFor(CustomizeConfig.TerminalLightColor.Value, CustomTerminalStuff.TerminalLight); if ((Object)(object)TerminalClockStuff.textComponent != (Object)null) { Loggers.LogInfo("setting clock color"); ((Graphic)TerminalClockStuff.textComponent).color = SetColorFor(CustomizeConfig.TerminalClockColor.Value, CustomTerminalStuff.TerminalClock); } terminalBackground = ((Component)Plugin.instance.Terminal.terminalUIScreen).gameObject.GetComponentInChildren(); if ((Object)(object)terminalBackground != (Object)null) { ((Behaviour)terminalBackground).enabled = CustomizeConfig.TerminalCustomBG.Value; ((Component)terminalBackground).transform.SetParent(((Component)Plugin.instance.Terminal.terminalImage).transform); ((Component)terminalBackground).transform.SetAsLastSibling(); ((Graphic)terminalBackground).rectTransform.anchoredPosition = new Vector2(10f, 0f); ((Graphic)terminalBackground).rectTransform.sizeDelta = new Vector2(-80f, 20f); Color color = SetColorFor(CustomizeConfig.TerminalCustomBGColor.Value, CustomTerminalStuff.TerminalBackground, CustomizeConfig.TerminalCustomBGAlpha.Value); ((Graphic)terminalBackground).color = color; } else { Loggers.LogDebug("terminalBackground is NULL"); } } } internal static Color SetColorFor(string config, Color cachedColor) { //IL_0021: 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) if (config.Length < 1 || Misc.CompareStringsInvariant(config, "default", true)) { Loggers.LogDebug("setting to cached default value"); return cachedColor; } Loggers.LogDebug("getting color from " + config); return ColorCommands.HexToColor(config); } private static Color SetColorFor(string config, Color cachedColor, float newAlpha) { //IL_0021: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (config.Length < 1 || Misc.CompareStringsInvariant(config, "default", true)) { Loggers.LogDebug("setting to cached default value"); return cachedColor; } Loggers.LogDebug("getting color from config item"); Color result = ColorCommands.HexToColor(config); result.a = newAlpha; return result; } internal static void GetOtherDefaultColors() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_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_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) if (CustomizeConfig.TerminalCustomization.Value) { CustomTerminalStuff.TerminalText = ((Graphic)Plugin.instance.Terminal.screenText.textComponent).color; AnnounceColor(CustomTerminalStuff.TerminalText, "CustomTerminalStuff.TerminalText"); CustomTerminalStuff.MoneyText = ((Graphic)Plugin.instance.Terminal.topRightText).color; AnnounceColor(CustomTerminalStuff.MoneyText, "CustomTerminalStuff.MoneyText"); if ((Object)(object)((Component)((Component)Plugin.instance.Terminal.terminalUIScreen).gameObject.transform.GetChild(0).GetChild(5)).gameObject.GetComponent() != (Object)null) { CustomTerminalStuff.MoneyBG = ((Graphic)((Component)((Component)Plugin.instance.Terminal.terminalUIScreen).gameObject.transform.GetChild(0).GetChild(5)).gameObject.GetComponent()).color; AnnounceColor(CustomTerminalStuff.MoneyBG, "CustomTerminalStuff.MoneyBG"); } CustomTerminalStuff.TextCaret = Plugin.instance.Terminal.screenText.caretColor; CustomTerminalStuff.Scrollbar = ((Graphic)((Selectable)Plugin.instance.Terminal.scrollBarVertical).image).color; if ((Object)(object)((Component)Plugin.instance.Terminal.scrollBarVertical).gameObject.GetComponent() != (Object)null) { CustomTerminalStuff.ScrollbarBackground = ((Graphic)((Component)Plugin.instance.Terminal.scrollBarVertical).gameObject.GetComponent()).color; } else { Loggers.WARNING("Unable to get scrollbar background color cached default!"); } CustomTerminalStuff.TerminalLight = Plugin.instance.Terminal.terminalLight.color; AnnounceColor(CustomTerminalStuff.TextCaret, "CustomTerminalStuff.TextCaret"); AnnounceColor(CustomTerminalStuff.Scrollbar, "CustomTerminalStuff.Scrollbar"); AnnounceColor(CustomTerminalStuff.ScrollbarBackground, "CustomTerminalStuff.ScrollbarBackground"); AnnounceColor(CustomTerminalStuff.TerminalLight, "CustomTerminalStuff.TerminalLight"); if ((Object)(object)TerminalClockStuff.textComponent != (Object)null) { CustomTerminalStuff.TerminalClock = ((Graphic)TerminalClockStuff.textComponent).color; AnnounceColor(CustomTerminalStuff.TerminalClock, "CustomTerminalStuff.TerminalClock"); } terminalBackground = ((Component)Plugin.instance.Terminal.terminalUIScreen).gameObject.GetComponentInChildren(); if ((Object)(object)terminalBackground != (Object)null) { CustomTerminalStuff.TerminalBackground = ((Graphic)terminalBackground).color; AnnounceColor(CustomTerminalStuff.TerminalBackground, "CustomTerminalStuff.TerminalBackground"); } else { Loggers.LogDebug("terminalBackground is NULL"); } } } internal static void CacheDefaults() { if (!defaultsCached) { GetTerminalBodyColors(); GetTerminalKeyboardColors(); GetOtherDefaultColors(); defaultsCached = true; } } internal static void AnnounceColor(Color colorValue, string name) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) string text = ColorUtility.ToHtmlStringRGB(colorValue); Loggers.LogDebug(name + " cached color: " + text); } } internal class CustomTerminalStuff { internal static Color TerminalBody; internal static Color TerminalButtonsColor; internal static Color TerminalKeyboard; internal static Color TerminalText; internal static Color TerminalBackground; internal static Color MoneyBG; internal static Color MoneyText; internal static Color TextCaret; internal static Color Scrollbar; internal static Color ScrollbarBackground; internal static Color TerminalLight; internal static Color TerminalClock; } internal static class VideoManager { public static List Videos = new List(); private static int lastPlayedIndex = -1; internal static string currentlyPlaying = string.Empty; internal static TerminalNode videoPlayerNode = null; internal static bool uniqueShuffled = false; public static void Load() { string[] directories = Directory.GetDirectories(Paths.PluginPath); foreach (string text in directories) { string path = Path.Combine(Paths.PluginPath, text, ConfigSettings.VideoFolderPath.Value ?? ""); if (Directory.Exists(path)) { string[] files = Directory.GetFiles(path, "*.mp4"); Videos.AddRange(files); Plugin.Log.LogInfo((object)$"{text} has {files.Length} videos."); return; } if (Misc.StringContainsInvariant(text, ConfigSettings.VideoFolderPath.Value.ToLower(), true)) { string path2 = Path.Combine(Paths.PluginPath, text); string[] files2 = Directory.GetFiles(path2, "*.mp4"); Videos.AddRange(files2); Plugin.Log.LogInfo((object)$"{text} has {files2.Length} videos."); return; } } Loggers.WARNING("Unable to load video files from path configuration: " + ConfigSettings.VideoFolderPath.Value); } internal static void PlaySyncedVideo() { Loggers.LogInfo("Start of synced LolEvent"); TerminalNode currentNode = Plugin.instance.Terminal.currentNode; if ((Object)(object)currentNode == (Object)null) { Loggers.WARNING("Attempted to play video on NULL node!"); return; } currentNode.clearPreviousText = true; AllMyTerminalPatches.FixVideoPatch.VideoCheck = true; CamEvents.UpdateCamsEvent.Invoke(ViewCommands.ViewMode.Video); if (!ViewCommands.isVideoPlaying) { SetVideoToPlay(currentlyPlaying); SetupVideoPlayer(); Plugin.instance.Terminal.videoPlayer.Play(); Loggers.LogInfo("Synced video should be playing"); } else { Loggers.LogInfo("Video detected already playing, trying to stop it"); AllMyTerminalPatches.FixVideoPatch.OnVideoEnd(); } } internal static string PickVideoToPlay() { if (!ViewCommands.isVideoPlaying) { Loggers.LogInfo("Video not playing, running LolEvents"); DetermineVideoCount(); Loggers.LogInfo($"Random Clip: {lastPlayedIndex} - {Videos[lastPlayedIndex]}"); GetVideoToPlay(lastPlayedIndex); SetupVideoPlayer(); Plugin.instance.Terminal.videoPlayer.Play(); Loggers.LogInfo("Video should be playing"); return ConfigSettings.VideoStartString.Value + "\n"; } if (ViewCommands.isVideoPlaying) { Loggers.LogInfo("Video detected playing, trying to stop it"); AllMyTerminalPatches.FixVideoPatch.OnVideoEnd(); string result = ConfigSettings.VideoStopString.Value + "\n"; Loggers.LogInfo("Lol stop detected"); return result; } return "Unexpected Error with displaying video... \n\n\n"; } private static void DetermineVideoCount() { if (Videos.Count == 0) { Loggers.ERROR("ERROR: No videos found, video player failure."); } else if (Videos.Count <= 2) { lastPlayedIndex = 0; Loggers.LogDebug("2 or less videos detected, no shuffle"); } else if (ConfigSettings.AlwaysUniqueVideo.Value) { if (lastPlayedIndex < 0 || lastPlayedIndex >= Videos.Count - 1) { Loggers.LogDebug("AlwaysUniqueVideo, shuffling"); ShuffleList(Videos); lastPlayedIndex = 0; uniqueShuffled = true; } else { lastPlayedIndex++; Loggers.LogDebug($"set to {lastPlayedIndex} of {Videos.Count - 1}"); } } else { Loggers.LogInfo("More than 2 videos detected, shuffling"); ShuffleList(Videos); lastPlayedIndex = Mathf.Min(lastPlayedIndex + 1, Videos.Count - 1); Loggers.LogDebug($"{lastPlayedIndex} - random video selected"); } } private static void ShuffleList(List list) { Random random = new Random(); for (int i = 0; i < list.Count; i++) { int num = random.Next(i, list.Count); int index = i; int index2 = num; string value = list[num]; string value2 = list[i]; list[index] = value; list[index2] = value2; } } private static void GetVideoToPlay(int randomIndex) { Plugin.instance.Terminal.videoPlayer.clip = null; Plugin.instance.Terminal.videoPlayer.url = "file://" + Videos[randomIndex]; currentlyPlaying = Videos[randomIndex]; Loggers.LogInfo("URL:" + Plugin.instance.Terminal.videoPlayer.url); if (ConfigSettings.VideoSync.Value && (Object)(object)NetHandler.Instance != (Object)null && ConfigSettings.NetworkedNodes.Value) { NetHandler.Instance.SyncMyVideoChoiceToEveryoneRpc(currentlyPlaying); Loggers.LogInfo("Video picked and sent to clients"); } } private static void SetVideoToPlay(string VideoName) { Plugin.instance.Terminal.videoPlayer.clip = null; Plugin.instance.Terminal.videoPlayer.url = "file://" + VideoName; currentlyPlaying = VideoName; Loggers.LogInfo("URL:" + Plugin.instance.Terminal.videoPlayer.url); } private static void SetupVideoPlayer() { Plugin.instance.Terminal.videoPlayer.Stop(); Plugin.instance.Terminal.terminalAudio.Stop(); Plugin.instance.Terminal.videoPlayer.renderMode = (VideoRenderMode)2; Plugin.instance.Terminal.videoPlayer.aspectRatio = (VideoAspectRatio)5; Plugin.instance.Terminal.videoPlayer.isLooping = false; Plugin.instance.Terminal.videoPlayer.playOnAwake = false; Plugin.instance.Terminal.terminalImage.texture = (Texture)(object)Plugin.instance.Terminal.videoTexture; Plugin.instance.Terminal.videoPlayer.targetTexture = Plugin.instance.Terminal.videoTexture; Plugin.instance.Terminal.videoPlayer.audioOutputMode = (VideoAudioOutputMode)1; Plugin.instance.Terminal.videoPlayer.controlledAudioTrackCount = 1; Plugin.instance.Terminal.videoPlayer.SetTargetAudioSource((ushort)0, Plugin.instance.Terminal.terminalAudio); Plugin.instance.Terminal.videoPlayer.source = (VideoSource)1; ((Behaviour)Plugin.instance.Terminal.videoPlayer).enabled = true; Loggers.LogInfo("Videoplayer setup complete"); } } } namespace TerminalStuff.Util { internal class Bools { internal static bool GameIsLocalPlayerNull() { if ((Object)(object)GameNetworkManager.Instance == (Object)null) { return true; } if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) { return true; } return false; } internal static bool StartIsLocalPlayerNull() { if ((Object)(object)StartOfRound.Instance == (Object)null) { return true; } if ((Object)(object)StartOfRound.Instance.localPlayerController == (Object)null) { return true; } return false; } internal static bool ListenForShortCuts() { if (!QoLConfig.TerminalShortcuts.Value || ShortcutBindings.keyActions.Count < 1) { return false; } if (Plugin.instance.suitsTerminal && SuitsTerminalCompatibility.CheckForSuitsMenu()) { return false; } if (MenusContainer.AnyMenuActive()) { return false; } if (!Plugin.instance.Terminal.terminalInUse) { return false; } if (!QoLConfig.TerminalShortcuts.Value || ShortcutBindings.stopForAnyReason) { return false; } if (ITAPICheck()) { return false; } return true; } internal static bool ITAPICheck() { if (!Plugin.instance.ITAPI) { return false; } return InteractiveTermAPI.ApplicationInUse(); } internal static bool AnyKeyIsPressed() { //IL_001c: 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) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair keyAction in ShortcutBindings.keyActions) { if (((ButtonControl)Keyboard.current[keyAction.Key]).isPressed) { ShortcutBindings.keyBeingPressed = keyAction.Key; Loggers.LogInfo($"Key detected in use: {keyAction.Key}"); return true; } } return false; } internal static void ResetEnumBools() { TerminalStart.delayStartEnum = false; TerminalEvents.quitTerminalEnum = false; ShipControls.leverEnum = false; DynamicCommands.fovEnum = false; NetHandler.RainbowFlashRoutine = false; AdminCommands.kickEnum = false; WalkieInTerm.walkieEnum = false; } internal static bool ShouldAddCamsLogic() { if (Commands.TerminalCams.Value) { return true; } if (Commands.TerminalMap.Value) { return true; } if (Commands.TerminalMinicams.Value) { return true; } if (Commands.TerminalMinimap.Value) { return true; } if (Commands.TerminalOverlay.Value) { return true; } return false; } internal static bool MapCameraUsed() { if (StartIsLocalPlayerNull()) { return false; } if (!StartOfRound.Instance.localPlayerController.isInHangarShipRoom) { return false; } if (ViewCommands.CurrentView == ViewCommands.ViewMode.Map) { return true; } if (ViewCommands.CurrentView == ViewCommands.ViewMode.MiniMap) { return true; } if (ViewCommands.CurrentView == ViewCommands.ViewMode.MiniCams) { return true; } if (ViewCommands.CurrentView == ViewCommands.ViewMode.Overlay) { return true; } if (Object.op_Implicit((Object)(object)Plugin.instance.Terminal.displayingPersistentImage)) { return true; } return false; } internal static bool ShouldEnableImage(TerminalNode node) { Loggers.LogDebug("ShouldEnableImage? - " + ((Object)node).name); if (Plugin.instance.suitsTerminal && SuitsTerminalCompatibility.CheckForSuitsMenu()) { CamEvents.UpdateCamsEvent.Invoke(ViewCommands.ViewMode.None); return false; } if (MoonsPlus.IsNodeMoonsPlus(node)) { Plugin.instance.Terminal.displayingPersistentImage = null; ViewCommands.CurrentView = ViewCommands.ViewMode.None; bool flag = MoonsPlus.HijackTerminalImage(); MoonsPlus.TerminalReelSetDimensions(flag); return flag; } if ((Object)(object)node.displayVideo != (Object)null) { return true; } if ((Object)(object)node.displayTexture != (Object)null) { if (((Object)node).name == "ViewInsideShipCam 1" && StartOfRound.Instance.inShipPhase) { return false; } if (ViewCommands.CurrentView == ViewCommands.ViewMode.Vanilla) { CamEvents.UpdateCamsEvent.Invoke(ViewCommands.ViewMode.None); Loggers.LogDebug("Disabling vanilla view monitor image"); return false; } Loggers.LogDebug("Something else is using node.displayTexture, keeping it enabled"); return true; } if (ViewCommands.AnyActiveMonitoring()) { return true; } if (ViewCommands.CurrentView == ViewCommands.ViewMode.Mirror) { return true; } if (MoreCamStuff.DontHideMonitoringNodes.Contains(((Object)node).name) && !MoreCamStuff.CanHideCams() && ((Behaviour)Plugin.instance.Terminal.terminalImage).enabled && ViewCommands.CurrentView != ViewCommands.ViewMode.None) { return true; } return false; } internal static bool AnyMonitoringModesEnabled() { if (!Commands.TerminalMap.Value && !Commands.TerminalCams.Value && !Commands.TerminalOverlay.Value && !Commands.TerminalMinimap.Value) { return Commands.TerminalMinicams.Value; } return true; } } public class Loggers { private static void Log(LogLevel bepLevel, object data) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected I4, but got Unknown //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected I4, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) int num = (int)ConfigSettings.LogLevel.Value; int num2 = (int)bepLevel; if (num2 <= num) { Plugin.Log.Log(bepLevel, data); } } internal static void LogDebug(object data) { Log((LogLevel)32, data); } internal static void LogInfo(object data) { Log((LogLevel)16, data); } internal static void LogMessage(object data) { Log((LogLevel)8, data); } internal static void WARNING(object data) { Log((LogLevel)4, data); } internal static void ERROR(object data) { Log((LogLevel)2, data); } internal static void FATAL(object data) { Log((LogLevel)1, data); } } internal class MenuBuild { internal static CommandsMenuBase MoreMenu; internal static CommandMenuItem MainMenuItem; internal static CommandManager MoreMenuCommand; internal static void MoreInit() { //IL_004e: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown MoreMenuCommand = Commands.AddLocalCommmandManualWords("More Menus", QoLConfig.CreateMoreMenus, new List(1) { "more" }, EnterCommandMenu); CommandsMenuBase val = new CommandsMenuBase("More Menu", (Dictionary)null) { MainMenu = (MenuItem)(object)MainMenuItem }; ((BetterMenu)val).PageSize = 10; ((BetterMenu)val).AdjustScrollInMenu = false; val.CategoryHeader = CustomizeConfig.MoreMenuSectionHeader.Value; val.CommandHeader = CustomizeConfig.MoreMenuCommandHeader.Value; val.KeywordsHeader = CustomizeConfig.MoreMenuKeywordsHeader.Value; val.InfoHeader = CustomizeConfig.MoreMenuInfoHeader.Value; val.AddInfoMenu = CustomizeConfig.MoreIncludeCommandInfo.Value; val.AddKeywordsMenu = CustomizeConfig.MoreIncludeCommandKeywords.Value; val.AddRunCommand = CustomizeConfig.MoreIncludeCommandRun.Value; MoreMenu = val; MainMenuItem = CommandsMenu.CreateMainMenu(MoreMenu, "More Commands Menu", (Func)(() => CustomizeConfig.MoreMenuMainHeader.Value), (Func)null); } internal static string EnterCommandMenu() { if (MainMenuItem == null) { return "This menu has not been created correctly"; } ((BetterMenu)(object)MoreMenu).EnterAtPage((MenuItem)(object)MainMenuItem); return ""; } internal static void CreateDarmuhsTerminalStuffMenus() { Loggers.LogDebug("START CreateDarmuhsTerminalStuffMenus"); TerminalStart.InitiateTerminalStuff(); if (!QoLConfig.CreateMoreMenus.Value) { TerminalKeyword val = default(TerminalKeyword); if (!DynamicBools.TryGetKeyword("other", ref val)) { return; } { foreach (CommandManager enabledCommand in Commands.GetEnabledCommands()) { if (enabledCommand.KeywordList.Count != 0 && enabledCommand.IsEnabled != null) { AddingThings.AddToExistingNodeText("\n>" + CommonStringStuff.GetKeywordsForMenuItem(enabledCommand.KeywordList).ToUpper() + "\n" + ((ConfigEntryBase)enabledCommand.IsEnabled.ConfigItem).Description.Description, ref val.specialKeywordResult); Loggers.LogDebug(enabledCommand.Name + " keywords added to other menu"); } } return; } } AddingThings.AddToHelpCommand(CustomizeConfig.MoreHintText.Value); TerminalNode val2 = default(TerminalNode); if (LogicHandling.TryGetFromAllNodes("OtherCommands", ref val2)) { AddingThings.AddToExistingNodeText("\n" + CustomizeConfig.MoreHintText.Value, ref val2); } List activeCommands = Plugin.GetActiveCommands(); CommandsMenu.UpdateMenuListing(MoreMenu, MainMenuItem, activeCommands, "Other"); ((BetterMenu)(object)MoreMenu).MenuNode = MoreMenuCommand.terminalNode; CommandsMenu.CreateAndSetControlsFooter(MoreMenu, ((BetterMenuBase)MoreMenu).GetMenuItemsOfType>()); Loggers.LogDebug("END CreateDarmuhsTerminalStuffMenus"); } } internal class Misc { internal static PlayerControllerB GetPlayerFromName(string playerName) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (Misc.CompareStringsInvariant(val.playerUsername, playerName, true)) { return val; } } return null; } internal static PlayerControllerB GetPlayerUsingTerminal() { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!val.isPlayerDead && (Object)(object)val.currentTriggerInAnimationWith == (Object)(object)Plugin.instance.Terminal.terminalTrigger) { Loggers.LogInfo("Player: " + val.playerUsername + " detected using terminal."); return val; } } return null; } internal static int HostClientID() { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.isHostPlayerObject) { Loggers.LogInfo($"Player: {val.playerUsername} is the host, client ID: {val.playerClientId}."); return (int)val.playerClientId; } } return -1; } } internal class SaveManager { internal static List AllUpgradesUnlocked = new List(); internal static void InitMoonPlusSave() { if (!((Object)(object)NetHandler.Instance == (Object)null) && !Bools.GameIsLocalPlayerNull() && Commands.TerminalMoonsPlus.Value) { if (!((NetworkBehaviour)GameNetworkManager.Instance.localPlayerController).IsHost) { NetHandler.Instance.AskHostTravelHistoryRpc(); } else { HistorySaveInit(); } } } internal static void HistorySaveInit() { if ((Object)(object)NetHandler.Instance == (Object)null) { return; } if (!ES3.KeyExists("darmuhsTerminalStuff_MoonsPlusHistory", GameNetworkManager.Instance.currentSaveFileName)) { Loggers.LogDebug("Creating save key for darmuhsTerminalStuff_MoonsPlusHistory"); MoonsPlus.MoonsVisited.Clear(); MoonsPlus.MoonsVisited = MoonsPlus.GetTravelHistory(); SaveTravelHistory(MoonsPlus.MoonsVisited); foreach (string item in MoonsPlus.MoonsVisited) { NetHandler.Instance.UpdateTravelHistoryRpc(item); } } else { MoonsPlus.MoonsVisited = ES3.Load>("darmuhsTerminalStuff_MoonsPlusHistory", GameNetworkManager.Instance.currentSaveFileName); Loggers.LogDebug("Updating MoonsPlus Travel History from save key darmuhsTerminalStuff_MoonsPlusHistory"); Loggers.LogDebug($"MoonsVisited count: {MoonsPlus.MoonsVisited.Count}"); foreach (string item2 in MoonsPlus.MoonsVisited) { NetHandler.Instance.UpdateTravelHistoryRpc(item2); } } CollectionExtensions.Do((IEnumerable)MoonsPlus.MoonListing, (Action)delegate(MoonInfo x) { x.OneTimePurchaseLoadIn(); }); } internal static void ResetUnlocks() { CostCommands.enemyScanUpgradeEnabled = false; CostCommands.vitalsUpgradeEnabled = false; AllUpgradesUnlocked = new List(); } internal static void InitUnlocks() { if ((Object)(object)NetHandler.Instance == (Object)null) { return; } CostCommands.enemyScanUpgradeEnabled = false; CostCommands.vitalsUpgradeEnabled = false; if ((Object)(object)NetHandler.Instance == (Object)null) { return; } if (!GameNetworkManager.Instance.isHostingGame) { NetHandler.Instance.AskHostUpgradeStatusRpc(); return; } if (!ES3.KeyExists("darmuhsTerminalStuff_Upgrades", GameNetworkManager.Instance.currentSaveFileName)) { Loggers.LogDebug("Creating save key for darmuhsTerminalStuff_Upgrades"); AllUpgradesUnlocked = GetUnlockList(); SaveUnlocks(AllUpgradesUnlocked); { foreach (string item in AllUpgradesUnlocked) { NetHandler.Instance.UpgradeStatusRpc(item); } return; } } AllUpgradesUnlocked = ES3.Load>("darmuhsTerminalStuff_Upgrades", GameNetworkManager.Instance.currentSaveFileName); Loggers.LogDebug("Updating upgrades unlock status from save key darmuhsTerminalStuff_Upgrades"); Loggers.LogDebug($"AllUpgrades count: {AllUpgradesUnlocked.Count}"); foreach (string item2 in AllUpgradesUnlocked) { NetHandler.Instance.UpgradeStatusRpc(item2); } } internal static List GetUnlockList() { List list = new List(); if (!GameNetworkManager.Instance.isHostingGame) { return list; } if (CostCommands.CheckUnlockableStatus("BioscanPatch")) { CostCommands.enemyScanUpgradeEnabled = true; list.Add("BioscanPatch"); } if (CostCommands.CheckUnlockableStatus("VitalsPatch")) { CostCommands.vitalsUpgradeEnabled = true; list.Add("VitalsPatch"); } return list; } internal static void NewUnlock(string unlockName) { if (!((Object)(object)NetHandler.Instance == (Object)null)) { if (!AllUpgradesUnlocked.Contains(unlockName)) { AllUpgradesUnlocked.Add(unlockName); } if (GameNetworkManager.Instance.isHostingGame) { SaveUnlocks(AllUpgradesUnlocked); } NetHandler.Instance.UpgradeStatusRpc(unlockName); } } internal static void SaveUnlocks(List unlockList) { if (GameNetworkManager.Instance.isHostingGame) { Loggers.LogDebug("saving darmuhsTerminalStuff_Upgrades"); ES3.Save>("darmuhsTerminalStuff_Upgrades", unlockList, GameNetworkManager.Instance.currentSaveFileName); } } internal static void SaveTravelHistory(List travelHistory) { if (!GameNetworkManager.Instance.isHostingGame) { return; } Loggers.LogDebug($"saving darmuhsTerminalStuff_MoonsPlusHistory from list ({travelHistory.Count}):"); foreach (string item in travelHistory) { Loggers.LogDebug(item); } ES3.Save>("darmuhsTerminalStuff_MoonsPlusHistory", travelHistory, GameNetworkManager.Instance.currentSaveFileName); } internal static void AddToTravelHistory(MoonInfo moon) { if (!((Object)(object)NetHandler.Instance == (Object)null) && !Bools.GameIsLocalPlayerNull() && !((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)) { if (!MoonsPlus.MoonsVisited.Contains(moon.LevelName)) { MoonsPlus.MoonsVisited.Add(moon.LevelName); } if (((NetworkBehaviour)GameNetworkManager.Instance.localPlayerController).IsHost) { SaveTravelHistory(MoonsPlus.MoonsVisited); } NetHandler.Instance.UpdateTravelHistoryRpc(moon.LevelName); } } } internal class StringStuff { internal static string[] GetWords() { string text = Plugin.instance.Terminal.screenText.text; int textAdded = Plugin.instance.Terminal.textAdded; int length = text.Length; int num = length - textAdded; string text2 = text.Substring(num, length - num); return text2.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries); } internal static string GetAfterKeyword(List keywords) { string text = Plugin.instance.Terminal.screenText.text; int textAdded = Plugin.instance.Terminal.textAdded; int length = text.Length; int num = length - textAdded; string text2 = text.Substring(num, length - num); foreach (string keyword in keywords) { if (text2.StartsWith(keyword, ignoreCase: true, CultureInfo.InvariantCulture)) { string text3 = text2.Replace(keyword, ""); return text3.Trim(); } } return ""; } internal static List GetKeywordsPerConfigItem(string configItem) { List result = new List(); if (configItem.Length > 0) { result = (from item in configItem.Split(';') select item.TrimStart()).ToList(); } return result; } internal static List GetNumberListFromStringList(List stringList) { List list = new List(); foreach (string @string in stringList) { if (int.TryParse(@string, out var result)) { list.Add(result); } else { Loggers.WARNING("Could not parse " + @string + " to integer"); } } return list; } internal static Dictionary GetKeywordAndItemNames(string configItem) { Dictionary result = new Dictionary(); if (configItem.Length > 0) { result = (from item in configItem.Split(';') select item.Trim() into item select item.Split(':')).ToDictionary((string[] pair) => pair[0].Trim(), (string[] pair) => pair[1].Trim()); } return result; } internal static List GetListToLower(List stringList) { List list = new List(); foreach (string @string in stringList) { list.Add(@string.ToLower()); } return list; } } } namespace TerminalStuff.StoreTweaks { public class StoreInfo { internal int price; public string name = ""; internal UnlockableItem Unlockable; internal Item BuyableItem; internal BuyableVehicle Vehicle; public int SelectionCount = 1; internal int maxAllowed; internal TerminalNode terminalNode; internal bool ShowItem = true; public StoreMenuItem ThisMenuItem; public bool Selected { get; private set; } internal bool IsPurchasePack { get; set; } internal bool WaitForDelivery { get; set; } = true; internal bool IsUnlocked { get { if (Unlockable == null) { return false; } if (!Unlockable.alreadyUnlocked) { return Unlockable.hasBeenUnlockedByPlayer; } return true; } } public bool OnSale { get; set; } internal bool IsVehicle() { return Vehicle != null; } internal bool IsSuit() { if (Unlockable == null) { return false; } if (Unlockable.unlockableType != 0) { return (Object)(object)Unlockable.suitMaterial != (Object)null; } return true; } public override string ToString() { return name; } public bool ShouldShowInStore() { if (IsUnlocked) { return false; } if (terminalNode.buyItemIndex != -1 && (Object)(object)BuyableItem == (Object)null) { return false; } if (Misc.DoesListHaveInvariant(StorePlusConfig.HideItemListing, name, true)) { return false; } return true; } internal StoreInfo(TerminalNode storeNode, bool purchasePack = false) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown terminalNode = storeNode; price = storeNode.itemCost; IsPurchasePack = purchasePack; GetStoreInfo(terminalNode); StoreMenuItem storeMenuItem = new StoreMenuItem(name, showEmpty: true); ((MenuItem)storeMenuItem).OnPageLoad = PageLoad; storeMenuItem.StoreItem = this; ThisMenuItem = storeMenuItem; ((MenuItem)ThisMenuItem).SelectionEvent.AddListener(new Event(OnSelect)); } internal void UpdateNode(TerminalNode storeNode) { if ((Object)(object)terminalNode == (Object)null) { terminalNode = storeNode; } else if (terminalNode.itemCost < storeNode.itemCost) { terminalNode = storeNode; } if ((Object)(object)BuyableItem == (Object)null) { price = storeNode.itemCost; if (terminalNode.itemCost != storeNode.itemCost) { price = Math.Max(terminalNode.itemCost, storeNode.itemCost); } } GetStoreInfo(storeNode); ThisMenuItem.StoreItem = this; } internal void OnSelect() { Selected = !Selected; SelectionCount = 1; Plugin.Log.LogMessage((object)$"{name} selected [{Selected}]"); UpdateSelection(); } internal void UpdateSelection() { if (Selected && !StorePlus.StoreSelection.Contains(this)) { StorePlus.StoreSelection.Add(this); } if (!Selected && StorePlus.StoreSelection.Contains(this)) { StorePlus.StoreSelection.Remove(this); } } internal void PageLoad() { PriceChecks(); ((MenuItem)ThisMenuItem).Prefix = ""; ((MenuItem)ThisMenuItem).Suffix = ""; StoreMenuItem thisMenuItem = ThisMenuItem; ((MenuItem)thisMenuItem).Prefix = ((MenuItem)thisMenuItem).Prefix + $"${price} "; if (IsVehicle() && Plugin.instance.Terminal.hasWarrantyTicket) { StoreMenuItem thisMenuItem2 = ThisMenuItem; ((MenuItem)thisMenuItem2).Prefix = ((MenuItem)thisMenuItem2).Prefix + "(warranty) "; } if (SelectionCount > 1) { StoreMenuItem thisMenuItem3 = ThisMenuItem; ((MenuItem)thisMenuItem3).Suffix = ((MenuItem)thisMenuItem3).Suffix + $" x {SelectionCount}"; } if (Selected) { StoreMenuItem thisMenuItem4 = ThisMenuItem; ((MenuItem)thisMenuItem4).Suffix = ((MenuItem)thisMenuItem4).Suffix + " *"; } if (OnSale) { StoreMenuItem thisMenuItem5 = ThisMenuItem; ((MenuItem)thisMenuItem5).Suffix = ((MenuItem)thisMenuItem5).Suffix + $" ({StorePlus.GetSalesPercentage(this)}% OFF!)"; } if (price <= StorePlus.GetProjectedCredits() && StorePlusConfig.AffordableColor.Value.Length > 0) { ((MenuItem)ThisMenuItem).Prefix = ((MenuItem)ThisMenuItem).Prefix.Insert(0, ""); StoreMenuItem thisMenuItem6 = ThisMenuItem; ((MenuItem)thisMenuItem6).Suffix = ((MenuItem)thisMenuItem6).Suffix + ""; } if (price > StorePlus.GetProjectedCredits() && StorePlusConfig.NotEnoughCredsColor.Value.Length > 0 && !Selected) { ((MenuItem)ThisMenuItem).Prefix = ((MenuItem)ThisMenuItem).Prefix.Insert(0, ""); StoreMenuItem thisMenuItem7 = ThisMenuItem; ((MenuItem)thisMenuItem7).Suffix = ((MenuItem)thisMenuItem7).Suffix + ""; } } internal void GetStoreInfo(TerminalNode storeNode) { if (storeNode.buyItemIndex != -1 && Plugin.instance.Terminal.buyableItemsList.Length > storeNode.buyItemIndex) { BuyableItem = Plugin.instance.Terminal.buyableItemsList[storeNode.buyItemIndex]; if ((Object)(object)BuyableItem != (Object)null) { name = BuyableItem.itemName; price = BuyableItem.creditsWorth; } } if (storeNode.buyVehicleIndex != -1) { Vehicle = Plugin.instance.Terminal.buyableVehicles[storeNode.buyVehicleIndex]; if (Vehicle != null) { name = Vehicle.vehicleDisplayName; } if (name == null) { name = $"Company Cruiser ({storeNode.buyVehicleIndex})"; } } if (storeNode.shipUnlockableID != -1 && StartOfRound.Instance.unlockablesList.unlockables.Count > storeNode.shipUnlockableID) { Unlockable = StartOfRound.Instance.unlockablesList.unlockables[storeNode.shipUnlockableID]; if (Unlockable == null) { return; } name = terminalNode.creatureName; WaitForDelivery = false; if (Unlockable.maxNumber > 0) { maxAllowed = Unlockable.maxNumber; } } if (IsPurchasePack) { name = Unlockable.unlockableName; } if (name == null) { name = "Unknown Item"; } name = name.Trim(); } internal void PriceChecks() { if ((Object)(object)BuyableItem == (Object)null) { price = terminalNode.itemCost; } else { price = BuyableItem.creditsWorth; } if (IsPurchasePack) { price = StorePacks.GetPriceFromNode(terminalNode); return; } if (WaitForDelivery) { int num = price; if (!IsVehicle()) { price = StorePlus.GetSalesPrice(price, terminalNode.buyItemIndex); } else { price = StorePlus.GetSalesPrice(price, terminalNode.buyVehicleIndex, isVehicle: true); } OnSale = price != num; } if (IsVehicle() && Plugin.instance.Terminal.hasWarrantyTicket) { price = 0; } } internal bool InRotation() { if (IsVehicle()) { return true; } if (WaitForDelivery) { return true; } if (IsPurchasePack) { return true; } if (StorePlus.ManualUpgradeNames.Any((string c) => Misc.CompareStringsInvariant(c, terminalNode.creatureName, true))) { return true; } if (!StorePacks.IsUnlockableBuyable(terminalNode.shipUnlockableID)) { return false; } if (!StorePlusConfig.RespectStoreRotation.Value) { return true; } if (Plugin.instance.Terminal.ShipDecorSelection.Contains(terminalNode)) { return true; } return false; } internal void Reset() { Selected = false; SelectionCount = 1; } internal static bool IsItemEnabled(int indexNum) { if (indexNum < 0) { return false; } TerminalKeyword val = default(TerminalKeyword); if (DynamicBools.TryGetKeyword("buy", ref val)) { return val.compatibleNouns.Any((CompatibleNoun c) => c.result.buyItemIndex == indexNum); } return false; } internal static bool IsValidItem(TerminalNode node) { if (node.terminalOptions == null) { return false; } if (node.terminalOptions.Length < 1) { return false; } if (node.buyItemIndex < 0) { return false; } return true; } } public class StoreMenuItem(string name) : MenuItem((BetterMenuBase)(object)StorePlus.StorePlusMenu) { private string _name = name; private bool _showEmpty; private CustomEvent _selection = new CustomEvent(); private List _nested = new List(); internal string keyword = ""; public StoreInfo StoreItem; public override string Name { get { return name; } set { name = value; } } public override bool ShowIfEmptyNest { get { if (StoreItem == null) { return _showEmpty; } return StoreItem.ShouldShowInStore(); } set { _showEmpty = value; } } public override CustomEvent SelectionEvent { get { return _selection; } set { _selection = value; } } public override List NestedMenus { get { return _nested; } set { _nested = value; } } public StoreMenuItem(string name, string kw, MenuItem Parent) : this(name) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown ((MenuItem)this).Name = name; keyword = kw; ((MenuItem)this).SetParentMenu(Parent); ((MenuItem)this).SelectionEvent.AddListener(new Event(OnExternalSelect)); ((MenuItem)this).LoadPageOnSelect = false; ((MenuItem)this).ShowIfEmptyNest = true; } public StoreMenuItem(string name, bool showEmpty) : this(name) { ((MenuItem)this).Name = name; ((MenuItem)this).ShowIfEmptyNest = showEmpty; } public static bool DoesMenuItemExist(string keyword) { if (((BetterMenuBase)StorePlus.StorePlusMenu).AllMenuItemsOfType.Count == 0) { return false; } if (((BetterMenuBase)StorePlus.StorePlusMenu).AllMenuItemsOfType.ConvertAll((MenuItem x) => x as StoreMenuItem).Any((StoreMenuItem x) => x?.keyword == keyword)) { return true; } return false; } public static bool DoesMenuItemExist(StoreInfo item) { if (((BetterMenuBase)StorePlus.StorePlusMenu).AllMenuItemsOfType.Count == 0) { return false; } if (((BetterMenuBase)StorePlus.StorePlusMenu).AllMenuItemsOfType.ConvertAll((MenuItem x) => x as StoreMenuItem).Any((StoreMenuItem x) => x?.StoreItem == item)) { return true; } return false; } public void OnExternalSelect() { if (keyword.Length >= 2) { StorePlus.StorePlusMenu.ExitAction = delegate { StartofHandling.HandleShortcutFinal(keyword); Loggers.LogDebug("Selecting external keyword! " + keyword); }; StorePlus.StorePlusMenu.ExitMenu(true); } } } internal class StorePacks { internal string Name = ""; internal string configValue = ""; internal List ContentsList = new List(); internal TerminalNode terminalNode; internal CommandManager commandManager; internal List UpgradeItems = new List(); internal Dictionary ItemsToPurchase = new Dictionary(); internal string Contents => GetContents(); public override string ToString() { return Name; } internal StorePacks(string name, string value, CommandManager command) { Name = name; configValue = value; commandManager = command; terminalNode = command.terminalNode; terminalNode.creatureName = Name; GetPurchasePackContents(); Loggers.LogDebug($"PurchasePack {Name} created with {ItemsToPurchase.Count} unique items and {UpgradeItems.Count} Upgrades/Furniture"); StorePacksInfo.AllPacks.Add(this); if (Commands.TerminalStorePlus.Value) { AddToStorePlus(); } } internal void UpdateExisting(string value, CommandManager command) { configValue = value; commandManager = command; terminalNode = command.terminalNode; GetPurchasePackContents(); Loggers.LogDebug($"PurchasePack {Name} updated with {ItemsToPurchase.Count} unique items and {UpgradeItems.Count} Upgrades/Furniture"); if (Commands.TerminalStorePlus.Value) { AddToStorePlus(); } } internal void AddToStorePlus() { terminalNode.creatureName = Name; if (!StorePlus.ManualUpgradeNames.Contains(Name)) { StorePlus.ManualUpgradeNames.Add(Name); } StoreInfo storeInfo = null; if (((MenuItem)StorePlus.Packs).NestedMenus.Count > 0) { StoreMenuItem storeMenuItem = ((MenuItem)StorePlus.Packs).NestedMenus.Cast().FirstOrDefault((StoreMenuItem x) => ((MenuItem)x).Name == Name && x.StoreItem.IsPurchasePack); if (storeMenuItem != null) { storeInfo = storeMenuItem.StoreItem; } } if (storeInfo != null) { Loggers.LogDebug("Updating purchasepack StorePlus item!"); storeInfo.UpdateNode(terminalNode); return; } storeInfo = new StoreInfo(terminalNode) { IsPurchasePack = true, name = Name }; ((MenuItem)storeInfo.ThisMenuItem).SetParentMenu((MenuItem)(object)StorePlus.Packs); } internal static string AskPurchasePack() { if (StorePacksInfo.Selected == null) { return "Purchase pack has FAILED at AskPurchasePack due to a null selection!\n"; } StorePacksInfo.Selected.GetContents(); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("Would you like to purchase the [" + StorePacksInfo.CurrentPackName + "] PurchasePack?\n\n\tContents:\n"); stringBuilder.Append(StorePacksInfo.Selected.Contents); int itemCount; int totalCost = StorePacksInfo.Selected.GetTotalCost(out itemCount); if (totalCost <= Plugin.instance.Terminal.groupCredits) { stringBuilder.AppendLine($"\n\tTotal Cost: ■{totalCost}({itemCount} items)\n\nPlease CONFIRM or DENY.\n"); return stringBuilder.ToString(); } Loggers.LogInfo("not enough credits to purchase, sending to cannot afford display"); TerminalGeneral.CancelConfirmation = true; return $"You cannot afford the {StorePacksInfo.CurrentPackName} PurchasePack ({itemCount} items).\n\n\tTotal Cost: ■{totalCost}\n\n"; } internal static int GetPriceFromNode(TerminalNode node) { int result = 0; StorePacks storePacks = StorePacksInfo.AllPacks.FirstOrDefault((StorePacks x) => (Object)(object)x.terminalNode == (Object)(object)node); if (storePacks == null) { return result; } result = storePacks.GetTotalCost(out var itemCount); Loggers.LogDebug($"Got price for {storePacks.Name} of ${result} from {itemCount} items"); return result; } internal static int GetBuyablesCountFromNode(TerminalNode node) { int result = 0; StorePacks storePacks = StorePacksInfo.AllPacks.FirstOrDefault((StorePacks x) => (Object)(object)x.terminalNode == (Object)(object)node); if (storePacks == null) { return result; } result = storePacks.ItemsToPurchase.Sum>((KeyValuePair x) => x.Value); Loggers.LogDebug($"Got buyables count for {storePacks.Name} of {result} from terminalnode"); return result; } internal static string CompletePurchasePack() { if (StorePacksInfo.Selected == null) { return "Purchase pack has FAILED at AskPurchasePack due to a null selection!\n"; } StorePacksInfo.Selected.GetContents(); StorePacksInfo.Selected.commandManager.ConfirmBase.Confirm.result.itemCost = 0; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("You have purchased the " + StorePacksInfo.CurrentPackName + " PurchasePack!\n\n\tContents:\n"); stringBuilder.Append(StorePacksInfo.Selected.Contents); int itemCount; int totalCost = StorePacksInfo.Selected.GetTotalCost(out itemCount); if (totalCost > Plugin.instance.Terminal.groupCredits) { Loggers.LogInfo("not enough credits to purchase, sending to error message"); return Plugin.instance.Terminal.terminalNodes.specialNodes[5].displayText; } BuyAll(totalCost, itemCount); stringBuilder.AppendLine($"\n\nYour new balance is ■{Plugin.instance.Terminal.groupCredits} credits\n\n\tEnjoy!\n"); Plugin.instance.Terminal.PlayTerminalAudioServerRpc(0); return stringBuilder.ToString(); } private static void BuyAll(int totalCost, int itemCount) { Loggers.LogInfo($"BuyAll: totalCost - {totalCost} itemCount - {itemCount}"); int maxItems = AllMyTerminalPatches.ConfigGetters.GetMaxItems(); int[] array = StorePacksInfo.Selected.BuyItems(); if (array.Length + Plugin.instance.Terminal.orderedItemsFromTerminal.Count > maxItems) { array = array.Skip(array.Length + Plugin.instance.Terminal.orderedItemsFromTerminal.Count - maxItems).ToArray(); } Plugin.instance.Terminal.BuyItemsServerRpc(array, Plugin.instance.Terminal.groupCredits - totalCost, array.Length); Loggers.LogDebug($"orderedItems update: {Plugin.instance.Terminal.orderedItemsFromTerminal.Count}"); if (StorePacksInfo.Selected.UpgradeItems.Count <= 0) { return; } foreach (TerminalNode upgradeItem in StorePacksInfo.Selected.UpgradeItems) { StartOfRound.Instance.BuyShipUnlockableServerRpc(upgradeItem.shipUnlockableID, Plugin.instance.Terminal.groupCredits); Loggers.LogInfo("Unlocking " + upgradeItem.creatureName); } } internal static List GetItemListFromNode(TerminalNode node) { StorePacksInfo.Selected = StorePacksInfo.AllPacks.FirstOrDefault((StorePacks x) => (Object)(object)x.terminalNode == (Object)(object)node); if (StorePacksInfo.Selected == null) { return new List(); } return StorePacksInfo.Selected.ContentsList; } internal static void CompletePurchaseV2(TerminalNode node, int count) { StorePacksInfo.Selected = StorePacksInfo.AllPacks.FirstOrDefault((StorePacks x) => (Object)(object)x.terminalNode == (Object)(object)node); if (StorePacksInfo.Selected == null) { Loggers.WARNING("CompletePurchaseV2 failed to parse given node for purchase!"); return; } StorePacksInfo.Selected.GetContents(); int itemCount; int totalCost = StorePacksInfo.Selected.GetTotalCost(out itemCount); if (totalCost > Plugin.instance.Terminal.groupCredits) { Loggers.WARNING("Not enough credits for totalCost of purchase pack during CompletePurchaseV2 (this should have been checked for already)"); return; } for (int num = 0; num < count; num++) { BuyAll(totalCost, itemCount); } } private int[] BuyItems() { List list = new List(); List list2 = Plugin.instance.Terminal.buyableItemsList.ToList(); foreach (KeyValuePair item2 in ItemsToPurchase) { int value = item2.Value; int item = list2.IndexOf(item2.Key); for (int i = 0; i < value; i++) { list.Add(item); Loggers.LogDebug($"Adding {item2.Key.itemName} to order list ({i})"); } } return list.ToArray(); } private int GetTotalCost(out int itemCount) { int num = 0; itemCount = 0; if (ItemsToPurchase.Count > 0) { foreach (KeyValuePair item in ItemsToPurchase) { int itemID = Plugin.instance.Terminal.buyableItemsList.ToList().IndexOf(item.Key); int num2 = ItemsToPurchase[item.Key]; int salesPrice = StorePlus.GetSalesPrice(item.Key.creditsWorth, itemID); salesPrice *= num2; num += salesPrice; itemCount += num2; Loggers.LogDebug($"Added {salesPrice} to total: {num} (total item count: {itemCount})"); } } if (UpgradeItems.Count > 0) { UpdateUnlockStatus(); int num3 = UpgradeItems.Sum((TerminalNode upgrade) => upgrade.itemCost); Loggers.LogDebug($"Adding {num3} to {num}"); num += num3; } Loggers.LogInfo($"Total Cost of {Name}: [{num}]"); return num; } private void UpdateUnlockStatus() { if (UpgradeItems.Count == 0) { return; } Loggers.LogDebug($"{Name} UpdateUnlockStatus: original ContentsList count = {ContentsList.Count}"); List Unlocked = UpgradeItems.FindAll((TerminalNode x) => !IsUnlockableBuyable(x.shipUnlockableID)); ContentsList.RemoveAll((string x) => Unlocked.Any((TerminalNode c) => Misc.CompareStringsInvariant(c.creatureName, x, true))); UpgradeItems.RemoveAll((TerminalNode x) => Unlocked.Count != 0); Loggers.LogDebug($"{Name} Removed all unlocked upgrades, new ContentsList count = {ContentsList.Count}"); } private void GetPurchasePackContents() { List keywordsPerConfigItem = CommonStringStuff.GetKeywordsPerConfigItem(configValue, ','); List list = new List(); Plugin.refreshNodes = true; foreach (string item in keywordsPerConfigItem) { TerminalNode UpgradeNode; if (TryGetItemToBuy(item, out Item itemValue)) { Loggers.LogDebug(item + " is a valid item, adding to pack purchase"); int nameCount = GetNameCount(keywordsPerConfigItem, item); if (nameCount > 1 && !list.Contains(itemValue.itemName)) { ContentsList.Add($"{itemValue.itemName} x {nameCount}"); } else if (nameCount <= 1) { ContentsList.Add(itemValue.itemName ?? ""); } if (!list.Contains(itemValue.itemName)) { list.Add(itemValue.itemName); } ItemsToPurchase.TryAdd(itemValue, nameCount); } else if (TryGetUpgrade(item, out UpgradeNode) && IsUnlockableBuyable(UpgradeNode.shipUnlockableID)) { if (!ContentsList.Contains(UpgradeNode.creatureName ?? "")) { ContentsList.Add(UpgradeNode.creatureName ?? ""); } if (!UpgradeItems.Contains(UpgradeNode)) { UpgradeItems.Add(UpgradeNode); } Loggers.LogDebug("Added " + UpgradeNode.creatureName + " to ContentList & UpgradeItems Lists"); } } } private string GetContents() { UpdateUnlockStatus(); StringBuilder stringBuilder = new StringBuilder(); foreach (string contents in StorePacksInfo.Selected.ContentsList) { stringBuilder.AppendLine(contents); } return stringBuilder.ToString(); } private static bool TryGetItemToBuy(string itemName, out Item itemValue) { List source = Plugin.instance.Terminal.buyableItemsList.ToList(); itemValue = ((IEnumerable)source).FirstOrDefault((Func)((Item x) => Misc.StringContainsInvariant(x.itemName, itemName, true))); if ((Object)(object)itemValue == (Object)null) { return false; } int num = Plugin.instance.Terminal.buyableItemsList.ToList().IndexOf(itemValue); Loggers.LogDebug($"{itemValue.itemName} found matching to {itemName} at index: [{num}]"); return true; } private static bool TryGetUpgrade(string upgradeName, out TerminalNode UpgradeNode) { Loggers.LogDebug("TryGetUpgrade from " + upgradeName); Loggers.LogDebug("Getting all nodes"); List allnodes = Plugin.Allnodes; allnodes.RemoveAll((TerminalNode x) => x.creatureName == null); Loggers.LogDebug($"iterating through allNodes {allnodes.Count}"); UpgradeNode = ((IEnumerable)allnodes).FirstOrDefault((Func)((TerminalNode node) => Misc.StringStartsWithInvariant(node.creatureName, upgradeName, true))); if ((Object)(object)UpgradeNode == (Object)null) { Loggers.WARNING("TryGetUpgrade by name " + upgradeName + " could not be found!"); return false; } if (UpgradeNode.shipUnlockableID < 0) { Loggers.WARNING("TryGetUpgrade name " + upgradeName + " has invalid shipUnlockableID!"); return false; } if (!IsUnlockableBuyable(UpgradeNode.shipUnlockableID)) { Loggers.LogDebug("TryGetUpgrade detected " + upgradeName + " as already unlocked!"); return false; } Loggers.LogDebug($"unlockableID: {UpgradeNode.shipUnlockableID}"); Loggers.LogDebug("creatureName: " + UpgradeNode.creatureName + " matching " + upgradeName); return true; } private static int GetNameCount(List itemList, string itemName) { int count = itemList.FindAll((string i) => i == itemName).Count; Loggers.LogInfo($"Final Count: {itemName} - {count}"); return count; } internal static bool IsUnlockableBuyable(int itemID) { if (itemID >= StartOfRound.Instance.unlockablesList.unlockables.Count) { return false; } UnlockableItem val = StartOfRound.Instance.unlockablesList.unlockables[itemID]; if (!val.alreadyUnlocked && !val.hasBeenUnlockedByPlayer) { Loggers.LogDebug($"Upgrade ID: {itemID} has not been unlocked. Setting variable to true"); return true; } return false; } } internal static class StorePacksInfo { internal static string CurrentPackName = ""; internal static List AllPacks = new List(); internal static StorePacks Selected { get; set; } = null; internal static void CancelConfirmation() { CurrentPackName = ""; Selected = null; } } public class StorePlus { public enum StartingPage { MainMenu, Items, Upgrades, Vehicles, Suits, Packs, Settings } [CompilerGenerated] private static class <>O { public static Action <0>__CompletePurchase; public static Action <1>__DecreaseItemCount; public static Action <2>__IncreaseItemCount; public static Event <3>__OnExit; public static Event <4>__OnAnyPageLoad; public static Event <5>__ReturnToStore; public static Func <6>__GetMainFooter; public static Func <7>__GetStoreFooter; public static ParameterEvent> <8>__SortMenu; public static Func <9>__GetOtherFooter; } internal static BetterMenu StorePlusMenu = new BetterMenu("StorePlus", (Dictionary)null); internal static CommandManager StoreCommand = null; private static bool InitOnce = false; internal static StoreMenuItem TheMainMenu = new StoreMenuItem("StorePlus"); internal static StoreMenuItem Buyables = new StoreMenuItem("Items"); internal static StoreMenuItem Upgrades = new StoreMenuItem("Upgrades & Furniture"); internal static StoreMenuItem Vehicles = new StoreMenuItem("Vehicles"); internal static StoreMenuItem Suits = new StoreMenuItem("Suits"); internal static StoreMenuItem Packs = new StoreMenuItem("Purchase Packs"); internal static StoreMenuItem ExternalMods = new StoreMenuItem("Other"); internal static int SubTotal = 0; internal static List ManualUpgradeNames = new List(); internal static StoreMenuItem Current { get; set; } = null; internal static TerminalNode OriginalStorePage { get; set; } = null; internal static List AllStoreItems { get; set; } = new List(); internal static List StoreSelection { get; set; } = new List(); internal static List ExcludedNodesFromAutoGen { get; set; } = new List(); internal static MenuItem GetStartMenu() { return (MenuItem)(StorePlusConfig.MenuStartPage.Value switch { StartingPage.MainMenu => TheMainMenu, StartingPage.Items => Buyables, StartingPage.Upgrades => Upgrades, StartingPage.Vehicles => Vehicles, StartingPage.Suits => Suits, StartingPage.Packs => Packs, StartingPage.Settings => StoreSettings.Settings, _ => TheMainMenu, }); } internal static void SetToVanilla() { StorePlusMenu.IsMenuEnabled = false; if (!((Object)(object)OriginalStorePage == (Object)null)) { TerminalKeyword val = default(TerminalKeyword); if (DynamicBools.TryGetKeyword("store", ref val)) { val.specialKeywordResult = OriginalStorePage; Loggers.LogDebug("Store keyword set back to original"); } else { Loggers.ERROR("Store keyword has been deleted!!!"); } } } private static void SetKeys() { StorePlusMenu.AddToOtherActions((Key)30, (Action)CompletePurchase); StorePlusMenu.AddToOtherActions((Key)40, (Action)DecreaseItemCount); StorePlusMenu.AddToOtherActions((Key)38, (Action)IncreaseItemCount); } internal static void InitBetterMenu() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown if (!InitOnce) { StorePlusMenu.PageSize = StorePlusConfig.MenuPageSize.Value; ((BetterMenuBase)StorePlusMenu).MainMenu = (MenuItem)(object)TheMainMenu; CustomEvent onExit = StorePlusMenu.OnExit; object obj = <>O.<3>__OnExit; if (obj == null) { Event val = OnExit; <>O.<3>__OnExit = val; obj = (object)val; } onExit.AddListener((Event)obj); CustomEvent onLoad = StorePlusMenu.OnLoad; object obj2 = <>O.<4>__OnAnyPageLoad; if (obj2 == null) { Event val2 = OnAnyPageLoad; <>O.<4>__OnAnyPageLoad = val2; obj2 = (object)val2; } onLoad.AddListener((Event)obj2); CustomEvent acceptAnyKeyEvent = StorePlusMenu.AcceptAnyKeyEvent; object obj3 = <>O.<5>__ReturnToStore; if (obj3 == null) { Event val3 = ReturnToStore; <>O.<5>__ReturnToStore = val3; obj3 = (object)val3; } acceptAnyKeyEvent.AddListener((Event)obj3); ((MenuItem)TheMainMenu).Header = () => "================= Store Plus =================\n\n"; ((MenuItem)TheMainMenu).Footer = GetMainFooter; ((MenuItem)Buyables).Header = () => "================= Items =================\n\n"; ((MenuItem)Buyables).Footer = GetStoreFooter; ((MenuItem)Buyables).SetParentMenu((MenuItem)(object)TheMainMenu); ((MenuItem)Buyables).AdjustNestedMenuList.AddListener((ParameterEvent>)StoreSettings.SortMenu); ((MenuItem)Upgrades).Header = () => "================= Upgrades =================\n\n"; ((MenuItem)Upgrades).Footer = GetStoreFooter; ((MenuItem)Upgrades).SetParentMenu((MenuItem)(object)TheMainMenu); ((MenuItem)Upgrades).AdjustNestedMenuList.AddListener((ParameterEvent>)StoreSettings.SortMenu); ((MenuItem)Vehicles).Header = () => "================= Vehicles =================\n\n"; ((MenuItem)Vehicles).Footer = GetStoreFooter; ((MenuItem)Vehicles).SetParentMenu((MenuItem)(object)TheMainMenu); ((MenuItem)Vehicles).AdjustNestedMenuList.AddListener((ParameterEvent>)StoreSettings.SortMenu); ((MenuItem)Suits).Header = () => "============= Buyable Suits =============\n\n"; ((MenuItem)Suits).Footer = GetStoreFooter; ((MenuItem)Suits).SetParentMenu((MenuItem)(object)TheMainMenu); ((MenuItem)Suits).AdjustNestedMenuList.AddListener((ParameterEvent>)StoreSettings.SortMenu); ((MenuItem)Packs).Header = () => "============= Purchase Packs =============\n\n"; ((MenuItem)Packs).Footer = GetStoreFooter; ((MenuItem)Packs).SetParentMenu((MenuItem)(object)TheMainMenu); ((MenuItem)Packs).AdjustNestedMenuList.AddListener((ParameterEvent>)StoreSettings.SortMenu); ((MenuItem)ExternalMods).Header = () => "============= Other Menus =============\n\n"; ((MenuItem)ExternalMods).Footer = GetOtherFooter; ((MenuItem)ExternalMods).SetParentMenu((MenuItem)(object)TheMainMenu); InitOnce = true; } } internal static string EnterStoreMenu() { StorePlusMenu.ExitAction = null; StorePlusMenu.EnterAtPage(GetStartMenu()); return ""; } internal static void OnAnyPageLoad() { UpdateSubtotal(); Current = ((BetterMenuBase)StorePlusMenu).AllMenuItemsOfType.Cast().FirstOrDefault((StoreMenuItem m) => ((MenuItem)m).IsActive); } internal static void IncreaseItemCount() { Loggers.LogDebug("IncreaseItemCount"); StoreMenuItem storeMenuItem = StorePlusMenu.DisplayMenuItemsOfType.Cast().ElementAtOrDefault(StorePlusMenu.ActiveSelection); if (storeMenuItem != null) { StoreInfo selection = storeMenuItem.StoreItem; int num = (from x in StorePlusMenu.DisplayMenuItemsOfType.OfType() where x.StoreItem.Selected select x).Sum((StoreMenuItem s) => s.StoreItem.SelectionCount) + Plugin.instance.Terminal.orderedItemsFromTerminal.Count; if (selection.Selected && (selection.maxAllowed == 0 || selection.maxAllowed > selection.SelectionCount) && !selection.IsVehicle() && SubTotal + selection.price <= Plugin.instance.Terminal.groupCredits - StoreSettings.Savings && selection.SelectionCount < AllMyTerminalPatches.ConfigGetters.GetMaxItems() && num < AllMyTerminalPatches.ConfigGetters.GetMaxItems() && (!selection.IsPurchasePack || StorePacks.GetBuyablesCountFromNode(selection.terminalNode) < AllMyTerminalPatches.ConfigGetters.GetMaxItems())) { int newCount = selection.SelectionCount + 1; SetCount(ref selection, newCount); } } } internal static void DecreaseItemCount() { Loggers.LogDebug("DecreaseItemCount"); StoreMenuItem storeMenuItem = StorePlusMenu.DisplayMenuItemsOfType.Cast().ElementAtOrDefault(StorePlusMenu.ActiveSelection); if (storeMenuItem != null) { StoreInfo selection = storeMenuItem.StoreItem; if (selection.Selected) { int newCount = selection.SelectionCount - 1; SetCount(ref selection, newCount); } } } internal static void SetCount(ref StoreInfo selection, int newCount) { Loggers.LogDebug($"Original count: {selection.SelectionCount} vs newCount - {newCount}"); selection.SelectionCount = Mathf.Clamp(newCount, 1, 99); UpdateSubtotal(); StorePlusMenu.Load(); } internal static void OnExit() { ResetVars(); } internal static IEnumerator PurchaseResultPage() { yield return (object)new WaitForEndOfFrame(); StorePlusMenu.MenuNode.displayText = GetResultPage(); Plugin.instance.Terminal.PlayTerminalAudioServerRpc(0); yield return (object)new WaitForEndOfFrame(); TerminalEvents.LoadAndSync(StorePlusMenu.MenuNode); yield return (object)new WaitForEndOfFrame(); } internal static int GetSalesPrice(int originalPrice, int itemID, bool isVehicle = false) { if (itemID == -1) { return originalPrice; } if (isVehicle) { itemID = Plugin.instance.Terminal.buyableItemsList.Length + itemID; } if (Plugin.instance.Terminal.itemSalesPercentages.Length < itemID) { return originalPrice; } float num = (float)originalPrice * ((float)Plugin.instance.Terminal.itemSalesPercentages[itemID] / 100f); return (int)num; } internal static int GetSalesPercentage(StoreInfo item) { if (item.terminalNode.buyItemIndex != -1) { return 100 - Plugin.instance.Terminal.itemSalesPercentages[item.terminalNode.buyItemIndex]; } if (item.terminalNode.buyVehicleIndex != -1) { return 100 - Plugin.instance.Terminal.itemSalesPercentages[Plugin.instance.Terminal.buyableItemsList.Length + item.terminalNode.buyVehicleIndex]; } return 0; } internal static string GetResultPage() { StorePlusMenu.AcceptAnything = true; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("\n"); foreach (StoreInfo item in StoreSelection) { if (item.IsPurchasePack) { List itemListFromNode = StorePacks.GetItemListFromNode(item.terminalNode); stringBuilder.Append($"${item.price} [{item.name}] x {item.SelectionCount}\n"); foreach (string item2 in itemListFromNode) { stringBuilder.Append(" " + item2 + "\n"); } } else { stringBuilder.Append($"${item.price} {item.name} x {item.SelectionCount}\n"); } } stringBuilder.Append($"\n\nTotal Value of Purchase: {SubTotal}"); stringBuilder.Append($"\nNew Credits Ammount: {Plugin.instance.Terminal.groupCredits}"); stringBuilder.Append("\n\nPress any key to continue..."); return stringBuilder.ToString(); } internal static string GetMainFooter() { string currentSortText = StoreSettings.CurrentSortText; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append($"\n\nCurrent Selection Total: [ ${SubTotal} ]\n\n"); if (currentSortText.Length > 0) { stringBuilder.Append(currentSortText); } stringBuilder.Append($"Page [LeftArrow] < {StorePlusMenu.CurrentPage}/{Mathf.CeilToInt((float)StorePlusMenu.DisplayMenuItemsOfType.Count / (float)StorePlusMenu.PageSize)} > [RightArrow]\n"); stringBuilder.Append("Select Store Category: [Enter]\n"); stringBuilder.Append("Leave Menu: [BackSpace]\n\n"); return stringBuilder.ToString(); } internal static string GetOtherFooter() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append($"\n\nCurrent Selection Total: [ ${SubTotal} ]\n\n"); stringBuilder.Append($"Page [LeftArrow] < {StorePlusMenu.CurrentPage}/{Mathf.CeilToInt((float)StorePlusMenu.DisplayMenuItemsOfType.Count / (float)StorePlusMenu.PageSize)} > [RightArrow]\n"); stringBuilder.Append("Make Selection: [Enter]\n"); stringBuilder.Append("Back Menu: [BackSpace]\n\n"); return stringBuilder.ToString(); } internal static string GetStoreFooter() { string currentSortText = StoreSettings.CurrentSortText; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append($"\n\nCurrent Selection Total: [ ${SubTotal} ]\n\n"); if (currentSortText.Length > 0) { stringBuilder.Append(currentSortText); } stringBuilder.Append($"Page [LeftArrow] < {StorePlusMenu.CurrentPage}/{Mathf.CeilToInt((float)StorePlusMenu.DisplayMenuItemsOfType.Count / (float)StorePlusMenu.PageSize)} > [RightArrow]\n"); stringBuilder.Append("Decrease Count [Z] / Increase Count [X]\n"); stringBuilder.Append("Add/Remove Item: [Enter] / Complete Purchase: [P]\n"); stringBuilder.Append("Back Menu: [BackSpace]\n\n"); return stringBuilder.ToString(); } internal static int GetProjectedCredits() { return Plugin.instance.Terminal.groupCredits - SubTotal - StoreSettings.Savings; } internal static void UpdateSubtotal() { Loggers.LogDebug("UpdateSubtotal!"); int num = 0; foreach (StoreInfo item in StoreSelection) { num += item.price * item.SelectionCount; } SubTotal = num; } internal static void GetStoreItems() { if (!Commands.TerminalStorePlus.Value) { SetToVanilla(); TerminalEvents.CreateStorePacks(); return; } InitBetterMenu(); StorePlusMenu.IsMenuEnabled = true; StorePlusMenu.ActiveSelection = 0; StorePlusMenu.CurrentPage = 1; SetKeys(); if (Commands.TerminalRefund.Value && !Misc.DoesListHaveInvariant(StorePlusConfig.DontAddToOtherListing, "refund", true)) { new StoreMenuItem("Refund", CommonStringStuff.GetKeywordsPerConfigItem(KeywordConfigs.RefundKeywords.Value)[0] ?? "", (MenuItem)(object)TheMainMenu); } if (Plugin.instance.ITAPI) { InteractiveAPI.AddToStorePlus(); } if (Plugin.instance.TooManyEmotes && !Misc.DoesListHaveInvariant(StorePlusConfig.DontAddToOtherListing, "emote", true)) { StoreMenuItem storeMenuItem = new StoreMenuItem("TooManyEmotes Store", "emote", (MenuItem)(object)ExternalMods); Loggers.LogDebug("Added TooManyEmotes menu item!"); } ManualUpgradeNames.AddRange(new <>z__ReadOnlyArray(new string[4] { "Inverse Teleporter", "Teleporter", "Signal Translator", "Loud Horn" })); List allNodes = LogicHandling.GetAllNodes(); List list = allNodes.FindAll((TerminalNode x) => x.shipUnlockableID > -1); List list2 = allNodes.FindAll((TerminalNode n) => StoreInfo.IsValidItem(n) && StoreInfo.IsItemEnabled(n.buyItemIndex)); List list3 = allNodes.FindAll((TerminalNode n) => n.buyVehicleIndex > -1 && n.creatureFileID == -1 && n.buyItemIndex == -1 && n.buyRerouteToMoon == -1); foreach (TerminalNode node in list) { if (node.itemCost >= 0 && !ExcludedNodesFromAutoGen.Contains(node) && !Utility.IsNullOrWhiteSpace(node.creatureName)) { StoreInfo storeInfo = AllStoreItems.FirstOrDefault((StoreInfo x) => x.name == node.creatureName); if (storeInfo != null) { storeInfo.UpdateNode(node); continue; } storeInfo = new StoreInfo(node); AllStoreItems.Add(storeInfo); } } foreach (TerminalNode node2 in list3) { StoreInfo storeInfo2 = AllStoreItems.FirstOrDefault((StoreInfo v) => v.terminalNode.buyVehicleIndex == node2.buyVehicleIndex); if (storeInfo2 != null) { storeInfo2.UpdateNode(node2); continue; } storeInfo2 = new StoreInfo(node2); AllStoreItems.Add(storeInfo2); } foreach (TerminalNode buyNode in list2) { StoreInfo storeInfo3 = AllStoreItems.FirstOrDefault((StoreInfo y) => y.terminalNode.buyItemIndex == buyNode.buyItemIndex); if (storeInfo3 != null) { storeInfo3.UpdateNode(buyNode); continue; } storeInfo3 = new StoreInfo(buyNode); AllStoreItems.Add(storeInfo3); } Loggers.LogDebug($"AllStoreItems count: {AllStoreItems.Count}"); SortStoreItems(); TerminalEvents.CreateStorePacks(); TerminalKeyword val = default(TerminalKeyword); if (!StorePlusConfig.StorePlusKeywords.Value.Contains("store", StringComparison.InvariantCultureIgnoreCase)) { StoreCommand.RegisterCommand(); StorePlusMenu.MenuNode = StoreCommand.terminalNode; Plugin.Log.LogMessage((object)"StorePlus added without replacing vanilla store!"); } else if (DynamicBools.TryGetKeyword("store", ref val)) { OriginalStorePage = val.specialKeywordResult; StoreCommand.RegisterCommand(false); StorePlusMenu.MenuNode = StoreCommand.terminalNode; StorePlusMenu.MenuNode.displayText = OriginalStorePage.displayText; val.specialKeywordResult = StorePlusMenu.MenuNode; Plugin.Log.LogMessage((object)"Store page replaced with StorePlus page!"); } else { Loggers.ERROR("UNABLE TO GET STORE KEYWORD FOR MENU!\nUNABLE TO GET STORE KEYWORD FOR MENU!\nUNABLE TO GET STORE KEYWORD FOR MENU!"); } } internal static void ResetVars() { CollectionExtensions.DoIf((IEnumerable)AllStoreItems, (Func)((StoreInfo x) => x.Selected || x.SelectionCount > 1), (Action)delegate(StoreInfo x) { x.Reset(); }); StorePlusMenu.AcceptAnything = false; StorePlusMenu.CurrentPage = 1; SubTotal = 0; StoreSelection = new List(); } internal static void ReturnToStore() { ResetVars(); StorePlusMenu.Load(); } internal static void SortStoreItems() { if (AllStoreItems.Count < 1) { return; } foreach (StoreInfo allStoreItem in AllStoreItems) { SortStoreItem(allStoreItem); } StoreSettings.Init(); } private static void SortStoreItem(StoreInfo item) { if (item.IsPurchasePack) { Loggers.LogDebug("Purchase Pack detected @ SortStoreItem: " + item.name); ((MenuItem)item.ThisMenuItem).SetParentMenu((MenuItem)(object)Packs); } else if (item.IsSuit() && item.name.Length > 1) { Loggers.LogDebug("Buyable Suit detected @ SortStoreItem: " + item.name); ((MenuItem)item.ThisMenuItem).SetParentMenu((MenuItem)(object)Suits); } else if (item.IsVehicle()) { Loggers.LogDebug("Buyable Vehicle detected @ SortStoreItem: " + item.name); ((MenuItem)item.ThisMenuItem).SetParentMenu((MenuItem)(object)Vehicles); } else if (!item.WaitForDelivery) { Loggers.LogDebug("Upgrade detected @ SortStoreItem: " + item.name); ((MenuItem)item.ThisMenuItem).SetParentMenu((MenuItem)(object)Upgrades); } else { Loggers.LogDebug("Buyable Item detected @ SortStoreItem: " + item.name); ((MenuItem)item.ThisMenuItem).SetParentMenu((MenuItem)(object)Buyables); } } internal static void CompletePurchase() { if (StorePlusMenu.AcceptAnything) { return; } if (StoreSelection.Count == 0) { Plugin.Log.LogMessage((object)"No items selected to purchase!"); Plugin.instance.Terminal.PlayTerminalAudioServerRpc(1); return; } if (Plugin.instance.Terminal.groupCredits - StoreSettings.Savings < SubTotal) { Plugin.Log.LogMessage((object)"Not enough credits!"); Plugin.instance.Terminal.PlayTerminalAudioServerRpc(1); return; } List dropshipItems = new List(); foreach (StoreInfo item in StoreSelection) { Loggers.LogDebug("storeSelection contains: " + item.name); if (item.IsPurchasePack) { StorePacks.CompletePurchaseV2(item.terminalNode, item.SelectionCount); } else if (item.IsVehicle()) { VehiclePurchase(item); } else if (item.WaitForDelivery && !item.IsPurchasePack) { dropshipItems.Add(item); } else if (item.terminalNode.shipUnlockableID >= 0 && item.terminalNode.shipUnlockableID <= StartOfRound.Instance.unlockablesList.unlockables.Count && !item.IsPurchasePack) { StartOfRound.Instance.BuyShipUnlockableServerRpc(item.terminalNode.shipUnlockableID, Plugin.instance.Terminal.groupCredits - item.price); } } if (dropshipItems.Count > 0) { StoreSelection.RemoveAll((StoreInfo x) => dropshipItems.Contains(x)); DropShipPurchase(ref dropshipItems); StoreSelection.AddRange(dropshipItems); } ((MonoBehaviour)Plugin.instance.Terminal).StartCoroutine(PurchaseResultPage()); } internal static void VehiclePurchase(StoreInfo item) { if (Plugin.instance.Terminal.hasWarrantyTicket) { Plugin.instance.Terminal.BuyVehicleServerRpc(item.terminalNode.buyVehicleIndex, Plugin.instance.Terminal.groupCredits, true); } else { Plugin.instance.Terminal.BuyVehicleServerRpc(item.terminalNode.buyVehicleIndex, Plugin.instance.Terminal.groupCredits - item.price, false); } } internal static void DropShipPurchase(ref List items) { List list = new List(); int num = 0; int num2 = items.Sum((StoreInfo x) => x.SelectionCount); int num3 = 0; if (num2 + list.Count > AllMyTerminalPatches.ConfigGetters.GetMaxItems()) { num3 = num2 + list.Count - AllMyTerminalPatches.ConfigGetters.GetMaxItems(); } Loggers.LogDebug($"Skipping {num3} items from DropShipPurchase!"); for (int num4 = items.Count - 1; num4 >= 0; num4--) { if (items[num4].IsPurchasePack) { Loggers.WARNING("PURCHASE PACK " + items[num4].name + " DETECTED IN REGULAR PURCHASE!!"); continue; } if (num3 > 0 && items.Count - 1 - num3 <= num4) { if (items[num4].SelectionCount <= 1 || items[num4].SelectionCount - num3 <= 0) { num3 -= items[num4].SelectionCount; items.Remove(items[num4]); continue; } items[num4].SelectionCount = items[num4].SelectionCount - num3; num3 = 0; } num += items[num4].price * items[num4].SelectionCount; if (items[num4].SelectionCount > 1) { for (int num5 = 0; num5 < items[num4].SelectionCount; num5++) { list.Add(items[num4].terminalNode.buyItemIndex); } } else { list.Add(items[num4].terminalNode.buyItemIndex); } } Loggers.LogDebug($"Full dropship purchase Count: {list.Count}"); int[] array = list.ToArray(); Plugin.instance.Terminal.BuyItemsServerRpc(array, Plugin.instance.Terminal.groupCredits - num, array.Length + Plugin.instance.Terminal.orderedItemsFromTerminal.Count); } } internal class StoreRefundList { internal static List storeRefundItems = new List(); } internal class StoreRefundItem { internal Item item; internal int count; internal int value; internal StoreRefundItem(Item thing, int number) { item = thing; count = number; } internal void GetValue(Item[] buyables, int num) { value = StorePlus.GetSalesPrice(buyables[num].creditsWorth, num); } } public class StoreSettings { public enum SortingStyle { None, AlphabeticalDown, AlphabeticalUp, PriceDown, PriceUp } [CompilerGenerated] private static class <>O { public static Event <0>__SetSortAbc; public static Event <1>__SetSort123; public static Event <2>__SortNone; public static Event <3>__ToggleSavings; public static Event <4>__ClearSavings; } public static StoreMenuItem Settings = new StoreMenuItem("Settings", showEmpty: true); public static StoreMenuItem SortAbc = new StoreMenuItem("Sort Alphabetically", showEmpty: true); public static StoreMenuItem Sort123 = new StoreMenuItem("Sort By Price", showEmpty: true); public static StoreMenuItem SortNoneMenu = new StoreMenuItem("Remove Sorting", showEmpty: true); public static StoreMenuItem KeepCredsMenu = new StoreMenuItem($"Increase Savings: ${Savings} (5%)", showEmpty: true); public static StoreMenuItem ClearSavingsMenu = new StoreMenuItem("Clear Savings", showEmpty: true); internal static string CurrentSortText = string.Empty; public static int Savings { get { if (StorePlusConfig.DefaultSavings != null) { return StorePlusConfig.DefaultSavings.Value; } return 0; } set { StorePlusConfig.DefaultSavings.Value = value; } } internal static SortingStyle CurrentSort { get; set; } = SortingStyle.None; internal static void Init() { //IL_008a: 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: Expected O, but got Unknown //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown //IL_0135: 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: Expected O, but got Unknown //IL_016e: 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_0179: Expected O, but got Unknown ((MenuItem)Settings).Header = () => "===== StorePlus Settings =====\n\n"; ((MenuItem)Settings).SetParentMenu((MenuItem)(object)StorePlus.TheMainMenu); ((MenuItem)Settings).Footer = delegate { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append($"Currently Sorting by: {CurrentSort}\n"); stringBuilder.Append($"Back Menu: [{StorePlus.StorePlusMenu.leaveMenu}] Toggle Setting: [{StorePlus.StorePlusMenu.selectMenu}]\n\n"); return stringBuilder.ToString(); }; ((MenuItem)SortAbc).SetParentMenu((MenuItem)(object)Settings); CustomEvent selectionEvent = ((MenuItem)SortAbc).SelectionEvent; object obj = <>O.<0>__SetSortAbc; if (obj == null) { Event val = SetSortAbc; <>O.<0>__SetSortAbc = val; obj = (object)val; } selectionEvent.AddListener((Event)obj); ((MenuItem)Sort123).SetParentMenu((MenuItem)(object)Settings); CustomEvent selectionEvent2 = ((MenuItem)Sort123).SelectionEvent; object obj2 = <>O.<1>__SetSort123; if (obj2 == null) { Event val2 = SetSort123; <>O.<1>__SetSort123 = val2; obj2 = (object)val2; } selectionEvent2.AddListener((Event)obj2); ((MenuItem)SortNoneMenu).SetParentMenu((MenuItem)(object)Settings); CustomEvent selectionEvent3 = ((MenuItem)SortNoneMenu).SelectionEvent; object obj3 = <>O.<2>__SortNone; if (obj3 == null) { Event val3 = SortNone; <>O.<2>__SortNone = val3; obj3 = (object)val3; } selectionEvent3.AddListener((Event)obj3); ((MenuItem)KeepCredsMenu).SetParentMenu((MenuItem)(object)Settings); CustomEvent selectionEvent4 = ((MenuItem)KeepCredsMenu).SelectionEvent; object obj4 = <>O.<3>__ToggleSavings; if (obj4 == null) { Event val4 = ToggleSavings; <>O.<3>__ToggleSavings = val4; obj4 = (object)val4; } selectionEvent4.AddListener((Event)obj4); ((MenuItem)ClearSavingsMenu).SetParentMenu((MenuItem)(object)Settings); CustomEvent selectionEvent5 = ((MenuItem)ClearSavingsMenu).SelectionEvent; object obj5 = <>O.<4>__ClearSavings; if (obj5 == null) { Event val5 = ClearSavings; <>O.<4>__ClearSavings = val5; obj5 = (object)val5; } selectionEvent5.AddListener((Event)obj5); CurrentSort = StorePlusConfig.DefaultSortStyle.Value; CurrentSortText = $"Current Sort: {CurrentSort}\n"; } private static void SortNone() { CurrentSort = SortingStyle.None; CurrentSortText = $"Current Sort: {CurrentSort}\n"; } private static void SetSortAbc() { if (CurrentSort == SortingStyle.AlphabeticalDown) { CurrentSort = SortingStyle.AlphabeticalUp; } else if (CurrentSort == SortingStyle.AlphabeticalUp) { CurrentSort = SortingStyle.AlphabeticalDown; } else { CurrentSort = SortingStyle.AlphabeticalDown; } CurrentSortText = $"Current Sort: {CurrentSort}\n"; } private static void SetSort123() { if (CurrentSort == SortingStyle.PriceDown) { CurrentSort = SortingStyle.PriceUp; } else if (CurrentSort == SortingStyle.PriceUp) { CurrentSort = SortingStyle.PriceDown; } else { CurrentSort = SortingStyle.PriceDown; } CurrentSortText = $"Current Sort: [{CurrentSort}]\n\n"; } private static void ToggleSavings() { int num = Plugin.instance.Terminal.groupCredits - StorePlus.SubTotal; int num2 = Convert.ToInt32((float)Plugin.instance.Terminal.groupCredits * 0.05f); if (Savings + num2 <= num) { Savings += num2; ((MenuItem)KeepCredsMenu).Name = $"Increase Savings: ${Savings} (5%)"; } } private static void ClearSavings() { Savings = 0; ((MenuItem)KeepCredsMenu).Name = $"Increase Savings: ${Savings} (5%)"; } internal static void SortMenu(ref List menuItems) { UpdateSorting(CurrentSort, ref menuItems); } internal static void UpdateSorting(SortingStyle style, ref List menuItems) { CurrentSort = style; List list = new List(); switch (style) { case SortingStyle.AlphabeticalUp: list = menuItems.OfType().ToList(); if (list.Count != 0) { menuItems = ((IEnumerable)list.OrderBy((StoreMenuItem x) => ((MenuItem)x).Name)).ToList(); } break; case SortingStyle.AlphabeticalDown: list = menuItems.OfType().ToList(); if (list.Count != 0) { menuItems = ((IEnumerable)list.OrderByDescending((StoreMenuItem x) => ((MenuItem)x).Name)).ToList(); } break; case SortingStyle.PriceUp: list = menuItems.OfType().ToList(); if (list.Count != 0) { menuItems = ((IEnumerable)list.OrderBy((StoreMenuItem x) => x.StoreItem.price)).ToList(); } break; case SortingStyle.PriceDown: list = menuItems.OfType().ToList(); if (list.Count != 0) { menuItems = ((IEnumerable)list.OrderByDescending((StoreMenuItem x) => x.StoreItem.price)).ToList(); } break; case SortingStyle.None: break; } } } } namespace TerminalStuff.Patching { public class AllMyTerminalPatches { public class ConfigGetters { public static int GetMaxItems() { Loggers.LogDebug("GetMaxItems!"); if (Plugin.instance.GenImprovements) { int maxItems = GenImproves.GetMaxItems(); if (maxItems != 12) { QoLConfig.TerminalMaxOrderedItems.Value = maxItems; return maxItems; } } return QoLConfig.TerminalMaxOrderedItems.Value; } public static float GetMaxItemsFloat() { return QoLConfig.TerminalMaxOrderedItems.Value; } } [HarmonyPatch(typeof(Terminal), "ParseWord")] public class ConflictResolution : Terminal { private static void Postfix(string playerWord, ref TerminalKeyword __result) { if (QoLConfig.TerminalConflictResolution.Value) { ConflictRes.InitRes(playerWord, ref __result); } } protected override void __initializeVariables() { ((Terminal)this).__initializeVariables(); } protected override void __initializeRpcs() { ((Terminal)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "ConflictResolution"; } } [HarmonyPatch(typeof(Terminal), "TextPostProcess")] public class CustomReplacements : Terminal { private static void Postfix(TerminalNode node, ref string __result) { if (((Object)node).name == "ViewInsideShipCam 1" && StartOfRound.Instance.inShipPhase && !Plugin.instance.splitViewCreated) { __result = "\n\n\nView monitor is not available in orbit!\n\n"; return; } __result = __result.Replace("[leadingSpace]", " "); __result = __result.Replace("[leadingSpacex4]", " "); if ((Object)(object)StartOfRound.Instance != (Object)null) { if ((Object)(object)StartOfRound.Instance.localPlayerController != (Object)null) { __result = __result.Replace("[thisPlayerName]", StartOfRound.Instance.localPlayerController.playerUsername ?? ""); __result = __result.Replace("[thisPlayerHealth]", $"{StartOfRound.Instance.localPlayerController.health}"); } __result = __result.Replace("[currentPlanetName]", StartOfRound.Instance.currentLevel.PlanetName ?? ""); } __result = __result.Replace("[GetMaxPossibleItems]", $"{ConfigGetters.GetMaxItems()}"); } protected override void __initializeVariables() { ((Terminal)this).__initializeVariables(); } protected override void __initializeRpcs() { ((Terminal)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "CustomReplacements"; } } [HarmonyPatch(typeof(Terminal), "waitUntilFrameEndToSetActive")] public class QuitTerminalPatch : Terminal { [HarmonyPrefix] private static void Prefix(ref bool active) { Loggers.LogDebug("waitUntilFrameEndToSetActive"); if (TerminalStart.AlwaysOnDisplay) { Loggers.LogDebug("alwaysOnDisplay is TRUE"); if (!MoreCommands.keepAlwaysOnDisabled) { active = true; } } } protected override void __initializeVariables() { ((Terminal)this).__initializeVariables(); } protected override void __initializeRpcs() { ((Terminal)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "QuitTerminalPatch"; } } [HarmonyPatch(typeof(Terminal), "BeginUsingTerminal")] [HarmonyPriority(0)] public class BeginUsingTranspiler : Terminal { private static int replacements; [HarmonyTranspiler] private static IEnumerable BeginUsingTerminal_Transpiler(IEnumerable instructions) { Plugin.PatchLog("BeginUsingTerminal Transpiler Initialized"); MethodInfo LoadNewNode = AccessTools.Method("Terminal:LoadNewNode", (Type[])null, (Type[])null); replacements = 0; CollectionExtensions.DoIf(instructions, (Func)((CodeInstruction instruction) => CodeInstructionExtensions.Calls(instruction, LoadNewNode)), (Action)Nothing); return instructions; } private static void Nothing(CodeInstruction instruction) { replacements++; Plugin.PatchLog($"BeginUsingTerminal - Transpiler removed matching instruction\n[ {replacements} ] lines changed"); instruction.opcode = OpCodes.Nop; } protected override void __initializeVariables() { ((Terminal)this).__initializeVariables(); } protected override void __initializeRpcs() { ((Terminal)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "BeginUsingTranspiler"; } } [HarmonyPatch(typeof(Terminal), "BuyItemsServerRpc")] [HarmonyPriority(0)] public class PurchaseLimitPatch1 : Terminal { private static int replacements; [HarmonyTranspiler] private static IEnumerable BuyItemsServerRpc_Transpiler(IEnumerable instructions) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown Plugin.PatchLog("BuyItemsServerRpc Transpiler Initialized"); replacements = 0; CodeInstruction original = new CodeInstruction(OpCodes.Ldc_I4_S, (object)12); CollectionExtensions.DoIf(instructions, (Func)((CodeInstruction instruction) => instruction.opcode == original.opcode), (Action)OrderChange); return instructions; } private static void OrderChange(CodeInstruction instruction) { replacements++; CodeInstruction val = Transpilers.EmitDelegate>((Func)ConfigGetters.GetMaxItems); instruction.opcode = val.opcode; instruction.operand = val.operand; Plugin.PatchLog($"BuyItemsServerRpc - Transpiler success!\n[ {replacements} ] lines changed"); } protected override void __initializeVariables() { ((Terminal)this).__initializeVariables(); } protected override void __initializeRpcs() { ((Terminal)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "PurchaseLimitPatch1"; } } [HarmonyPatch(typeof(Terminal), "LoadNewNodeIfAffordable")] [HarmonyPriority(0)] public class PurchaseLimitPatch2 : Terminal { private static int replacements; [HarmonyTranspiler] private static IEnumerable LoadNewNodeIfAffordable_Transpiler(IEnumerable instructions) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown Plugin.PatchLog("LoadNewNodeIfAffordable Transpiler Initialized"); replacements = 0; CodeInstruction original = new CodeInstruction(OpCodes.Ldc_I4_S, (object)12); CodeInstruction originalfloat = new CodeInstruction(OpCodes.Ldc_R4, (object)12f); CollectionExtensions.DoIf(instructions, (Func)((CodeInstruction x) => x.opcode == original.opcode), (Action)ReplaceInt); CollectionExtensions.DoIf(instructions, (Func)((CodeInstruction x) => x.opcode == originalfloat.opcode), (Action)ReplaceFloat); return instructions; } private static void ReplaceFloat(CodeInstruction instruction) { if (float.TryParse(instruction.operand.ToString(), out var result) && result == 12f) { CodeInstruction val = Transpilers.EmitDelegate>((Func)ConfigGetters.GetMaxItemsFloat); instruction.opcode = val.opcode; instruction.operand = val.operand; replacements++; Plugin.PatchLog($"LoadNewNodeIfAffordable replaced float {result} in favor of maxitems config!\n[ {replacements} ] lines changed"); } } private static void ReplaceInt(CodeInstruction instruction) { if (int.TryParse(instruction.operand.ToString(), out var result) && result == 12) { CodeInstruction val = Transpilers.EmitDelegate>((Func)ConfigGetters.GetMaxItems); instruction.opcode = val.opcode; instruction.operand = val.operand; replacements++; Plugin.PatchLog($"LoadNewNodeIfAffordable replaced int {result} in favor of maxitems config!\n[ {replacements} ] lines changed"); } } protected override void __initializeVariables() { ((Terminal)this).__initializeVariables(); } protected override void __initializeRpcs() { ((Terminal)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "PurchaseLimitPatch2"; } } [HarmonyPatch(typeof(Terminal), "SyncBoughtItemsWithServer")] [HarmonyPriority(0)] public class PurchaseLimitPatch3 : Terminal { private static int replacements; [HarmonyTranspiler] private static IEnumerable SyncBoughtItemsWithServer_Transpiler(IEnumerable instructions) { Plugin.PatchLog("SyncBoughtItemsWithServer Transpiler Initialized"); replacements = 0; CollectionExtensions.DoIf(instructions, (Func)((CodeInstruction x) => x.opcode == OpCodes.Ldc_I4_S), (Action)ReplaceInt); return instructions; } private static void ReplaceInt(CodeInstruction instruction) { if (int.TryParse(instruction.operand.ToString(), out var result) && result == 12) { CodeInstruction val = Transpilers.EmitDelegate>((Func)ConfigGetters.GetMaxItems); instruction.opcode = val.opcode; instruction.operand = val.operand; replacements++; Plugin.PatchLog($"SyncBoughtItemsWithServer replaced {result} in favor of maxitems config!\n[ {replacements} ] lines changed"); } } protected override void __initializeVariables() { ((Terminal)this).__initializeVariables(); } protected override void __initializeRpcs() { ((Terminal)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "PurchaseLimitPatch3"; } } [HarmonyPatch(typeof(Terminal), "ParsePlayerSentence")] [HarmonyPriority(0)] public class PurchaseLimitPatch4 : Terminal { private static int replacements; [HarmonyTranspiler] private static List ParsePlayerSentence_Transpiler(IEnumerable instructions) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown CodeInstruction instruction = Transpilers.EmitDelegate>((Func)ConfigGetters.GetMaxItems); FieldInfo playerDefined = typeof(Terminal).GetField("playerDefinedAmount"); Plugin.PatchLog("ParsePlayerSentence Transpiler Initialized"); replacements = 0; CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val = val.Start(); Loggers.LogDebug($"codeMatcher at Start! {val.Pos}"); val = val.SearchForward((Func)((CodeInstruction x) => CodeInstructionExtensions.StoresField(x, playerDefined))); Loggers.LogDebug($"SearchForward at playerDefined stored! {val.Pos}"); val = val.SearchBack((Func)((CodeInstruction x) => x.opcode == OpCodes.Ldc_I4_S)); Loggers.LogDebug($"SearchBack at Float! {val.Pos}"); val = val.SetInstruction(instruction); replacements++; Plugin.PatchLog($"ParsePlayerSentence patched in favor of maxitems config!\n[ {replacements} ] lines changed"); return val.Instructions(); } protected override void __initializeVariables() { ((Terminal)this).__initializeVariables(); } protected override void __initializeRpcs() { ((Terminal)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "PurchaseLimitPatch4"; } } [HarmonyPatch(typeof(Terminal), "LoadTerminalImage")] public class FixVideoPatch : Terminal { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static EventHandler <>9__4_0; internal void b__4_0(VideoPlayer vp) { OnVideoEnd(); } } internal static bool VideoCheck { get; set; } private static void Postfix(TerminalNode node) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown if (((Object)node).name == "darmuh's videoPlayer" && VideoCheck) { VideoManager.videoPlayerNode = node; if (ViewCommands.isVideoPlaying) { return; } ((Behaviour)Plugin.instance.Terminal.videoPlayer).enabled = true; ((Behaviour)Plugin.instance.Terminal.terminalImage).enabled = true; VideoPlayer videoPlayer = Plugin.instance.Terminal.videoPlayer; object obj = <>c.<>9__4_0; if (obj == null) { EventHandler val = delegate { OnVideoEnd(); }; <>c.<>9__4_0 = val; obj = (object)val; } videoPlayer.loopPointReached += (EventHandler)obj; Plugin.instance.Terminal.videoPlayer.Play(); ViewCommands.isVideoPlaying = true; Loggers.LogInfo("isVideoPlaying set to TRUE"); VideoCheck = false; } else { bool flag = Bools.ShouldEnableImage(node); Loggers.LogDebug($"shouldEnable: {flag}"); if (Object.op_Implicit((Object)(object)Plugin.instance.Terminal.displayingPersistentImage)) { CamEvents.UpdateCamsEvent.Invoke(ViewCommands.ViewMode.Vanilla); Loggers.LogDebug("Vanilla persistent image detected"); } if (!(((Behaviour)Plugin.instance.Terminal.terminalImage).enabled = flag)) { ((Behaviour)Plugin.instance.Terminal.terminalImage).enabled = flag; Loggers.LogDebug($"full screen image set to {flag}"); } } } public static void OnVideoEnd() { if (ViewCommands.isVideoPlaying) { ((Behaviour)Plugin.instance.Terminal.videoPlayer).enabled = false; ((Behaviour)Plugin.instance.Terminal.terminalImage).enabled = false; ViewCommands.isVideoPlaying = false; VideoCheck = false; Loggers.LogInfo("isVideoPlaying set to FALSE"); Plugin.instance.Terminal.videoPlayer.audioOutputMode = (VideoAudioOutputMode)0; Plugin.instance.Terminal.videoPlayer.source = (VideoSource)0; Plugin.instance.Terminal.videoPlayer.aspectRatio = (VideoAspectRatio)2; Plugin.instance.Terminal.videoPlayer.isLooping = true; Plugin.instance.Terminal.videoPlayer.playOnAwake = true; } } protected override void __initializeVariables() { ((Terminal)this).__initializeVariables(); } protected override void __initializeRpcs() { ((Terminal)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "FixVideoPatch"; } } } internal class OtherPatches { [HarmonyPatch(typeof(ManualCameraRenderer), "updateMapTarget")] public class SwitchRadarPatch { public static void Postfix(ManualCameraRenderer __instance, int setRadarTargetIndex) { if (!((Object)(object)__instance != (Object)(object)GameStuff.TerminalMapRenderer)) { Loggers.LogDebug($"updateMapTarget: {setRadarTargetIndex}"); CamEvents.UpdateTarget.Invoke(setRadarTargetIndex); } } } [HarmonyPatch(typeof(ManualCameraRenderer), "MeetsCameraEnabledConditions")] [HarmonyAfter(new string[] { "LethalSponge" })] public class CameraEnabledPatch { public static void Postfix(ManualCameraRenderer __instance, ref bool __result) { if ((Object)(object)__instance == (Object)(object)GameStuff.TerminalMapRenderer && Bools.MapCameraUsed()) { __result = true; } } } [HarmonyPatch(typeof(StartOfRound), "SetMapScreenInfoToCurrentLevel")] public class SetMapScreenInfoPatch { public static void Postfix() { if (Commands.TerminalMoonsPlus.Value) { MoonsPlus.HideLevelFromMapScreen(); } } } [HarmonyPatch(typeof(TimeOfDay), "Awake")] public class TimeAwakePatch { public static void Postfix() { Loggers.LogInfo("TimeAwakePatch"); StartCreds(); } private static void StartCreds() { if (TimeOfDay.Instance.quotaVariables != null && QoLConfig.StartingCreds.Value > -1) { TimeOfDay.Instance.quotaVariables.startingCredits = QoLConfig.StartingCreds.Value; Plugin.Log.LogInfo((object)$"Starting credits modified to {TimeOfDay.Instance.quotaVariables.startingCredits}"); } } } [HarmonyPatch(typeof(HUDManager), "SetClock")] public class ClockTimePatch { public static CustomEvent OnRefreshClock = new CustomEvent(); public static void Postfix() { OnRefreshClock.Invoke(); } } [HarmonyPatch(typeof(FlashlightItem), "Start")] public class Flashlights_Start_Patch { internal static Color? DefaultRegColor { get; private set; } internal static Color? DefaultProColor { get; private set; } public static void Postfix(FlashlightItem __instance) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) Loggers.LogDebug(((GrabbableObject)__instance).itemProperties.itemName + " start!"); if ((!DefaultRegColor.HasValue || !Misc.CompareStringsInvariant(((GrabbableObject)__instance).itemProperties.itemName, "flashlight", true)) && (!DefaultProColor.HasValue || !Misc.CompareStringsInvariant(((GrabbableObject)__instance).itemProperties.itemName, "pro-flashlight", true))) { if (Misc.CompareStringsInvariant(((GrabbableObject)__instance).itemProperties.itemName, "flashlight", true)) { DefaultRegColor = __instance.flashlightBulb.color; } if (Misc.CompareStringsInvariant(((GrabbableObject)__instance).itemProperties.itemName, "pro-flashlight", true)) { DefaultProColor = __instance.flashlightBulb.color; } Loggers.LogDebug("default color has been set for " + ((GrabbableObject)__instance).itemProperties.itemName + "!"); } } } [HarmonyPatch(typeof(FlashlightItem), "SwitchFlashlight")] public class FlashLights_Color_Patch { public static void Postfix(FlashlightItem __instance, bool on) { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) if (!on || (Object)(object)NetHandler.Instance == (Object)null) { return; } if (ColorCommands.RainbowFlash) { NetHandler.Instance.CycleThroughRainbowFlash(); return; } Color val; if (Misc.CompareStringsInvariant(((GrabbableObject)__instance).itemProperties.itemName, "flashlight", true) && Flashlights_Start_Patch.DefaultRegColor.HasValue) { val = Flashlights_Start_Patch.DefaultRegColor.Value; } else if (Misc.CompareStringsInvariant(((GrabbableObject)__instance).itemProperties.itemName, "pro-flashlight", true) && Flashlights_Start_Patch.DefaultProColor.HasValue) { val = Flashlights_Start_Patch.DefaultProColor.Value; } else { val = Color.white; Loggers.LogDebug("Null default values OR Unknown flashlight item [ " + ((GrabbableObject)__instance).itemProperties.itemName + " ]"); } if (Bools.StartIsLocalPlayerNull()) { return; } Loggers.LogDebug($"Color def: {val}\n{((GrabbableObject)__instance).itemProperties.itemName} color: {__instance.flashlightBulb.color}"); if (__instance.flashlightBulb.color == val) { if (!ColorCommands.CustomFlashColor.HasValue) { if (StartOfRound.Instance.localPlayerController.helmetLight.color != val) { NetHandler.Instance.FlashColorRpc(val, StartOfRound.Instance.localPlayerController.playerSteamId); } } else { Loggers.LogDebug("Updating from default flashlight color!"); NetHandler.Instance.FlashColorRpc(ColorCommands.CustomFlashColor.Value, StartOfRound.Instance.localPlayerController.playerSteamId); } } else if (!ColorCommands.CustomFlashColor.HasValue) { NetHandler.Instance.FlashColorRpc(val, StartOfRound.Instance.localPlayerController.playerSteamId); } else if (!(__instance.bulbLight.color == ColorCommands.CustomFlashColor.Value)) { Loggers.LogDebug("Updating to new flashlight color!"); NetHandler.Instance.FlashColorRpc(ColorCommands.CustomFlashColor.Value, StartOfRound.Instance.localPlayerController.playerSteamId); } } } public class LoadGrabbablesOnShip { public static List ItemsOnShip = new List(); public static void LoadAllItems() { ItemsOnShip.Clear(); GameObject val = GameObject.Find("/Environment/HangarShip"); GrabbableObject[] componentsInChildren = val.GetComponentsInChildren(); GrabbableObject[] array = componentsInChildren; foreach (GrabbableObject val2 in array) { ItemsOnShip.Add(val2); Loggers.LogInfo(val2.itemProperties.itemName + " added to list"); } } } } } namespace TerminalStuff.Networking { public class NetHandler : NetworkBehaviour { public static CustomEvent ShipReset = new CustomEvent(); internal bool EndFlashRainbow; internal static TerminalNode NetNode = AddingThings.CreateDummyNode("", true, ""); internal static bool RainbowFlashRoutine = false; internal static NetHandler Instance { get; private set; } = null; [Rpc(/*Could not decode attribute arguments.*/)] internal void SyncNodesRpc(string topRightText, string nodeName, string nodeText, int nodeNumber = -1) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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) //IL_008d: 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_017a: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(752335161u, val3, val, (SendTo)5, (RpcDelivery)0); bool flag = topRightText != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(topRightText, false); } bool flag2 = nodeName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val2)).WriteValueSafe(nodeName, false); } bool flag3 = nodeText != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag3, default(ForPrimitives)); if (flag3) { ((FastBufferWriter)(ref val2)).WriteValueSafe(nodeText, false); } BytePacker.WriteValueBitPacked(val2, nodeNumber); ((NetworkBehaviour)this).__endSendRpc(ref val2, 752335161u, val3, val, (SendTo)5, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; TerminalNode newNode = default(TerminalNode); if (!LogicHandling.TryGetFromAllNodes(nodeName, ref newNode)) { DefaultSync(nodeName, nodeText); Loggers.LogInfo(nodeName + " not matching known nodes. Only displaying text:\n" + nodeText); return; } if (nodeNumber != -1 && nodeNumber <= Commands.GetSpecialCommands().ConvertAll((CommandManager x) => x.VerySpecialNum).Max()) { TerminalNode val4 = StartofHandling.FindViewNode(nodeNumber); if ((Object)(object)val4 == (Object)null) { return; } val4.displayText = ViewCommands.SyncViewNodeWithNum(nodeNumber, nodeText); if (val4.displayText != nodeText) { val4.displayText = nodeText; } Plugin.instance.Terminal.LoadNewNode(val4); Loggers.LogInfo($"Non terminal user: Attempting to load {nodeName}, ViewNode: {nodeNumber}\n {val4.displayText}"); } else if (nodeNumber == 100 && nodeName == "ViewInsideShipCam 1") { if ((Object)(object)TerminalStart.viewMonitorVanilla == (Object)null) { return; } Plugin.instance.Terminal.LoadNewNode(TerminalStart.viewMonitorVanilla); Loggers.LogInfo("Non terminal user: Attempting to load vanilla viewMonitor: " + nodeName); } else { DefaultSync(nodeName, nodeText, newNode); Loggers.LogInfo("Non terminal user: Attempting to load " + nodeName + "'s displayText:\n " + nodeText); } ((TMP_Text)Plugin.instance.Terminal.topRightText).text = topRightText; } private void DefaultSync(string nodeName, string nodeText, TerminalNode newNode = null) { if ((Object)(object)newNode != (Object)null && TerminalStart.vanillaNodes.Contains(newNode)) { MoreCamStuff.CheckVisualPersistance(nodeName); Plugin.instance.Terminal.LoadNewNode(newNode); return; } MoreCamStuff.CheckVisualPersistance(nodeName); NetNode.displayText = nodeText; Plugin.instance.Terminal.LoadNewNode(NetNode); Loggers.LogInfo("Only displaying " + nodeName + " text."); } [Rpc(/*Could not decode attribute arguments.*/)] internal void SyncDropShipRpc(bool isRefund) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1073427572u, val3, val, (SendTo)0, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref isRefund, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val2, 1073427572u, val3, val, (SendTo)0, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; NetworkManager networkManager2 = ((NetworkBehaviour)this).NetworkManager; if (networkManager2.IsHost || networkManager2.IsServer) { if (isRefund) { Loggers.LogInfo("Host received refund command, clearing orderedItems list"); Plugin.instance.Terminal.orderedItemsFromTerminal.Clear(); CostCommands.storeCart.Clear(); } else { Loggers.LogInfo("Host syncing dropship to storeCart after purchase"); int[] itemsOrdered = Plugin.instance.Terminal.orderedItemsFromTerminal.ToArray(); CostCommands.storeCart = Plugin.instance.Terminal.orderedItemsFromTerminal; HostSendItemsToAllRpc(itemsOrdered); } } } [Rpc(/*Could not decode attribute arguments.*/)] internal void SyncMyVideoChoiceToEveryoneRpc(string videoPlaying) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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) //IL_008d: 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_00f1: 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_00c3: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3140711197u, val3, val, (SendTo)6, (RpcDelivery)0); bool flag = videoPlaying != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(videoPlaying, false); } ((NetworkBehaviour)this).__endSendRpc(ref val2, 3140711197u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; VideoManager.currentlyPlaying = videoPlaying; Loggers.LogInfo("currentlyPlaying set to " + videoPlaying); } } [Rpc(/*Could not decode attribute arguments.*/)] internal void GetHostTerminalRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(949222836u, val3, val, (SendTo)0, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendRpc(ref val2, 949222836u, val3, val, (SendTo)0, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; Loggers.LogInfo("Server: Syncing current node from host."); StartofHandling.SyncTerminal(Plugin.instance.Terminal.currentNode); } } } [Rpc(/*Could not decode attribute arguments.*/)] internal void AskHostUpgradeStatusRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(297901110u, val3, val, (SendTo)0, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendRpc(ref val2, 297901110u, val3, val, (SendTo)0, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; foreach (string item in SaveManager.AllUpgradesUnlocked) { UpgradeStatusRpc(item); } } [Rpc(/*Could not decode attribute arguments.*/)] internal void AskHostTravelHistoryRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(426922170u, val3, val, (SendTo)0, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendRpc(ref val2, 426922170u, val3, val, (SendTo)0, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; foreach (string item in MoonsPlus.MoonsVisited) { UpdateTravelHistoryRpc(item); } } [Rpc(/*Could not decode attribute arguments.*/)] internal void UpdateTravelHistoryRpc(string moonName) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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) //IL_008d: 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_00f1: 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_00c3: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1936887197u, val3, val, (SendTo)5, (RpcDelivery)0); bool flag = moonName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(moonName, false); } ((NetworkBehaviour)this).__endSendRpc(ref val2, 1936887197u, val3, val, (SendTo)5, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; if (!MoonsPlus.MoonsVisited.Contains(moonName) && !Bools.GameIsLocalPlayerNull()) { MoonsPlus.MoonsVisited.Add(moonName); if (((NetworkBehaviour)GameNetworkManager.Instance.localPlayerController).IsHost) { SaveManager.SaveTravelHistory(MoonsPlus.MoonsVisited); } Loggers.LogInfo("Client: Adding " + moonName + " to travel history"); MoonsPlus.UpdateMoonTravelHistory(moonName); } } [Rpc(/*Could not decode attribute arguments.*/)] internal void UpgradeStatusRpc(string upgradeName) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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) //IL_008d: 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_00f1: 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_00c3: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1185429889u, val3, val, (SendTo)5, (RpcDelivery)0); bool flag = upgradeName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(upgradeName, false); } ((NetworkBehaviour)this).__endSendRpc(ref val2, 1185429889u, val3, val, (SendTo)5, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!SaveManager.AllUpgradesUnlocked.Contains(upgradeName)) { SaveManager.AllUpgradesUnlocked.Add(upgradeName); } Loggers.LogInfo("Client: Updating " + upgradeName + " upgrade status"); CostCommands.UpdateUnlockStatus(); } } [Rpc(/*Could not decode attribute arguments.*/)] internal void HostSendItemsToAllRpc(int[] itemsOrdered) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3073888062u, val3, val, (SendTo)5, (RpcDelivery)0); bool flag = itemsOrdered != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(itemsOrdered, default(ForPrimitives)); } ((NetworkBehaviour)this).__endSendRpc(ref val2, 3073888062u, val3, val, (SendTo)5, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; NetworkManager networkManager2 = ((NetworkBehaviour)this).NetworkManager; if (!networkManager2.IsHost || !networkManager2.IsServer) { Loggers.LogInfo("Client: Setting storeCart value to host's orderedItemsFromTerminal list"); List storeCart = itemsOrdered.ToList(); CostCommands.storeCart = storeCart; } } } [Rpc(/*Could not decode attribute arguments.*/)] internal void SyncHostCreditsRpc(int newCreds, int items) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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) //IL_0076: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1676513073u, val3, val, (SendTo)0, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, newCreds); BytePacker.WriteValueBitPacked(val2, items); ((NetworkBehaviour)this).__endSendRpc(ref val2, 1676513073u, val3, val, (SendTo)0, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; NetworkManager networkManager2 = ((NetworkBehaviour)this).NetworkManager; if (networkManager2.IsHost || networkManager2.IsServer) { Plugin.instance.Terminal.SyncGroupCreditsServerRpc(newCreds, items); CostCommands.storeCart = Plugin.instance.Terminal.orderedItemsFromTerminal; } } } [Rpc(/*Could not decode attribute arguments.*/)] internal void SyncRadarZoomRpc(float zoom) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3082832897u, val3, val, (SendTo)6, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref zoom, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val2, 3082832897u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; if (ViewCommands.radarZoom != zoom) { ViewCommands.radarZoom = zoom; GameStuff.TerminalMapRenderer.cam.orthographicSize = ViewCommands.radarZoom; Loggers.LogInfo($"Radar Zoom set to {ViewCommands.radarZoom}"); } } } [Rpc(/*Could not decode attribute arguments.*/)] internal void SyncRadarMapRpc(int newTarget) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(581523333u, val3, val, (SendTo)5, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, newTarget); ((NetworkBehaviour)this).__endSendRpc(ref val2, 581523333u, val3, val, (SendTo)5, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; Loggers.LogDebug("SyncRadarMapClientRpc called from another client"); ((MonoBehaviour)GameStuff.TerminalMapRenderer).StartCoroutine(GameStuff.TerminalMapRenderer.updateMapTarget(newTarget, true)); } } } [Rpc(/*Could not decode attribute arguments.*/)] internal void GetHostAlwaysOnStatusRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1641793220u, val3, val, (SendTo)0, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendRpc(ref val2, 1641793220u, val3, val, (SendTo)0, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; AlwaysOnDisplaySyncRpc(TerminalStart.AlwaysOnDisplay); } } } [Rpc(/*Could not decode attribute arguments.*/)] internal void AlwaysOnDisplaySyncRpc(bool aod) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3136794095u, val3, val, (SendTo)6, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref aod, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val2, 3136794095u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; Loggers.LogInfo($"Client: setting alwaysondisplay to {aod}"); TerminalStart.AlwaysOnDisplay = aod; if (!Plugin.instance.Terminal.terminalInUse) { TerminalStart.ToggleScreen(aod); } } } [Rpc(/*Could not decode attribute arguments.*/)] internal void ShipColorAllRpc(Color newColor, string target) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1457716072u, val3, val, (SendTo)6, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref newColor); bool flag = target != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(target, false); } ((NetworkBehaviour)this).__endSendRpc(ref val2, 1457716072u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; ColorCommands.SetLightColors(new List(6) { ColorCommands.FrontLight1, ColorCommands.FrontLight2, ColorCommands.MidLight1, ColorCommands.MidLight2, ColorCommands.BackLight1, ColorCommands.BackLight2 }, newColor); Loggers.LogInfo($"Ship Color change for all lights received. Color: {newColor} Name: {target} "); } } [Rpc(/*Could not decode attribute arguments.*/)] internal void ShipColorFrontRpc(Color newColor, string target) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2241237172u, val3, val, (SendTo)6, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref newColor); bool flag = target != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(target, false); } ((NetworkBehaviour)this).__endSendRpc(ref val2, 2241237172u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; ColorCommands.SetLightColors(new List(2) { ColorCommands.FrontLight1, ColorCommands.FrontLight2 }, newColor); Loggers.LogInfo($"Ship Color change received for front lights. Color: {newColor} Name: {target} "); } } [Rpc(/*Could not decode attribute arguments.*/)] internal void ShipColorMidRpc(Color newColor, string target) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2876618761u, val3, val, (SendTo)6, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref newColor); bool flag = target != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(target, false); } ((NetworkBehaviour)this).__endSendRpc(ref val2, 2876618761u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; ColorCommands.SetLightColors(new List(2) { ColorCommands.MidLight1, ColorCommands.MidLight2 }, newColor); Loggers.LogInfo($"Ship Color change received for middle lights. Color: {newColor} Name: {target} "); } } [Rpc(/*Could not decode attribute arguments.*/)] internal void ShipColorBackRpc(Color newColor, string target) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3153352205u, val3, val, (SendTo)6, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref newColor); bool flag = target != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(target, false); } ((NetworkBehaviour)this).__endSendRpc(ref val2, 3153352205u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; ColorCommands.SetLightColors(new List(2) { ColorCommands.BackLight1, ColorCommands.BackLight2 }, newColor); Loggers.LogInfo($"Ship Color change received for back lights. Color: {newColor} Name: {target} "); } } [Rpc(/*Could not decode attribute arguments.*/)] internal void FlashColorRpc(Color newColor, ulong playerID) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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) //IL_0083: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3550341921u, val3, val, (SendTo)6, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref newColor); BytePacker.WriteValueBitPacked(val2, playerID); ((NetworkBehaviour)this).__endSendRpc(ref val2, 3550341921u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; ulong playerID2 = playerID; PlayerControllerB val4 = ((IEnumerable)StartOfRound.Instance.allPlayerScripts).FirstOrDefault((Func)((PlayerControllerB p) => p.playerSteamId == playerID2)); if ((Object)(object)val4 == (Object)null) { return; } val4.helmetLight.color = newColor; GrabbableObject[] itemSlots = val4.ItemSlots; foreach (GrabbableObject val5 in itemSlots) { FlashlightItem val6 = (FlashlightItem)(object)((val5 is FlashlightItem) ? val5 : null); if (val6 != null) { val6.flashlightBulb.color = newColor; val6.flashlightBulbGlow.color = newColor; } } } internal void CycleThroughRainbowFlash() { if (!RainbowFlashRoutine) { EndFlashRainbow = false; ColorCommands.RainbowFlash = true; Loggers.LogInfo("setting flashlight to rainbow mode!"); ((MonoBehaviour)this).StartCoroutine(RainbowFlashCoroutine()); } } private IEnumerator RainbowFlashCoroutine() { if (RainbowFlashRoutine || Bools.StartIsLocalPlayerNull()) { yield break; } RainbowFlashRoutine = true; Loggers.LogDebug("RainbowFlashCoroutine!"); PlayerControllerB player = StartOfRound.Instance.localPlayerController; GrabbableObject val = player.ItemSlots[player.currentItemSlot]; FlashlightItem flashlight = (FlashlightItem)(object)((val is FlashlightItem) ? val : null); if (flashlight != null) { Item itemProperties = ((GrabbableObject)flashlight).itemProperties; itemProperties.itemName += "(Rainbow)"; while (!player.isPlayerDead && !EndFlashRainbow) { float num = 0.4f; float num2 = Mathf.PingPong(Time.time * num, 1f); Color newColor = Color.HSVToRGB(num2, 1f, 1f); Instance.FlashColorRpc(newColor, player.playerSteamId); yield return (object)new WaitForEndOfFrame(); if (StartOfRound.Instance.allPlayersDead || ((GrabbableObject)flashlight).insertedBattery.empty || !((GrabbableObject)flashlight).isHeld || !ColorCommands.RainbowFlash) { Loggers.LogInfo("ending flashy rainbow"); ((GrabbableObject)flashlight).itemProperties.itemName = ((GrabbableObject)flashlight).itemProperties.itemName.Replace("(Rainbow)", ""); EndFlashRainbow = true; } } } else { Plugin.Log.LogMessage((object)"Rainbow flashlight did not find a valid flashlight item in the player's hand!"); } RainbowFlashRoutine = false; } [Rpc(/*Could not decode attribute arguments.*/)] internal void QuickRestartRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_00cc: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_00e4: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1032089240u, val3, val, (SendTo)6, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendRpc(ref val2, 1032089240u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; GameNetworkManager.Instance.localPlayerController.DropAllHeldItems(true, false, false, false, default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3)); if ((Object)(object)GameNetworkManager.Instance.localPlayerController.currentTriggerInAnimationWith == (Object)(object)Plugin.instance.Terminal.terminalTrigger) { Plugin.instance.Terminal.QuitTerminal(true); } Plugin.instance.Terminal.ClearBoughtItems(); if (((NetworkBehaviour)StartOfRound.Instance).IsServer) { GameNetworkManager.Instance.ResetSavedGameValues(); } StartOfRound.Instance.gameStats.daysSpent = 0; StartOfRound.Instance.gameStats.scrapValueCollected = 0; StartOfRound.Instance.gameStats.deaths = 0; StartOfRound.Instance.gameStats.allStepsTaken = 0; StartOfRound.Instance.ResetShip(); StartOfRound.Instance.currentPlanetPrefab.transform.position = ((Component)StartOfRound.Instance.planetContainer).transform.position; ShipReset.Invoke(); } } private void Awake() { Instance = this; Plugin.Log.LogInfo((object)"Nethandler Spawned!"); } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Expected O, but got Unknown //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Expected O, but got Unknown //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Expected O, but got Unknown //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Expected O, but got Unknown //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Expected O, but got Unknown //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Expected O, but got Unknown //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Expected O, but got Unknown //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(752335161u, new RpcReceiveHandler(__rpc_handler_752335161), "SyncNodesRpc"); ((NetworkBehaviour)this).__registerRpc(1073427572u, new RpcReceiveHandler(__rpc_handler_1073427572), "SyncDropShipRpc"); ((NetworkBehaviour)this).__registerRpc(3140711197u, new RpcReceiveHandler(__rpc_handler_3140711197), "SyncMyVideoChoiceToEveryoneRpc"); ((NetworkBehaviour)this).__registerRpc(949222836u, new RpcReceiveHandler(__rpc_handler_949222836), "GetHostTerminalRpc"); ((NetworkBehaviour)this).__registerRpc(297901110u, new RpcReceiveHandler(__rpc_handler_297901110), "AskHostUpgradeStatusRpc"); ((NetworkBehaviour)this).__registerRpc(426922170u, new RpcReceiveHandler(__rpc_handler_426922170), "AskHostTravelHistoryRpc"); ((NetworkBehaviour)this).__registerRpc(1936887197u, new RpcReceiveHandler(__rpc_handler_1936887197), "UpdateTravelHistoryRpc"); ((NetworkBehaviour)this).__registerRpc(1185429889u, new RpcReceiveHandler(__rpc_handler_1185429889), "UpgradeStatusRpc"); ((NetworkBehaviour)this).__registerRpc(3073888062u, new RpcReceiveHandler(__rpc_handler_3073888062), "HostSendItemsToAllRpc"); ((NetworkBehaviour)this).__registerRpc(1676513073u, new RpcReceiveHandler(__rpc_handler_1676513073), "SyncHostCreditsRpc"); ((NetworkBehaviour)this).__registerRpc(3082832897u, new RpcReceiveHandler(__rpc_handler_3082832897), "SyncRadarZoomRpc"); ((NetworkBehaviour)this).__registerRpc(581523333u, new RpcReceiveHandler(__rpc_handler_581523333), "SyncRadarMapRpc"); ((NetworkBehaviour)this).__registerRpc(1641793220u, new RpcReceiveHandler(__rpc_handler_1641793220), "GetHostAlwaysOnStatusRpc"); ((NetworkBehaviour)this).__registerRpc(3136794095u, new RpcReceiveHandler(__rpc_handler_3136794095), "AlwaysOnDisplaySyncRpc"); ((NetworkBehaviour)this).__registerRpc(1457716072u, new RpcReceiveHandler(__rpc_handler_1457716072), "ShipColorAllRpc"); ((NetworkBehaviour)this).__registerRpc(2241237172u, new RpcReceiveHandler(__rpc_handler_2241237172), "ShipColorFrontRpc"); ((NetworkBehaviour)this).__registerRpc(2876618761u, new RpcReceiveHandler(__rpc_handler_2876618761), "ShipColorMidRpc"); ((NetworkBehaviour)this).__registerRpc(3153352205u, new RpcReceiveHandler(__rpc_handler_3153352205), "ShipColorBackRpc"); ((NetworkBehaviour)this).__registerRpc(3550341921u, new RpcReceiveHandler(__rpc_handler_3550341921), "FlashColorRpc"); ((NetworkBehaviour)this).__registerRpc(1032089240u, new RpcReceiveHandler(__rpc_handler_1032089240), "QuickRestartRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_752335161(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_0104: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string topRightText = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref topRightText, false); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag2, default(ForPrimitives)); string nodeName = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref nodeName, false); } bool flag3 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag3, default(ForPrimitives)); string nodeText = null; if (flag3) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref nodeText, false); } int nodeNumber = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref nodeNumber); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetHandler)(object)target).SyncNodesRpc(topRightText, nodeName, nodeText, nodeNumber); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1073427572(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool isRefund = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref isRefund, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetHandler)(object)target).SyncDropShipRpc(isRefund); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3140711197(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string videoPlaying = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref videoPlaying, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((NetHandler)(object)target).SyncMyVideoChoiceToEveryoneRpc(videoPlaying); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_949222836(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((NetHandler)(object)target).GetHostTerminalRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_297901110(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((NetHandler)(object)target).AskHostUpgradeStatusRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_426922170(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((NetHandler)(object)target).AskHostTravelHistoryRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1936887197(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string moonName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref moonName, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((NetHandler)(object)target).UpdateTravelHistoryRpc(moonName); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1185429889(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string upgradeName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref upgradeName, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((NetHandler)(object)target).UpgradeStatusRpc(upgradeName); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3073888062(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); int[] itemsOrdered = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref itemsOrdered, default(ForPrimitives)); } target.__rpc_exec_stage = (__RpcExecStage)1; ((NetHandler)(object)target).HostSendItemsToAllRpc(itemsOrdered); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1676513073(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0043: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int newCreds = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref newCreds); int items = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref items); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetHandler)(object)target).SyncHostCreditsRpc(newCreds, items); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3082832897(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float zoom = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref zoom, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetHandler)(object)target).SyncRadarZoomRpc(zoom); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_581523333(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int newTarget = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref newTarget); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetHandler)(object)target).SyncRadarMapRpc(newTarget); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1641793220(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((NetHandler)(object)target).GetHostAlwaysOnStatusRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3136794095(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool aod = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref aod, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetHandler)(object)target).AlwaysOnDisplaySyncRpc(aod); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1457716072(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Color newColor = default(Color); ((FastBufferReader)(ref reader)).ReadValueSafe(ref newColor); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string target2 = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref target2, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((NetHandler)(object)target).ShipColorAllRpc(newColor, target2); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2241237172(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Color newColor = default(Color); ((FastBufferReader)(ref reader)).ReadValueSafe(ref newColor); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string target2 = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref target2, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((NetHandler)(object)target).ShipColorFrontRpc(newColor, target2); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2876618761(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Color newColor = default(Color); ((FastBufferReader)(ref reader)).ReadValueSafe(ref newColor); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string target2 = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref target2, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((NetHandler)(object)target).ShipColorMidRpc(newColor, target2); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3153352205(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Color newColor = default(Color); ((FastBufferReader)(ref reader)).ReadValueSafe(ref newColor); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string target2 = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref target2, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((NetHandler)(object)target).ShipColorBackRpc(newColor, target2); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3550341921(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Color newColor = default(Color); ((FastBufferReader)(ref reader)).ReadValueSafe(ref newColor); ulong playerID = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerID); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetHandler)(object)target).FlashColorRpc(newColor, playerID); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1032089240(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((NetHandler)(object)target).QuickRestartRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "NetHandler"; } } } namespace TerminalStuff.MoonsTweaks { public class FilterView { [Flags] public enum DisplayStyle { None = 0, Weather = 1, Price = 2, Difficulty = 4 } public enum SortingStyle { ID_Up, ID_Down, AlphabeticalUp, AlphabeticalDown, PriceUp, PriceDown, WeatherUp, WeatherDown, DifficultyUp, DifficultyDown } public MoonMenuItem MenuItem; public static DisplayStyle Styling; public static SortingStyle Sorting { get { if (MoonsPlusConfig.DefaultSorting == null) { return SortingStyle.ID_Up; } return MoonsPlusConfig.DefaultSorting.Value; } set { MoonsPlusConfig.DefaultSorting.Value = value; } } internal static void DebugFlags() { Loggers.LogDebug($"HasFlag(Weather) {Styling.HasFlag(DisplayStyle.Weather)}"); Loggers.LogDebug($"HasFlag(Difficulty) {Styling.HasFlag(DisplayStyle.Difficulty)}"); Loggers.LogDebug($"HasFlag(Price) {Styling.HasFlag(DisplayStyle.Price)}"); } internal static void SetDefaults(string config) { if (config.Length < 1) { return; } List list = config.Split(',').ToList(); foreach (string item in list) { if (item.Trim().Equals("weather", StringComparison.InvariantCultureIgnoreCase)) { Styling |= DisplayStyle.Weather; } if (item.Trim().Equals("price", StringComparison.InvariantCultureIgnoreCase)) { Styling |= DisplayStyle.Price; } if (item.Trim().Equals("difficulty", StringComparison.InvariantCultureIgnoreCase)) { Styling |= DisplayStyle.Difficulty; } } Loggers.LogMessage($"MoonsPlus Default Styling: {Styling}"); DebugFlags(); } internal static void OrderMenu(ref List menuItems) { if (menuItems.Count != 0) { UpdateSorting(Sorting, ref menuItems); } } internal static void SortByLevelID() { if (Sorting == SortingStyle.ID_Up) { Sorting = SortingStyle.ID_Down; } else { Sorting = SortingStyle.ID_Up; } } internal static void SortByName() { if (Sorting == SortingStyle.AlphabeticalUp) { Sorting = SortingStyle.AlphabeticalDown; } else { Sorting = SortingStyle.AlphabeticalUp; } } internal static void SortByPrice() { if (Sorting == SortingStyle.PriceUp) { Sorting = SortingStyle.PriceDown; } else { Sorting = SortingStyle.PriceUp; } } internal static void SortByWeather() { if (Sorting == SortingStyle.WeatherUp) { Sorting = SortingStyle.WeatherDown; } else { Sorting = SortingStyle.WeatherUp; } } internal static void SortByRisk() { if (Sorting == SortingStyle.DifficultyUp) { Sorting = SortingStyle.DifficultyDown; } else { Sorting = SortingStyle.DifficultyUp; } } internal static void UpdateSorting(SortingStyle style, ref List menuItems) { Sorting = style; List list = new List(); if (MoonsPlus.MoonListing.Count == 0) { return; } list = menuItems.OfType().ToList(); MoonsPlus.HoveredMoon = null; if (list.Count == 0) { return; } MoonMenuItem moonMenuItem = null; if (!string.IsNullOrEmpty(MoonsPlusConfig.ThisAlwaysOnTop.Value)) { moonMenuItem = list.FirstOrDefault((MoonMenuItem x) => Misc.StringContainsInvariant(((MenuItem)x).Name, MoonsPlusConfig.ThisAlwaysOnTop.Value, true)); } if (moonMenuItem != null) { list.Remove(moonMenuItem); } switch (style) { case SortingStyle.ID_Up: { List list4; if (moonMenuItem == null) { list4 = ((IEnumerable)list.OrderBy((MoonMenuItem x) => x.moonInfo.LevelID)).ToList(); } else { list4 = new List(); list4.Add((MenuItem)(object)moonMenuItem); list4.AddRange((IEnumerable)list.OrderBy((MoonMenuItem x) => x.moonInfo.LevelID)); } menuItems = list4; break; } case SortingStyle.ID_Down: { List list6; if (moonMenuItem == null) { list6 = ((IEnumerable)list.OrderByDescending((MoonMenuItem x) => x.moonInfo.LevelID)).ToList(); } else { list6 = new List(); list6.Add((MenuItem)(object)moonMenuItem); list6.AddRange((IEnumerable)list.OrderByDescending((MoonMenuItem x) => x.moonInfo.LevelID)); } menuItems = list6; break; } case SortingStyle.AlphabeticalUp: { List list3; if (moonMenuItem == null) { list3 = ((IEnumerable)list.OrderBy((MoonMenuItem x) => x.moonInfo.LevelName)).ToList(); } else { list3 = new List(); list3.Add((MenuItem)(object)moonMenuItem); list3.AddRange((IEnumerable)list.OrderBy((MoonMenuItem x) => x.moonInfo.LevelName)); } menuItems = list3; break; } case SortingStyle.AlphabeticalDown: { List list11; if (moonMenuItem == null) { list11 = ((IEnumerable)list.OrderByDescending((MoonMenuItem x) => x.moonInfo.LevelName)).ToList(); } else { list11 = new List(); list11.Add((MenuItem)(object)moonMenuItem); list11.AddRange((IEnumerable)list.OrderBy((MoonMenuItem x) => x.moonInfo.LevelName)); } menuItems = list11; break; } case SortingStyle.WeatherUp: { List list9; if (moonMenuItem == null) { list9 = ((IEnumerable)list.OrderBy((MoonMenuItem x) => MoonsPlus.GetWeatherName(x.moonInfo.Level))).ToList(); } else { list9 = new List(); list9.Add((MenuItem)(object)moonMenuItem); list9.AddRange((IEnumerable)list.OrderBy((MoonMenuItem x) => MoonsPlus.GetWeatherName(x.moonInfo.Level))); } menuItems = list9; break; } case SortingStyle.WeatherDown: { List list8; if (moonMenuItem == null) { list8 = ((IEnumerable)list.OrderByDescending((MoonMenuItem x) => MoonsPlus.GetWeatherName(x.moonInfo.Level))).ToList(); } else { list8 = new List(); list8.Add((MenuItem)(object)moonMenuItem); list8.AddRange((IEnumerable)list.OrderByDescending((MoonMenuItem x) => MoonsPlus.GetWeatherName(x.moonInfo.Level))); } menuItems = list8; break; } case SortingStyle.DifficultyUp: { List list5; if (moonMenuItem == null) { list5 = ((IEnumerable)list.OrderBy((MoonMenuItem x) => x.moonInfo.Level.riskLevel)).ToList(); } else { list5 = new List(); list5.Add((MenuItem)(object)moonMenuItem); list5.AddRange((IEnumerable)list.OrderBy((MoonMenuItem x) => x.moonInfo.Level.riskLevel)); } menuItems = list5; break; } case SortingStyle.DifficultyDown: { List list7; if (moonMenuItem == null) { list7 = ((IEnumerable)list.OrderByDescending((MoonMenuItem x) => x.moonInfo.Level.riskLevel)).ToList(); } else { list7 = new List(); list7.Add((MenuItem)(object)moonMenuItem); list7.AddRange((IEnumerable)list.OrderByDescending((MoonMenuItem x) => x.moonInfo.Level.riskLevel)); } menuItems = list7; break; } case SortingStyle.PriceUp: { List list10; if (moonMenuItem == null) { list10 = ((IEnumerable)list.OrderBy((MoonMenuItem x) => x.moonInfo.DisplayPrice)).ToList(); } else { list10 = new List(); list10.Add((MenuItem)(object)moonMenuItem); list10.AddRange((IEnumerable)list.OrderBy((MoonMenuItem x) => x.moonInfo.DisplayPrice)); } menuItems = list10; break; } case SortingStyle.PriceDown: { List list2; if (moonMenuItem == null) { list2 = ((IEnumerable)list.OrderByDescending((MoonMenuItem x) => x.moonInfo.DisplayPrice)).ToList(); } else { list2 = new List(); list2.Add((MenuItem)(object)moonMenuItem); list2.AddRange((IEnumerable)list.OrderByDescending((MoonMenuItem x) => x.moonInfo.DisplayPrice)); } menuItems = list2; break; } } if (MoonsPlus.MoonsPlusMenu.ActiveSelection > 0 && MoonsPlus.MoonsPlusMenu.ActiveSelection < menuItems.Count && menuItems[MoonsPlus.MoonsPlusMenu.ActiveSelection] is MoonMenuItem moonMenuItem2) { MoonsPlus.HoveredMoon = moonMenuItem2?.moonInfo; } MoonsPlus.MoonsPlusMenu.MenuNode.displayVideo = null; if (MoonsPlus.HoveredMoon == null || (Object)(object)MoonsPlus.HoveredMoon.Level.videoReel == (Object)null) { return; } if (MoonsPlus.HoveredMoon.IsHidden && MoonsPlusConfig.ObscureHiddenInfo.Value) { if ((Object)(object)MoonsPlus.HiddenClip != (Object)null) { MoonsPlus.MoonsPlusMenu.MenuNode.displayVideo = MoonsPlus.HiddenClip; } } else { Loggers.LogDebug("Hovered Moon video reel - " + MoonsPlus.HoveredMoon.LevelName); MoonsPlus.MoonsPlusMenu.MenuNode.displayVideo = MoonsPlus.HoveredMoon.Level.videoReel; } } internal static void ToggleGeneric(DisplayStyle flag, out bool isEnabled) { isEnabled = !Styling.HasFlag(flag); if (isEnabled) { Styling |= flag; } else { Styling &= ~flag; } } internal static void ToggleWeatherDisplay() { ToggleGeneric(DisplayStyle.Weather, out var isEnabled); ((MenuItem)MoonsPlus.ToggleWeather).Suffix = " " + MoonsPlus.FilterMenuBools(isEnabled); } internal static void TogglePriceDisplay() { ToggleGeneric(DisplayStyle.Price, out var isEnabled); ((MenuItem)MoonsPlus.TogglePrice).Suffix = " " + MoonsPlus.FilterMenuBools(isEnabled); } internal static void ToggleRiskDisplay() { ToggleGeneric(DisplayStyle.Difficulty, out var isEnabled); ((MenuItem)MoonsPlus.ToggleRisk).Suffix = " " + MoonsPlus.FilterMenuBools(isEnabled); } } public class MoonInfo { public string AdditionalInfo = ""; internal SelectableLevel Level; internal string LevelName = ""; internal int LevelID = -1; internal bool OTP; internal TerminalNode PurchaseNode; internal TerminalNode ResultNode; internal MoonMenuItem MenuItem; private bool company; private bool disabled; private bool isHidden; private bool isLocked; private int priceVal; internal bool IsCompany { get { company = IsThisGordion(); return company; } set { company = value; } } internal bool IsMoonDisabled { get { if (IsCompany) { return false; } bool flag = false; bool flag2 = false; disabled = false; if (!Plugin.instance.NoLevelLoader) { flag = Plugin.instance.DawnLibPresent && (!Plugin.instance.DawnLLLCombo || !Dawnlib.UseLLLInstead()); flag2 = Plugin.instance.LethalLevelLoader && (!Plugin.instance.DawnLLLCombo || Dawnlib.UseLLLInstead()); } if (flag) { disabled = Dawnlib.IsDisabled(Level); } if (flag2) { disabled = LLLCompat.IsDisabled(Level); } if (disabled) { Loggers.LogDebug($"{Level} is disabled by LLL!"); } return disabled; } set { disabled = value; } } internal bool IsHidden { get { if (IsCompany) { return false; } if (Plugin.instance.NoLevelLoader) { isHidden = !Plugin.instance.Terminal.moonsCatalogueList.Contains(Level) && !IsCurrent; } else { bool flag = Plugin.instance.DawnLibPresent && (!Plugin.instance.DawnLLLCombo || !Dawnlib.UseLLLInstead()); bool flag2 = Plugin.instance.LethalLevelLoader && (!Plugin.instance.DawnLLLCombo || Dawnlib.UseLLLInstead()); if (flag) { isHidden = Dawnlib.IsHidden(Level); } if (flag2) { isHidden = LLLCompat.IsHidden(Level); } } Loggers.LogDebug($"{LevelName} IsHidden - {isHidden}"); return isHidden; } set { if (!IsCompany) { isHidden = value; } } } internal bool IsLocked { get { bool flag = false; bool flag2 = false; isLocked = false; if (!Plugin.instance.NoLevelLoader) { flag = Plugin.instance.DawnLibPresent && (!Plugin.instance.DawnLLLCombo || !Dawnlib.UseLLLInstead()); flag2 = Plugin.instance.LethalLevelLoader && (!Plugin.instance.DawnLLLCombo || Dawnlib.UseLLLInstead()); } if (flag) { isLocked = Dawnlib.IsLocked(Level); } if (flag2) { isLocked = LLLCompat.IsLocked(Level); } Loggers.LogDebug($"{LevelName} IsLocked - {isLocked}"); return isLocked; } set { isLocked = value; } } internal bool HaveVisited { get { if ((Object)(object)StartOfRound.Instance == (Object)null) { return false; } return HasVisited(); } set { } } internal bool IsCurrent { get { if ((Object)(object)StartOfRound.Instance == (Object)null) { return false; } return (Object)(object)Level == (Object)(object)StartOfRound.Instance.currentLevel; } set { } } internal int Price { get { if ((Object)(object)StartOfRound.Instance == (Object)null) { return priceVal; } if (NoPrice()) { return priceVal; } priceVal = GetPrice(); return priceVal; } set { priceVal = value; } } internal int DisplayPrice { get { if ((Object)(object)StartOfRound.Instance == (Object)null) { return Price; } if (NoPrice()) { return 0; } return Price; } set { } } internal MoonInfo(SelectableLevel level, List AllNodes) { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown Level = level; LevelID = level.levelID; LevelName = GetNumberless(level.PlanetName); PurchaseNode = ((IEnumerable)AllNodes).FirstOrDefault((Func)((TerminalNode x) => x.displayPlanetInfo == Level.levelID)); ResultNode = ((IEnumerable)AllNodes).FirstOrDefault((Func)((TerminalNode x) => x.buyRerouteToMoon == Level.levelID)); MenuItem = new MoonMenuItem(LevelName); ((MenuItem)MenuItem).SelectionEvent.AddListener(new Event(SelectThisMoon)); ((MenuItem)MenuItem).OnPageLoad = AddToMenuName; MenuItem.moonInfo = this; Loggers.LogDebug("NEW MOONINFO, " + LevelName); } internal void Reload(SelectableLevel level, List AllNodes) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown Level = level; LevelName = GetNumberless(level.PlanetName); PurchaseNode = ((IEnumerable)AllNodes).FirstOrDefault((Func)((TerminalNode x) => x.displayPlanetInfo == Level.levelID)); ResultNode = ((IEnumerable)AllNodes).FirstOrDefault((Func)((TerminalNode x) => x.buyRerouteToMoon == Level.levelID)); if (MenuItem == null) { MenuItem = new MoonMenuItem(LevelName); } ((MenuItem)MenuItem).SelectionEvent.AddListener(new Event(SelectThisMoon)); ((MenuItem)MenuItem).OnPageLoad = AddToMenuName; MenuItem.moonInfo = this; Loggers.LogDebug("RELOAD MOONINFO, " + LevelName); } public void AddToMenuName() { ((MenuItem)MenuItem).Prefix = ""; ((MenuItem)MenuItem).Suffix = ""; if (IsCompany) { ((MenuItem)MenuItem).Name = "Gordion (Company)"; } else if (IsLocked) { ((MenuItem)MenuItem).Name = "[ROUTE LOCKED]"; } else if (IsHidden) { ((MenuItem)MenuItem).Name = "[ ??? ]"; } else { ((MenuItem)MenuItem).Name = LevelName; } if (FilterView.Styling.HasFlag(FilterView.DisplayStyle.Price)) { MoonMenuItem menuItem = MenuItem; ((MenuItem)menuItem).Prefix = ((MenuItem)menuItem).Prefix + $"${DisplayPrice} "; } if (IsCurrent) { MoonMenuItem menuItem2 = MenuItem; ((MenuItem)menuItem2).Prefix = ((MenuItem)menuItem2).Prefix + "<<"; MoonMenuItem menuItem3 = MenuItem; ((MenuItem)menuItem3).Suffix = ((MenuItem)menuItem3).Suffix + ">>"; } if (FilterView.Styling.HasFlag(FilterView.DisplayStyle.Weather) && MoonsPlus.GetWeatherName(Level).Length > 1) { MoonMenuItem menuItem4 = MenuItem; ((MenuItem)menuItem4).Suffix = ((MenuItem)menuItem4).Suffix + " (" + MoonsPlus.GetWeatherName(Level) + ")"; } if (FilterView.Styling.HasFlag(FilterView.DisplayStyle.Difficulty)) { MoonMenuItem menuItem5 = MenuItem; ((MenuItem)menuItem5).Suffix = ((MenuItem)menuItem5).Suffix + " (" + Level.riskLevel + ")"; } if (AdditionalInfo.Length > 0) { MoonMenuItem menuItem6 = MenuItem; ((MenuItem)menuItem6).Suffix = ((MenuItem)menuItem6).Suffix + AdditionalInfo; } if (DisplayPrice <= Plugin.instance.Terminal.groupCredits && MoonsPlusConfig.AffordableColor.Value.Length > 0) { ((MenuItem)MenuItem).Prefix = ((MenuItem)MenuItem).Prefix.Insert(0, ""); MoonMenuItem menuItem7 = MenuItem; ((MenuItem)menuItem7).Suffix = ((MenuItem)menuItem7).Suffix + ""; } if (DisplayPrice > Plugin.instance.Terminal.groupCredits && MoonsPlusConfig.NotEnoughCredsColor.Value.Length > 0) { ((MenuItem)MenuItem).Prefix = ((MenuItem)MenuItem).Prefix.Insert(0, ""); MoonMenuItem menuItem8 = MenuItem; ((MenuItem)menuItem8).Suffix = ((MenuItem)menuItem8).Suffix + ""; } } private static void UnableToTravel(bool inMotion, bool isLanded, bool currentLevel) { if (currentLevel) { Plugin.Log.LogMessage((object)"You are already orbiting this moon!"); Plugin.instance.Terminal.PlayTerminalAudioServerRpc(1); } else if (inMotion) { Plugin.Log.LogMessage((object)"The ship is in motion and cannot change course!"); Plugin.instance.Terminal.PlayTerminalAudioServerRpc(1); } else if (isLanded) { Plugin.Log.LogMessage((object)"The ship is not in orbit!"); Plugin.instance.Terminal.PlayTerminalAudioServerRpc(1); } } internal void SelectThisMoon() { MoonsPlus.MoonsPlusMenu.ExitAction = null; if ((Object)(object)Level == (Object)null) { Loggers.ERROR($"(SelectThisMoon) - Level at Active Moons Selection is NULL! - {MoonsPlus.MoonsPlusMenu.ActiveSelection}"); } else if (StartOfRound.Instance.travellingToNewLevel || !StartOfRound.Instance.inShipPhase || (Object)(object)StartOfRound.Instance.currentLevel == (Object)(object)Level) { UnableToTravel(StartOfRound.Instance.travellingToNewLevel, !StartOfRound.Instance.inShipPhase, (Object)(object)StartOfRound.Instance.currentLevel == (Object)(object)Level); } else if (DisplayPrice > Plugin.instance.Terminal.groupCredits) { Plugin.instance.Terminal.PlayTerminalAudioServerRpc(1); } else if (MoonsPlusConfig.UseVanillaPurchaseNodes.Value && (Object)(object)PurchaseNode != (Object)null) { MoonsPlus.MoonsPlusMenu.ExitAction = delegate { CommonTerminal.LoadNewNode(PurchaseNode); Loggers.LogDebug("Loading vanilla node!"); }; MoonsPlus.MoonsPlusMenu.ExitMenu(true); } else { int num = Plugin.instance.Terminal.groupCredits - DisplayPrice; StartOfRound.Instance.ChangeLevelServerRpc(Level.levelID, num); } } internal void OneTimePurchaseLoadIn() { if (MoonsPlusConfig.OneTimePurchase.Value && HaveVisited) { OTP = true; if ((Object)(object)PurchaseNode != (Object)null) { PurchaseNode.itemCost = 0; } if ((Object)(object)ResultNode != (Object)null) { ResultNode.itemCost = 0; } } } internal bool ShowInListing(bool priceCheck = false, bool weatherCheck = false) { if (IsCurrent) { return true; } if (IsMoonDisabled) { return false; } if (!MoonsPlusConfig.IncludeHidden.Value && IsHidden) { return false; } if (!MoonsPlusConfig.IncludeLocked.Value && IsLocked) { return false; } if (IsHidden && IsLocked) { return false; } if (IsManuallyHidden()) { return false; } if (HasBadWeather(weatherCheck)) { return false; } if (priceCheck && DisplayPrice > Plugin.instance.Terminal.groupCredits) { return false; } return true; } internal bool IsManuallyHidden() { if (MoonsPlusConfig.AlwaysHideList.Value.Length < 1) { Loggers.LogInfo(LevelName + " does not match any configuration entries for AlwaysHideList"); return false; } List keywordsPerConfigItem = CommonStringStuff.GetKeywordsPerConfigItem(MoonsPlusConfig.AlwaysHideList.Value, ','); if (keywordsPerConfigItem.Any((string m) => Misc.CompareStringsInvariant(m, LevelName, true))) { Loggers.LogInfo("Matching moon name found! Hiding " + LevelName); return true; } Loggers.LogInfo(LevelName + " does not match any configuration entries for AlwaysHideList"); return false; } internal bool HasBadWeather(bool weatherCheck) { if (!weatherCheck || MoonsPlus.AcceptableWeathers.Count == 0) { return false; } string currentWeather = MoonsPlus.GetWeatherName(Level); if (currentWeather.Length < 1) { return false; } return MoonsPlus.AcceptableWeathers.Any((string w) => !Misc.CompareStringsInvariant(w, currentWeather, true)); } internal bool IsThisGordion() { if (LevelName == "Gordion" || LevelName == "Company") { LevelName = "Company"; return true; } return false; } internal static string GetNumberless(string name) { return new string(new ReadOnlySpan(name.SkipWhile((char x) => !char.IsLetter(x)).ToArray())); } internal bool NoPrice() { if ((Object)(object)NetHandler.Instance == (Object)null) { return false; } if ((Object)(object)StartOfRound.Instance == (Object)null) { return false; } if (MoonsPlusConfig.OneTimePurchase.Value) { return OTP; } return false; } internal int GetPrice() { bool flag = false; bool flag2 = false; if (!Plugin.instance.NoLevelLoader) { flag = Plugin.instance.DawnLibPresent && (!Plugin.instance.DawnLLLCombo || !Dawnlib.UseLLLInstead()); flag2 = Plugin.instance.LethalLevelLoader && (!Plugin.instance.DawnLLLCombo || Dawnlib.UseLLLInstead()); } if (flag) { return Dawnlib.GetPrice(Level); } if (flag2) { return LLLCompat.GetPrice(Level); } if ((Object)(object)PurchaseNode == (Object)null) { return 0; } return PurchaseNode.itemCost; } internal void UpdateHistory() { if ((Object)(object)NetHandler.Instance == (Object)null) { return; } Loggers.LogDebug(LevelName + " UpdateHistory"); if (!IsDisabled() && MoonsPlusConfig.RevealHiddenOnRoute.Value) { Loggers.LogDebug(LevelName + " Revealing Hidden Route!"); if (IsHidden) { Hide(shouldHide: false); } } } internal bool HasVisited() { bool flag = MoonsPlus.MoonsVisited.Any((string x) => x == LevelName); Loggers.LogDebug($"{LevelName} has been visited = {flag}!!"); return flag; } internal void UpdateInfo() { if ((Object)(object)NetHandler.Instance == (Object)null) { return; } if (!IsCurrent) { if (!IsDisabled() && HaveVisited && IsHidden) { Hide(shouldHide: false); } } else { SaveManager.AddToTravelHistory(this); if (MoonsPlusConfig.OneTimePurchase.Value && !OTP) { OTP = true; } if (!MoonsPlusConfig.RevealHiddenOnRoute.Value) { return; } Hide(shouldHide: false); } Loggers.LogDebug($"===\n{LevelName} ran UpdateInfo:\nHide - {isHidden}\nHaveVisited - {HaveVisited}\n==="); } internal void Hide(bool shouldHide) { if ((Object)(object)NetHandler.Instance == (Object)null) { return; } Loggers.LogDebug("Hiding " + LevelName); if (!Plugin.instance.NoLevelLoader) { bool flag = Plugin.instance.DawnLibPresent && (!Plugin.instance.DawnLLLCombo || !Dawnlib.UseLLLInstead()); bool flag2 = Plugin.instance.LethalLevelLoader && (!Plugin.instance.DawnLLLCombo || Dawnlib.UseLLLInstead()); if (flag) { Dawnlib.ChangeHiddenStatus(Level, shouldHide); return; } if (flag2) { LLLCompat.ChangeHiddenStatus(Level, shouldHide); return; } } List list = Plugin.instance.Terminal.moonsCatalogueList.ToList(); list.Remove(Level); Plugin.instance.Terminal.moonsCatalogueList = list.ToArray(); } internal void UnlockUnhide() { if (!((Object)(object)NetHandler.Instance == (Object)null)) { Loggers.LogDebug("Unlock/Unhide " + LevelName); if (!Plugin.instance.LethalLevelLoader) { Hide(shouldHide: false); } else { LLLCompat.UnlockUnhide(Level); } } } internal bool IsDisabled() { if (IsCurrent) { return false; } if (IsLocked && IsHidden) { return true; } return false; } internal void Reset() { Loggers.LogDebug("Reset called on " + LevelName + "!"); if (OTP) { Loggers.LogDebug($"Setting {LevelName} terminalnodes back to Price - {Price}"); if ((Object)(object)ResultNode != (Object)null) { ResultNode.itemCost = Price; } if ((Object)(object)PurchaseNode != (Object)null) { PurchaseNode.itemCost = Price; } OTP = false; } } internal static bool IsRouteEnabled(TerminalNode query) { return !TerminalStart.RouteKeyword.compatibleNouns.Any((CompatibleNoun x) => (Object)(object)x.result == (Object)(object)query); } } public class MoonMenuItem(string name) : MenuItem((BetterMenuBase)(object)MoonsPlus.MoonsPlusMenu) { [CompilerGenerated] private static class <>O { public static Event <0>__ToggleWeatherDisplay; public static Event <1>__TogglePriceDisplay; public static Event <2>__ToggleRiskDisplay; public static Event <3>__SortByLevelID; public static Event <4>__SortByName; public static Event <5>__SortByPrice; public static Event <6>__SortByWeather; public static Event <7>__SortByRisk; } private string _name = name; private bool _showEmpty = true; private CustomEvent _selection = new CustomEvent(); private List _nested = new List(); public MoonInfo moonInfo; public override string Name { get { return name; } set { name = value; } } public override bool ShowIfEmptyNest { get { return _showEmpty; } set { _showEmpty = value; } } public override CustomEvent SelectionEvent { get { return _selection; } set { _selection = value; } } public override List NestedMenus { get { return _nested; } set { _nested = value; } } public void AddNestedList(List menuList) { if (((MenuItem)this).NestedMenus.Count != 0) { CollectionExtensions.DoIf((IEnumerable)menuList, (Func)((MoonMenuItem m) => !((MenuItem)this).NestedMenus.Any((MenuItem x) => (object)x == m)), (Action)delegate(MoonMenuItem m) { ((MenuItem)m).SetParentMenu((MenuItem)(object)this); }); } else { CollectionExtensions.Do((IEnumerable)menuList, (Action)delegate(MoonMenuItem m) { ((MenuItem)m).SetParentMenu((MenuItem)(object)this); }); } } internal static void CreateFilterMenus() { //IL_0029: 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: Expected O, but got Unknown //IL_0090: 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_009b: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0169: 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_01a2: Expected O, but got Unknown //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Expected O, but got Unknown //IL_0209: 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_0214: Expected O, but got Unknown //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Expected O, but got Unknown MoonsPlus.ToggleWeather = new MoonMenuItem("Show Weather for Moons:"); CustomEvent selectionEvent = ((MenuItem)MoonsPlus.ToggleWeather).SelectionEvent; object obj = <>O.<0>__ToggleWeatherDisplay; if (obj == null) { Event val = FilterView.ToggleWeatherDisplay; <>O.<0>__ToggleWeatherDisplay = val; obj = (object)val; } selectionEvent.AddListener((Event)obj); ((MenuItem)MoonsPlus.ToggleWeather).Suffix = " " + MoonsPlus.FilterMenuBools(FilterView.Styling.HasFlag(FilterView.DisplayStyle.Weather)); MoonsPlus.TogglePrice = new MoonMenuItem("Show Price for Moons:"); CustomEvent selectionEvent2 = ((MenuItem)MoonsPlus.TogglePrice).SelectionEvent; object obj2 = <>O.<1>__TogglePriceDisplay; if (obj2 == null) { Event val2 = FilterView.TogglePriceDisplay; <>O.<1>__TogglePriceDisplay = val2; obj2 = (object)val2; } selectionEvent2.AddListener((Event)obj2); ((MenuItem)MoonsPlus.TogglePrice).Suffix = " " + MoonsPlus.FilterMenuBools(FilterView.Styling.HasFlag(FilterView.DisplayStyle.Price)); MoonsPlus.ToggleRisk = new MoonMenuItem("Show Difficulty for Moons:"); CustomEvent selectionEvent3 = ((MenuItem)MoonsPlus.ToggleRisk).SelectionEvent; object obj3 = <>O.<2>__ToggleRiskDisplay; if (obj3 == null) { Event val3 = FilterView.ToggleRiskDisplay; <>O.<2>__ToggleRiskDisplay = val3; obj3 = (object)val3; } selectionEvent3.AddListener((Event)obj3); ((MenuItem)MoonsPlus.ToggleRisk).Suffix = " " + MoonsPlus.FilterMenuBools(FilterView.Styling.HasFlag(FilterView.DisplayStyle.Difficulty)); MoonsPlus.SortLevelID = new MoonMenuItem("Sort Moons by LevelID"); CustomEvent selectionEvent4 = ((MenuItem)MoonsPlus.SortLevelID).SelectionEvent; object obj4 = <>O.<3>__SortByLevelID; if (obj4 == null) { Event val4 = FilterView.SortByLevelID; <>O.<3>__SortByLevelID = val4; obj4 = (object)val4; } selectionEvent4.AddListener((Event)obj4); MoonsPlus.SortName = new MoonMenuItem("Sort Moons Alphabetically"); CustomEvent selectionEvent5 = ((MenuItem)MoonsPlus.SortName).SelectionEvent; object obj5 = <>O.<4>__SortByName; if (obj5 == null) { Event val5 = FilterView.SortByName; <>O.<4>__SortByName = val5; obj5 = (object)val5; } selectionEvent5.AddListener((Event)obj5); MoonsPlus.SortPrice = new MoonMenuItem("Sort Moons by Price"); CustomEvent selectionEvent6 = ((MenuItem)MoonsPlus.SortPrice).SelectionEvent; object obj6 = <>O.<5>__SortByPrice; if (obj6 == null) { Event val6 = FilterView.SortByPrice; <>O.<5>__SortByPrice = val6; obj6 = (object)val6; } selectionEvent6.AddListener((Event)obj6); MoonsPlus.SortWeather = new MoonMenuItem("Sort Moons by Weather"); CustomEvent selectionEvent7 = ((MenuItem)MoonsPlus.SortWeather).SelectionEvent; object obj7 = <>O.<6>__SortByWeather; if (obj7 == null) { Event val7 = FilterView.SortByWeather; <>O.<6>__SortByWeather = val7; obj7 = (object)val7; } selectionEvent7.AddListener((Event)obj7); MoonsPlus.SortRisk = new MoonMenuItem("Sort Moons by Difficulty"); CustomEvent selectionEvent8 = ((MenuItem)MoonsPlus.SortRisk).SelectionEvent; object obj8 = <>O.<7>__SortByRisk; if (obj8 == null) { Event val8 = FilterView.SortByRisk; <>O.<7>__SortByRisk = val8; obj8 = (object)val8; } selectionEvent8.AddListener((Event)obj8); MoonsPlus.FilterMain.AddNestedList(new List(8) { MoonsPlus.ToggleWeather, MoonsPlus.TogglePrice, MoonsPlus.ToggleRisk, MoonsPlus.SortLevelID, MoonsPlus.SortName, MoonsPlus.SortPrice, MoonsPlus.SortWeather, MoonsPlus.SortRisk }); } } public class MoonsPlus { public enum StartPage { Main, AllMoons, GoodWeatherMoons, AffordableMoons, Settings } [CompilerGenerated] private static class <>O { public static Action <0>__DisableReel; public static Func <1>__GetMoonsFooter; public static Action <2>__AllMoonsOnPageLoad; public static ParameterEvent> <3>__OrderMenu; public static Action <4>__AffordableMoonsOnPageLoad; public static Action <5>__GoodWeatherMoonsOnPageLoad; public static Func <6>__GetFilterFooter; public static Event <7>__DisableReel; } public static CustomEvent> UpdateMoonsDisplayed = new CustomEvent>(); internal static BetterMenu MoonsPlusMenu = new BetterMenu("MoonsPlus", (Dictionary)null); internal static CommandManager MoonsCommand = null; internal static TerminalNode OriginalMoonsPage = null; internal static List AcceptableWeathers = new List(); internal static List MoonsVisited = new List(); internal static List MoonsPurchased = new List(); internal static MoonMenuItem MoonsMainMenu = new MoonMenuItem("MoonsPlus Menu"); internal static MoonMenuItem AllMoons = new MoonMenuItem("All Moons"); internal static MoonMenuItem GoodWeatherMoons = new MoonMenuItem("Favorable Weather Moons"); internal static MoonMenuItem AffordableMoons = new MoonMenuItem("Affordable Moons"); internal static MoonMenuItem FilterMain = new MoonMenuItem("Settings"); internal static AssetBundle HiddenAsset = null; internal static VideoClip HiddenClip = null; internal static MoonInfo? CurrentMoon; internal static MoonInfo? HoveredMoon; internal static bool RunOnce = false; internal static List MoonListing { get; set; } = new List(); internal static MoonMenuItem ToggleWeather { get; set; } = null; internal static MoonMenuItem ToggleRisk { get; set; } = null; internal static MoonMenuItem TogglePrice { get; set; } = null; internal static MoonMenuItem SortLevelID { get; set; } = null; internal static MoonMenuItem SortName { get; set; } = null; internal static MoonMenuItem SortWeather { get; set; } = null; internal static MoonMenuItem SortPrice { get; set; } = null; internal static MoonMenuItem SortRisk { get; set; } = null; public static bool ShowingReel { get; set; } = false; internal static void SetToVanilla() { MoonsPlusMenu.IsMenuEnabled = false; UnloadAssets(); TerminalKeyword val = default(TerminalKeyword); if (!((Object)(object)OriginalMoonsPage == (Object)null) && DynamicBools.TryGetKeyword("moons", ref val)) { val.specialKeywordResult = OriginalMoonsPage; Loggers.LogDebug("Moons keyword set back to original"); } } internal static void LoadAssets() { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown string text = Assembly.GetExecutingAssembly().GetManifestResourceNames().Single((string str) => str.EndsWith("hidden169")); if (string.IsNullOrEmpty(text)) { Loggers.WARNING("Unable to get embedded resource, hidden169!"); return; } Loggers.LogDebug("Found hidden169 @ " + text); if ((Object)(object)HiddenAsset == (Object)null) { HiddenAsset = AssetBundle.LoadFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream(text)); } if ((Object)(object)HiddenClip == (Object)null) { HiddenClip = (VideoClip)HiddenAsset.LoadAsset("hidden169.mp4"); } } internal static void UnloadAssets() { if (!((Object)(object)HiddenAsset == (Object)null)) { HiddenClip = null; HiddenAsset.Unload(true); } } internal static bool IsNodeMoonsPlus(TerminalNode node) { if ((Object)(object)node == (Object)null) { return false; } if ((Object)(object)MoonsPlusMenu.MenuNode == (Object)null) { return false; } return (Object)(object)MoonsPlusMenu.MenuNode == (Object)(object)node; } internal static void SetupBetterMenu() { //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Expected O, but got Unknown if (!RunOnce) { ((BetterMenuBase)MoonsPlusMenu).MainMenu = (MenuItem)(object)MoonsMainMenu; MoonsPlusMenu.PageSize = MoonsPlusConfig.MenuPageSize.Value; ((MenuItem)MoonsMainMenu).Header = () => "============= MoonsPlus Main =============\n\n"; ((MenuItem)MoonsMainMenu).OnPageLoad = DisableReel; ((MenuItem)AllMoons).SetParentMenu((MenuItem)(object)MoonsMainMenu); ((MenuItem)AllMoons).Header = () => "============= Select a Moon =============\n\n"; ((MenuItem)AllMoons).Footer = GetMoonsFooter; ((MenuItem)AllMoons).OnPageLoad = AllMoonsOnPageLoad; ((MenuItem)AllMoons).AdjustNestedMenuList.AddListener((ParameterEvent>)FilterView.OrderMenu); ((MenuItem)AffordableMoons).SetParentMenu((MenuItem)(object)MoonsMainMenu); ((MenuItem)AffordableMoons).Header = () => "============= Select a Moon =============\n\n"; ((MenuItem)AffordableMoons).Footer = GetMoonsFooter; ((MenuItem)AffordableMoons).OnPageLoad = AffordableMoonsOnPageLoad; ((MenuItem)AffordableMoons).AdjustNestedMenuList.AddListener((ParameterEvent>)FilterView.OrderMenu); ((MenuItem)GoodWeatherMoons).SetParentMenu((MenuItem)(object)MoonsMainMenu); ((MenuItem)GoodWeatherMoons).Header = () => "============= Select a Moon =============\n\n"; ((MenuItem)GoodWeatherMoons).Footer = GetMoonsFooter; ((MenuItem)GoodWeatherMoons).OnPageLoad = GoodWeatherMoonsOnPageLoad; ((MenuItem)GoodWeatherMoons).AdjustNestedMenuList.AddListener((ParameterEvent>)FilterView.OrderMenu); ((MenuItem)FilterMain).SetParentMenu((MenuItem)(object)MoonsMainMenu); ((MenuItem)FilterMain).Header = () => "===== Settings =====\n\n"; ((MenuItem)FilterMain).Footer = GetFilterFooter; MoonMenuItem.CreateFilterMenus(); CustomEvent onExit = MoonsPlusMenu.OnExit; object obj = <>O.<7>__DisableReel; if (obj == null) { Event val = DisableReel; <>O.<7>__DisableReel = val; obj = (object)val; } onExit.AddListener((Event)obj); RunOnce = true; } } private static void DisableReel() { MoonsPlusMenu.MenuNode.displayVideo = null; TerminalReelSetDimensions(activeReel: false); } private static void CreateMoonInfos() { List allNodes = LogicHandling.GetAllNodes(); int i; for (i = 0; i < StartOfRound.Instance.levels.Length; i++) { Loggers.LogDebug("MoonsPlusSetup - " + ((Object)StartOfRound.Instance.levels[i]).name); if (!(((Object)StartOfRound.Instance.levels[i]).name == "LiquidationLevel")) { MoonInfo moonInfo = MoonListing.FirstOrDefault((MoonInfo m) => m.LevelID == StartOfRound.Instance.levels[i].levelID); if (moonInfo != null) { moonInfo.Reload(StartOfRound.Instance.levels[i], allNodes); continue; } moonInfo = new MoonInfo(StartOfRound.Instance.levels[i], allNodes); MoonListing.Add(moonInfo); } } SaveManager.InitMoonPlusSave(); } internal static void MoonsPlusSetup() { if (!Commands.TerminalMoonsPlus.Value) { SetToVanilla(); } else if (StartOfRound.Instance.levels.Length != 0) { LoadAssets(); SetupBetterMenu(); MoonsPlusMenu.IsMenuEnabled = true; MoonsPlusMenu.ActiveSelection = 0; MoonsPlusMenu.CurrentPage = 1; CreateMoonInfos(); TerminalKeyword val = default(TerminalKeyword); if (!CommonStringStuff.GetKeywordsPerConfigItem(MoonsPlusConfig.MoonsPlusKeywords.Value).Any((string x) => x.Equals("moons", StringComparison.InvariantCultureIgnoreCase))) { MoonsCommand.RegisterCommand(); MoonsPlusMenu.MenuNode = MoonsCommand.terminalNode; Plugin.Log.LogMessage((object)"MoonsPlus added without replacing vanilla moons page!"); } else if (DynamicBools.TryGetKeyword("moons", ref val)) { OriginalMoonsPage = val.specialKeywordResult; MoonsCommand.RegisterCommand(false); MoonsPlusMenu.MenuNode = MoonsCommand.terminalNode; MoonsPlusMenu.MenuNode.displayText = OriginalMoonsPage.displayText; val.specialKeywordResult = MoonsPlusMenu.MenuNode; Plugin.Log.LogMessage((object)"Moons page replaced with MoonsPlus page!"); } else { Loggers.ERROR("UNABLE TO GET MOONS KEYWORD FOR MENU!\nUNABLE TO GET MOONS KEYWORD FOR MENU!\nUNABLE TO GET MOONS KEYWORD FOR MENU!"); } } } internal static string GetFilterFooter() { //IL_0032: 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) TerminalReelSetDimensions(activeReel: false); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append($"Currently Sorting by: {FilterView.Sorting}\n"); stringBuilder.Append($"Back Menu: [{MoonsPlusMenu.leaveMenu}] Toggle Setting: [{MoonsPlusMenu.selectMenu}]\n\n"); return stringBuilder.ToString(); } internal static string GetMoonsFooter() { CurrentMoon = MoonListing.FirstOrDefault((MoonInfo x) => (Object)(object)x.Level == (Object)(object)StartOfRound.Instance.currentLevel); string text = ((CurrentMoon == null) ? StartOfRound.Instance.currentLevel.PlanetName : ((CurrentMoon.IsHidden && !MoonsPlusConfig.RevealHiddenOnRoute.Value) ? "?????" : ((!CurrentMoon.IsCompany) ? CurrentMoon.Level.PlanetName : "71 Gordion (Company)"))); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("\n\nCurrently Orbiting: " + text + "\n\n"); stringBuilder.Append($"Page [LeftArrow] < {MoonsPlusMenu.CurrentPage}/{Mathf.CeilToInt((float)MoonsPlusMenu.DisplayMenuItemsOfType.Count / (float)MoonsPlusMenu.PageSize)} > [RightArrow]\n"); stringBuilder.Append("Back Menu: [BackSpace] Select Moon: [Enter]\n\n"); return stringBuilder.ToString(); } internal static string GetWeatherName(SelectableLevel level) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) string text = ((!Plugin.instance.WeatherTweaks) ? $"{level.currentWeather}" : WeatherTweaksCompat.GetWeather(level)); if (Misc.StringStartsWithInvariant(text, "none", true)) { text = ""; } Loggers.LogDebug(level.PlanetName + " weather - " + text); return text; } internal static string FilterMenuBools(bool isEnabled) { if (isEnabled) { return "Active"; } return "Disabled"; } internal static string EnterMoonsMenu() { MoonsPlusMenu.ExitAction = null; MoonsPlusMenu.EnterAtPage(GetStartMenu()); return ""; } internal static MenuItem GetStartMenu() { return (MenuItem)(MoonsPlusConfig.MenuStartPage.Value switch { StartPage.Main => MoonsMainMenu, StartPage.AllMoons => AllMoons, StartPage.GoodWeatherMoons => GoodWeatherMoons, StartPage.AffordableMoons => AffordableMoons, StartPage.Settings => FilterMain, _ => MoonsMainMenu, }); } private static void UpdateMoonListing(ref MoonMenuItem Parent, bool price = false, bool weather = false) { ((MenuItem)Parent).NestedMenus = new List(); HoveredMoon = null; foreach (MoonInfo item in MoonListing) { ((MenuItem)item.MenuItem).ShowIfEmptyNest = item.ShowInListing(price, weather); ((MenuItem)Parent).AddNestedItem((MenuItem)(object)item.MenuItem); } List currentList = new List(); CollectionExtensions.DoIf((IEnumerable)MoonListing, (Func)((MoonInfo x) => x.MenuItem.moonInfo != null && ((MenuItem)x.MenuItem).ShowIfEmptyNest), (Action)delegate(MoonInfo x) { currentList.Add(x); }); UpdateMoonsDisplayed.Invoke(currentList); } internal static void AllMoonsOnPageLoad() { UpdateMoonListing(ref AllMoons); } internal static void AffordableMoonsOnPageLoad() { UpdateMoonListing(ref AffordableMoons, price: true); } internal static void GoodWeatherMoonsOnPageLoad() { UpdateMoonListing(ref GoodWeatherMoons, price: false, weather: true); } internal static bool HijackTerminalImage() { if (!MoonsPlusConfig.ShowVideoReels.Value) { Loggers.LogDebug($"Video Reels Disabled! (ShowVideoReels is {MoonsPlusConfig.ShowVideoReels.Value})"); return false; } if ((object)MoonsPlusMenu.CurrentMenuItem == MoonsMainMenu || (object)MoonsPlusMenu.CurrentMenuItem == FilterMain || MoonsPlusMenu.CurrentMenuItem == null) { return false; } if ((Object)(object)MoonsPlusMenu.MenuNode.displayVideo == (Object)null) { return false; } return true; } internal static void TerminalReelSetDimensions(bool activeReel) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) Loggers.LogDebug($"TerminalShowingReel {activeReel}"); if (activeReel) { ((Graphic)Plugin.instance.Terminal.terminalImage).rectTransform.sizeDelta = new Vector2(200f, 150f); ((Graphic)Plugin.instance.Terminal.terminalImage).rectTransform.anchoredPosition = new Vector2(80f, 0f); } else { CamEvents.SetRawImageDimensions(((Graphic)Plugin.instance.Terminal.terminalImage).rectTransform, isFullScreen: true); } ShowingReel = activeReel; } internal static void HideLevelFromMapScreen() { if (MoonsPlusConfig.ObscureHiddenInfo.Value) { MoonInfo moonInfo = MoonListing.FirstOrDefault((MoonInfo x) => (Object)(object)x.Level == (Object)(object)StartOfRound.Instance.currentLevel); if (moonInfo != null && moonInfo.IsHidden) { ((Behaviour)StartOfRound.Instance.screenLevelVideoReel).enabled = false; ((Component)StartOfRound.Instance.screenLevelVideoReel).gameObject.SetActive(false); ((TMP_Text)StartOfRound.Instance.screenLevelDescription).text = "\t????????"; } } } internal static void CheckNodePurchase(TerminalNode node) { MoonInfo moonInfo = MoonListing.FirstOrDefault((MoonInfo x) => (Object)(object)x.ResultNode == (Object)(object)node); if (moonInfo != null) { moonInfo.OTP = true; moonInfo.ResultNode.itemCost = 0; moonInfo.PurchaseNode.itemCost = 0; moonInfo.UpdateInfo(); } } internal static void LobbyClose() { ClearMoonsVisited(); CollectionExtensions.Do((IEnumerable)MoonListing, (Action)delegate(MoonInfo x) { x.Reset(); }); SetToVanilla(); } internal static void ShipReset() { ClearMoonsVisited(); CollectionExtensions.Do((IEnumerable)MoonListing, (Action)delegate(MoonInfo x) { x.Reset(); }); } internal static void UpdateMoonTravelHistory(string levelName) { if (TryGetMoon(levelName, out MoonInfo moon)) { if (MoonsPlusConfig.OneTimePurchase.Value) { moon.OTP = true; } moon.UpdateHistory(); } } internal static List GetTravelHistory() { Loggers.LogDebug("GetTravelHistory"); MoonInfo moonInfo = MoonListing.FirstOrDefault((MoonInfo x) => x.IsCurrent); if (moonInfo != null) { return new List(1) { moonInfo.LevelName }; } return new List(); } internal static void ClearMoonsVisited() { MoonsVisited.Clear(); } public static bool TryGetMoon(string levelName, out MoonInfo moon) { moon = null; if (MoonListing.Count == 0) { return false; } moon = MoonListing.FirstOrDefault((MoonInfo x) => x.LevelName.Equals(levelName, StringComparison.InvariantCultureIgnoreCase)); if (moon == null) { return false; } return true; } public static bool TryGetMoon(SelectableLevel level, out MoonInfo moon) { moon = null; if (MoonListing.Count == 0) { return false; } moon = MoonListing.FirstOrDefault((MoonInfo x) => (Object)(object)x.Level == (Object)(object)level); if (moon == null) { return false; } return true; } public static bool TryGetDisplayMoon(SelectableLevel level, out MoonInfo moon) { moon = null; if (MoonsPlusMenu.DisplayMenuItemsOfType.Count == 0) { return false; } moon = MoonsPlusMenu.DisplayMenuItemsOfType.OfType().FirstOrDefault((MoonMenuItem x) => (Object)(object)x.moonInfo.Level == (Object)(object)level).moonInfo; if (moon == null) { return false; } return true; } } } namespace TerminalStuff.EventSub { internal class GameStuff { private static ManualCameraRenderer? maprenderer; internal static List otherModWords = new List(); internal static ManualCameraRenderer TerminalMapRenderer { get { maprenderer = GetMapRenderer(); return maprenderer; } set { maprenderer = value; } } internal static bool OneTimeOnly { get; set; } = false; internal static void OnGameStart() { CompatibilityCheck(); OneTimeOnly = false; MenuBuild.MoreInit(); } internal static void OnChangeLevel() { Loggers.LogDebug("OnChangeLevel!"); if (Commands.TerminalMoonsPlus.Value) { CollectionExtensions.Do((IEnumerable)MoonsPlus.MoonListing, (Action)delegate(MoonInfo x) { x.UpdateInfo(); }); } } internal static void OnShipReset() { if (Commands.TerminalMoonsPlus.Value) { MoonsPlus.ShipReset(); } SaveManager.ResetUnlocks(); } internal static ManualCameraRenderer GetMapRenderer() { if (Plugin.instance.TwoRadarMapsMod) { return TwoRadarMapsCompatibility.GetTerminalMap(); } return StartOfRound.Instance.mapScreen; } internal static void ResetClockStatus() { if (QoLConfig.TerminalClock.Value) { TerminalClockStuff.SetClockVisible(visible: false); } } internal static void OnNextDay() { ResetClockStatus(); } internal static void OnStartOfRoundStart() { Plugin.instance.splitViewCreated = false; SplitViewChecks.InitSplitViewObjects(); Bools.ResetEnumBools(); TerminalClockStuff.SetClockVisible(visible: false); ViewCommands.CurrentView = ViewCommands.ViewMode.None; } internal static void OnPlayerSpawn() { if (AlwaysOnStuff.screenSettings == null || Bools.StartIsLocalPlayerNull()) { return; } AlwaysOnStuff.screenSettings.Update(QoLConfig.TerminalScreen.Value); if (!AlwaysOnStuff.screenSettings.inUse && (AlwaysOnStuff.screenSettings.AlwaysOn || AlwaysOnStuff.screenSettings.Dynamic)) { Loggers.LogDebug("Enabling screen!"); if (!((Component)Plugin.instance.Terminal.terminalUIScreen).gameObject.activeSelf && StartOfRound.Instance.localPlayerController.isInHangarShipRoom) { ((Component)Plugin.instance.Terminal.terminalUIScreen).gameObject.SetActive(true); } } else { Loggers.LogDebug($"Screen setting set to inUse - {AlwaysOnStuff.screenSettings.inUse} "); } } private static void CompatibilityCheck() { if (StartGame.SoftCompatibility("BMX.LobbyCompatibility", ref Plugin.instance.LobbyCompat)) { Loggers.LogInfo("LobbyCompatibility detected, setting appropriate Lobby Compatibility Level depending on networking status"); BMX_LobbyCompat.SetCompat(ConfigSettings.ModNetworking.Value); } if (StartGame.SoftCompatibility("com.malco.lethalcompany.moreshipupgrades", ref Plugin.instance.LateGameUpgrades)) { Loggers.LogDebug("Lategame Upgrades detected!"); otherModWords.AddRange(new <>z__ReadOnlyArray(new string[14] { "demon", "lookup", "bruteforce", "initattack", "atk", "cd", "cooldown", "lategame", "lgc", "forcecredits", "load", "quantum", "intern", "interns" })); } if (StartGame.SoftCompatibility("mborsh.CruiserTerminal", ref Plugin.instance.CruiserTerm)) { Loggers.LogDebug("CruiserTerminal by mborsh detected!"); Version version = new Version("1.1.0"); if (Misc.GetPluginVersion("mborsh.CruiserTerminal") < version) { Plugin.instance.CruiserTerm = false; Loggers.WARNING("Older CruiserTerminal Mod detected! Compatibility functions are disabled!"); } } if (Plugin.instance.LethalConfig) { LethalConfigSoft.AddButton("Terminal Customization", "Refresh Customizations", "Press this button to refresh all terminal customizations", "Refresh", (Action)TerminalCustomizer.TerminalCustomization); } } } internal class Subscribers { [CompilerGenerated] private static class <>O { public static ParameterEvent <0>__OnTerminalAwake; public static Event <1>__OnTerminalStart; public static Event <2>__OnParseSent; public static Event <3>__OnTerminalBeginUse; public static ParameterEvent <4>__OnLoadNode; public static Event <5>__OnTerminalDisable; public static ParameterEvent <6>__OnLoadAffordable; public static Event <7>__OnTerminalQuit; public static Event <8>__OnSetTerminalInUse; public static Event <9>__OnTerminalKeyPress; public static Event <10>__OnNormalAwake; public static Event <11>__OnInverseAwake; public static Event <12>__OnGameStart; public static Event <13>__OnStartOfRoundStart; public static Event <14>__OnChangeLevel; public static Event <15>__OnShipReset; public static Event <16>__OnNextDay; public static Event <17>__OnPlayerSpawn; public static Event <18>__ClockUpdate; public static Event <19>__PlayerShipChanged; public static Event <20>__IsPlayerDead; public static Event <21>__OnSpecateShipCheck; public static Event <22>__OnNewDisplayText; public static ParameterEvent <23>__OnUpdateCamsEvent; public static ParameterEvent <24>__OnTargetSwitch; } internal static string OriginalOtherText = string.Empty; internal static void Subscribe() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_005f: 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_006a: Expected O, but got Unknown //IL_0084: 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) //IL_008f: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Expected O, but got Unknown //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Expected O, but got Unknown //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Expected O, but got Unknown //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Expected O, but got Unknown //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Expected O, but got Unknown //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Expected O, but got Unknown //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Expected O, but got Unknown //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Expected O, but got Unknown //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Expected O, but got Unknown //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Expected O, but got Unknown //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: 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_02eb: Expected O, but got Unknown //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Expected O, but got Unknown //IL_032a: 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_0335: Expected O, but got Unknown //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Expected O, but got Unknown EventManager.TerminalAwake.AddListener((ParameterEvent)OnTerminalAwake); CustomEvent terminalStart = EventManager.TerminalStart; object obj = <>O.<1>__OnTerminalStart; if (obj == null) { Event val = TerminalStart.OnTerminalStart; <>O.<1>__OnTerminalStart = val; obj = (object)val; } terminalStart.AddListener((Event)obj); TerminalNodeEvent terminalParseSent = EventManager.TerminalParseSent; object obj2 = <>O.<2>__OnParseSent; if (obj2 == null) { Event val2 = TerminalParse.OnParseSent; <>O.<2>__OnParseSent = val2; obj2 = (object)val2; } terminalParseSent.AddListener((Event)obj2); CustomEvent terminalBeginUsing = EventManager.TerminalBeginUsing; object obj3 = <>O.<3>__OnTerminalBeginUse; if (obj3 == null) { Event val3 = TerminalBeginUsing.OnTerminalBeginUse; <>O.<3>__OnTerminalBeginUse = val3; obj3 = (object)val3; } terminalBeginUsing.AddListener((Event)obj3); EventManager.TerminalLoadNewNode.AddListener((ParameterEvent)TerminalGeneral.OnLoadNode); CustomEvent terminalDisable = EventManager.TerminalDisable; object obj4 = <>O.<5>__OnTerminalDisable; if (obj4 == null) { Event val4 = TerminalGeneral.OnTerminalDisable; <>O.<5>__OnTerminalDisable = val4; obj4 = (object)val4; } terminalDisable.AddListener((Event)obj4); EventManager.TerminalLoadIfAffordable.AddListener((ParameterEvent)TerminalGeneral.OnLoadAffordable); CustomEvent terminalQuit = EventManager.TerminalQuit; object obj5 = <>O.<7>__OnTerminalQuit; if (obj5 == null) { Event val5 = TerminalQuit.OnTerminalQuit; <>O.<7>__OnTerminalQuit = val5; obj5 = (object)val5; } terminalQuit.AddListener((Event)obj5); TerminalUpdatePatch.usePatch = true; CustomEvent setTerminalInUse = EventManager.SetTerminalInUse; object obj6 = <>O.<8>__OnSetTerminalInUse; if (obj6 == null) { Event val6 = TerminalGeneral.OnSetTerminalInUse; <>O.<8>__OnSetTerminalInUse = val6; obj6 = (object)val6; } setTerminalInUse.AddListener((Event)obj6); CustomEvent terminalKeyPressed = EventManager.TerminalKeyPressed; object obj7 = <>O.<9>__OnTerminalKeyPress; if (obj7 == null) { Event val7 = TerminalGeneral.OnTerminalKeyPress; <>O.<9>__OnTerminalKeyPress = val7; obj7 = (object)val7; } terminalKeyPressed.AddListener((Event)obj7); CustomEvent normalTPFound = EventManager.NormalTPFound; object obj8 = <>O.<10>__OnNormalAwake; if (obj8 == null) { Event val8 = Teleporters.OnNormalAwake; <>O.<10>__OnNormalAwake = val8; obj8 = (object)val8; } normalTPFound.AddListener((Event)obj8); CustomEvent inverseTPFound = EventManager.InverseTPFound; object obj9 = <>O.<11>__OnInverseAwake; if (obj9 == null) { Event val9 = Teleporters.OnInverseAwake; <>O.<11>__OnInverseAwake = val9; obj9 = (object)val9; } inverseTPFound.AddListener((Event)obj9); CustomEvent gameNetworkManagerStart = EventManager.GameNetworkManagerStart; object obj10 = <>O.<12>__OnGameStart; if (obj10 == null) { Event val10 = GameStuff.OnGameStart; <>O.<12>__OnGameStart = val10; obj10 = (object)val10; } gameNetworkManagerStart.AddListener((Event)obj10); CustomEvent startOfRoundStart = EventManager.StartOfRoundStart; object obj11 = <>O.<13>__OnStartOfRoundStart; if (obj11 == null) { Event val11 = GameStuff.OnStartOfRoundStart; <>O.<13>__OnStartOfRoundStart = val11; obj11 = (object)val11; } startOfRoundStart.AddListener((Event)obj11); CustomEvent startOfRoundChangeLevel = EventManager.StartOfRoundChangeLevel; object obj12 = <>O.<14>__OnChangeLevel; if (obj12 == null) { Event val12 = GameStuff.OnChangeLevel; <>O.<14>__OnChangeLevel = val12; obj12 = (object)val12; } startOfRoundChangeLevel.AddListener((Event)obj12); CustomEvent shipReset = EventManager.ShipReset; object obj13 = <>O.<15>__OnShipReset; if (obj13 == null) { Event val13 = GameStuff.OnShipReset; <>O.<15>__OnShipReset = val13; obj13 = (object)val13; } shipReset.AddListener((Event)obj13); CustomEvent nextDayEvent = EventManager.NextDayEvent; object obj14 = <>O.<16>__OnNextDay; if (obj14 == null) { Event val14 = GameStuff.OnNextDay; <>O.<16>__OnNextDay = val14; obj14 = (object)val14; } nextDayEvent.AddListener((Event)obj14); CustomEvent playerSpawn = EventManager.PlayerSpawn; object obj15 = <>O.<17>__OnPlayerSpawn; if (obj15 == null) { Event val15 = GameStuff.OnPlayerSpawn; <>O.<17>__OnPlayerSpawn = val15; obj15 = (object)val15; } playerSpawn.AddListener((Event)obj15); CustomEvent onRefreshClock = OtherPatches.ClockTimePatch.OnRefreshClock; object obj16 = <>O.<18>__ClockUpdate; if (obj16 == null) { Event val16 = TerminalClockStuff.ClockUpdate; <>O.<18>__ClockUpdate = val16; obj16 = (object)val16; } onRefreshClock.AddListener((Event)obj16); PlayerUpdatePatch.usePatch = true; CustomEvent playerIsInShip = EventManager.PlayerIsInShip; object obj17 = <>O.<19>__PlayerShipChanged; if (obj17 == null) { Event val17 = AlwaysOnStuff.PlayerShipChanged; <>O.<19>__PlayerShipChanged = val17; obj17 = (object)val17; } playerIsInShip.AddListener((Event)obj17); CustomEvent playerIsDead = EventManager.PlayerIsDead; object obj18 = <>O.<20>__IsPlayerDead; if (obj18 == null) { Event val18 = AlwaysOnStuff.IsPlayerDead; <>O.<20>__IsPlayerDead = val18; obj18 = (object)val18; } playerIsDead.AddListener((Event)obj18); CustomEvent specatingPlayerIsInShip = EventManager.SpecatingPlayerIsInShip; object obj19 = <>O.<21>__OnSpecateShipCheck; if (obj19 == null) { Event val19 = AlwaysOnStuff.OnSpecateShipCheck; <>O.<21>__OnSpecateShipCheck = val19; obj19 = (object)val19; } specatingPlayerIsInShip.AddListener((Event)obj19); TerminalNodeEvent getNewDisplayText = EventManager.GetNewDisplayText; object obj20 = <>O.<22>__OnNewDisplayText; if (obj20 == null) { Event val20 = TerminalParse.OnNewDisplayText; <>O.<22>__OnNewDisplayText = val20; obj20 = (object)val20; } getNewDisplayText.AddListener((Event)obj20); CamEvents.UpdateCamsEvent.AddListener((ParameterEvent)CamEvents.OnUpdateCamsEvent); CamEvents.UpdateTarget.AddListener((ParameterEvent)MoreCamStuff.OnTargetSwitch); } internal static void OnTerminalAwake(Terminal instance) { Plugin.instance.Terminal = instance; Loggers.LogInfo("Setting Plugin.instance.Terminal"); CacheDefaultDisplayTexts(); FontStuff.SetCachedDefault(); StuffForLibrary.AddCommands(); if (AlwaysOnStuff.screenSettings == null) { AlwaysOnStuff.screenSettings = new ScreenSettings(QoLConfig.TerminalScreen.Value); } if (Plugin.instance.CruiserTerm) { CruiserTerm.CreateDenyKeyword(); } } internal static void CacheDefaultDisplayTexts() { TerminalKeyword val = default(TerminalKeyword); if (DynamicBools.TryGetKeyword("Other", ref val)) { if (GameStuff.OneTimeOnly) { val.specialKeywordResult.displayText = OriginalOtherText; } else { OriginalOtherText = val.specialKeywordResult.displayText; } } else { Loggers.WARNING("Unable to find other command at awake!"); } } } internal class Teleporters { internal static CommandManager Inverse; internal static CommandManager Regular; internal static void OnInverseAwake() { if (Commands.TerminalITP.Value) { Loggers.LogInfo("InverseTP instance detected, adding keyword"); Inverse.RegisterCommand(); } } internal static void OnNormalAwake() { if (Commands.TerminalTP.Value) { Loggers.LogInfo("NormalTP instance detected, adding keyword"); Regular.RegisterCommand(); } } } internal class TerminalBeginUsing { public static void OnTerminalBeginUse() { Loggers.LogInfo("Start Using Terminal Postfix"); if ((Object)(object)Plugin.instance.Terminal == (Object)null) { Loggers.FATAL("FATAL ERROR: Terminal Instance is NULL"); return; } Plugin.instance.Terminal.screenText.ActivateInputField(); ((Selectable)Plugin.instance.Terminal.screenText).interactable = true; StartUsingTerminalCheck(Plugin.instance.Terminal); if (!Bools.StartIsLocalPlayerNull()) { TerminalEvents.ShouldLockPlayerCamera(value: false, StartOfRound.Instance.localPlayerController); } if ((Object)(object)Plugin.instance.Terminal.currentNode == (Object)null) { if (!((Object)(object)TerminalStart.startNode != (Object)null)) { return; } Loggers.WARNING("WARNING: currentNode is NULL, loading home page node"); Plugin.instance.Terminal.LoadNewNode(TerminalStart.startNode); } List enabledCommands = Commands.GetEnabledCommands(); if (!enabledCommands.Any((CommandManager x) => x.VerySpecialNum != -1 && (Object)(object)Plugin.instance.Terminal.currentNode == (Object)(object)x.terminalNode) && !ViewCommands.isVideoPlaying) { TerminalParse.NetSync(Plugin.instance.Terminal.currentNode); } } internal static void StartUsingTerminalCheck(Terminal instance) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) TerminalNode nextNode = null; if (QoLConfig.TerminalAutoComplete.Value && Plugin.instance.removeTab) { Loggers.LogDebug("tab is disabled to quit terminal"); instance.playerActions.m_Movement_OpenMenu.Disable(); InputAction movement_OpenMenu = instance.playerActions.m_Movement_OpenMenu; InputBinding val = default(InputBinding); ((InputBinding)(ref val)).path = "/tab"; ((InputBinding)(ref val)).overridePath = ""; InputActionRebindingExtensions.ApplyBindingOverride(movement_OpenMenu, val); instance.playerActions.m_Movement_OpenMenu.Enable(); HUDManager.Instance.ChangeControlTip(0, "Quit terminal : [Esc]", true); } if (Commands.TerminalRefund.Value && (Object)(object)NetHandler.Instance != (Object)null) { Loggers.LogDebug("Syncing items between players for refund command"); NetHandler.Instance.SyncDropShipRpc(isRefund: false); } ChooseStartPage(instance, ref nextNode); if (ConfigSettings.NetworkedNodes.Value && !((Object)(object)nextNode == (Object)null)) { Loggers.LogDebug("sending current node to other users"); TerminalParse.NetSync(nextNode); } } internal static void ChooseStartPage(Terminal instance, ref TerminalNode nextNode) { if ((Object)(object)TerminalEvents.terminalSettings.startPage != (Object)null) { MoreCamStuff.CheckVisualPersistance(((Object)TerminalEvents.terminalSettings.startPage).name); Func func = default(Func); if (LogicHandling.TryGetFuncFromTerminalNode(ref TerminalEvents.terminalSettings.startPage, ref func)) { string displayText = func(); Loggers.LogInfo("related function has started for terminal start page!"); TerminalEvents.terminalSettings.startPage.displayText = displayText; } nextNode = TerminalEvents.terminalSettings.startPage; instance.LoadNewNode(TerminalEvents.terminalSettings.startPage); } else if ((Object)(object)Plugin.instance.Terminal.currentNode == (Object)null) { Loggers.WARNING("currentNode is NULL, loading startNode as fail-safe"); instance.LoadNewNode(TerminalStart.startNode); nextNode = TerminalStart.startNode; } else { MoreCamStuff.CheckVisualPersistance(((Object)instance.currentNode).name); } if (TerminalEvents.lastText.Length > 0 && QoLConfig.SaveLastInput.Value) { LogicHandling.SetTerminalInput(TerminalEvents.lastText); } } } internal class TerminalGeneral { internal static TerminalNode lastNodeFormatted = null; internal static bool CancelConfirmation = false; internal static TerminalNode GeneralDummy = AddingThings.CreateDummyNode("", true, ""); internal static void OnTerminalDisable() { Plugin.instance.Terminal.terminalNodes.specialNodes[20] = TerminalStart.switchNodeVanilla; MoonsPlus.LobbyClose(); TerminalEvents.lastText = ""; } internal static void OnLoadNode(TerminalNode node) { Loggers.LogDebug($"CancelConfirmation: {CancelConfirmation}"); if (CancelConfirmation) { CancelConfirmation = false; GeneralDummy.displayText = node.displayText; Plugin.instance.Terminal.LoadNewNode(GeneralDummy); Loggers.LogDebug("Saving terminal user from unnecessary confirmation"); if (StorePacksInfo.AllPacks.Count > 0) { StorePacksInfo.CancelConfirmation(); } } Loggers.LogDebug("Line count: " + Plugin.instance.Terminal.screenText.textComponent.textInfo.lineCount); if (Commands.TerminalMoonsPlus.Value && MoonsPlusConfig.OneTimePurchase.Value) { MoonsPlus.CheckNodePurchase(node); } if (QoLConfig.TerminalInputMaxChars.Value >= 20 && node.maxCharactersToType >= 20) { node.maxCharactersToType = QoLConfig.TerminalInputMaxChars.Value; } if (!(QoLConfig.TerminalFillEmptyText.Value == "nochange") && !((Object)(object)Plugin.instance.Terminal.currentNode == (Object)(object)Plugin.instance.Terminal.terminalNodes.specialNodes[1]) && Plugin.instance.Terminal.screenText.textComponent.textInfo.lineCount < 24 && (Object)(object)node != (Object)(object)lastNodeFormatted) { int spaceToFill = 24 - Plugin.instance.Terminal.screenText.textComponent.textInfo.lineCount; lastNodeFormatted = Plugin.instance.Terminal.currentNode; FillText(QoLConfig.TerminalFillEmptyText.Value, ref lastNodeFormatted, spaceToFill); } } private static void FillText(string formatChoice, ref TerminalNode fixLength, int spaceToFill) { switch (formatChoice) { case "fillbottom": { for (int k = 0; k < spaceToFill; k++) { TerminalNode obj2 = fixLength; obj2.displayText += "\n"; } Loggers.LogDebug("added space to bottom only"); Plugin.instance.Terminal.LoadNewNode(fixLength); Loggers.LogDebug($"added {spaceToFill} lines to displayText, reloading node"); break; } case "textmiddle": { for (int j = 0; j < spaceToFill; j++) { if (j < spaceToFill / 2) { fixLength.displayText = fixLength.displayText.Insert(0, "\n"); continue; } TerminalNode obj = fixLength; obj.displayText += "\n"; } Loggers.LogDebug("pushed text to middle of screen and added space to bottom"); Plugin.instance.Terminal.LoadNewNode(fixLength); Loggers.LogDebug($"added {spaceToFill} lines to displayText, reloading node"); break; } case "textbottom": { for (int i = 0; i < spaceToFill; i++) { fixLength.displayText = fixLength.displayText.Insert(0, "\n"); } Loggers.LogDebug("added space to top only"); Plugin.instance.Terminal.LoadNewNode(fixLength); Loggers.LogDebug($"added {spaceToFill} lines to start of displayText, reloading node"); break; } default: Loggers.LogDebug("invalid FillText formatChoice, returning"); break; } } internal static void OnLoadAffordable(TerminalNode node) { if (Commands.TerminalRefund.Value && !((Object)(object)NetHandler.Instance == (Object)null)) { if ((Object)(object)node == (Object)null) { Loggers.WARNING("WARNING: node is null at OnLoadAffordable, using early return & dropship will not be synced!"); return; } NetHandler.Instance.SyncDropShipRpc(isRefund: false); Loggers.LogDebug($"items: {Plugin.instance.Terminal.orderedItemsFromTerminal.Count}"); } } internal static void OnSetTerminalInUse() { string value = QoLConfig.TerminalLightBehaviour.Value; if (AlwaysOnStuff.screenSettings == null) { AlwaysOnStuff.screenSettings = new ScreenSettings(QoLConfig.TerminalScreen.Value); } if (AlwaysOnStuff.screenSettings.inUse && InUseCheck(StartOfRound.Instance.localPlayerController)) { AlwaysOnStuff.SetScreenPlus(Plugin.instance.Terminal.placeableObject.inUse); Loggers.LogDebug($"OnSetTerminalInUse {Plugin.instance.Terminal.placeableObject.inUse}"); } switch (value) { case "disable": TerminalEvents.ShouldDisableTerminalLight(Plugin.instance.Terminal.placeableObject.inUse, value); break; case "alwayson": TerminalEvents.ShouldDisableTerminalLight(value: false, value); break; } } internal static bool InUseCheck(PlayerControllerB player) { if ((Object)(object)player == (Object)null) { return false; } if ((Object)(object)player.spectatedPlayerScript != (Object)null && player.isPlayerDead) { return player.spectatedPlayerScript.isInHangarShipRoom; } return player.isInHangarShipRoom; } internal static void OnTerminalKeyPress() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (Plugin.instance.Terminal.terminalInUse) { if (Bools.AnyKeyIsPressed() && Bools.ListenForShortCuts()) { ShortcutBindings.HandleKeyPress(ShortcutBindings.keyBeingPressed); } if (QoLConfig.WalkieTerm.Value) { WalkieInTerm.WalkieTerminal(); } } } } public class TerminalParse { internal static TerminalNode OnParseSent(ref TerminalNode node) { if ((Object)(object)node == (Object)null) { return Plugin.instance.Terminal.currentNode; } StartofHandling.FirstCheck(node); if (((Object)node).name.Equals("0_StoreHub") && StorePacksInfo.AllPacks.Count > 0) { GetDynamicCost(); } StartofHandling.HandleParsed(node, ref node); if (node.displayText == null) { return node; } if (!node.displayText.EndsWith("\n")) { TerminalNode obj = node; obj.displayText += "\n\n"; } NetSync(node); return node; } public static void NetSync(TerminalNode node) { if (!ConfigSettings.NetworkedNodes.Value || (Object)(object)NetHandler.Instance == (Object)null) { return; } Loggers.LogInfo("Networked nodes enabled, sending result to server."); if ((Object)(object)node != (Object)null) { if (MoreCamStuff.IsViewNode(node)) { int num = StartofHandling.FindViewInt(node); NetHandler.Instance.SyncNodesRpc(((TMP_Text)Plugin.instance.Terminal.topRightText).text, ((Object)node).name, node.displayText, num); Loggers.LogInfo($"Valid node detected, nNS true & nodeNum: {num}"); } else if (!Plugin.instance.splitViewCreated && node.persistentImage && ((Object)node).name == "ViewInsideShipCam 1") { NetHandler.Instance.SyncNodesRpc(((TMP_Text)Plugin.instance.Terminal.topRightText).text, ((Object)node).name, node.displayText, 100); Loggers.LogInfo("Valid node detected, nNS true & nodeNum: 100 (vanilla view monitor)"); } else { NetHandler.Instance.SyncNodesRpc(((TMP_Text)Plugin.instance.Terminal.topRightText).text, ((Object)node).name, node.displayText); Loggers.LogInfo("Valid node detected, nNS true, no nodeNum set"); } } else { Loggers.LogDebug("attempting to sync node with other clients over the network"); } } internal static void GetDynamicCost() { foreach (StorePacks allPack in StorePacksInfo.AllPacks) { allPack.commandManager.terminalNode.itemCost = StorePacks.GetPriceFromNode(allPack.terminalNode); Loggers.LogDebug($"Updating price for {allPack.Name} to {allPack.commandManager.terminalNode.itemCost}"); } } internal static TerminalNode OnNewDisplayText(ref TerminalNode node) { Loggers.LogDebug("newdisplaytext event!"); if (Plugin.instance.CruiserTerm) { StartofHandling.ParseCruiserTerm(ref node); } TerminalNode query = node; StorePacks storePacks = StorePacksInfo.AllPacks.FirstOrDefault((StorePacks x) => (Object)(object)x.terminalNode == (Object)(object)query); if (storePacks != null) { node.itemCost = 0; Loggers.LogInfo("Updating currentPackList"); TerminalNode val = node; StorePacksInfo.Selected = storePacks; if (node.creatureName != string.Empty) { StorePacksInfo.CurrentPackName = node.creatureName; } } return node; } } internal class TerminalQuit { internal static void OnTerminalQuit() { if (QoLConfig.SaveLastInput.Value && (Object)(object)Plugin.instance.Terminal.currentNode != (Object)null && ((Object)Plugin.instance.Terminal.currentNode).name != "TerminalQuit") { TerminalEvents.lastText = CommonStringStuff.GetCleanedScreenText(Plugin.instance.Terminal); Loggers.LogDebug("grabbed lastText"); } if (!Bools.StartIsLocalPlayerNull()) { TerminalEvents.ShouldLockPlayerCamera(value: true, StartOfRound.Instance.localPlayerController); } if (!TerminalStart.AlwaysOnDisplay || AlwaysOnStuff.screenSettings.inUse) { HandleRegularQuit(); } } internal static void OBCTerminalCameraStatus(bool status) { if (!status) { if (Plugin.instance.suitsTerminal) { if (SuitsTerminalCompatibility.CheckForSuitsMenu()) { OpenBodyCamFuncs.TerminalCameraStatus(status); return; } OpenBodyCamFuncs.TerminalMirrorStatus(status); OpenBodyCamFuncs.TerminalCameraStatus(status); } else { OpenBodyCamFuncs.TerminalMirrorStatus(status); OpenBodyCamFuncs.TerminalCameraStatus(status); } } else if (ViewCommands.CurrentView == ViewCommands.ViewMode.Mirror) { OpenBodyCamFuncs.TerminalMirrorStatus(status); } else { OpenBodyCamFuncs.TerminalCameraStatus(status); } } private static void HandleRegularQuit() { if (ViewCommands.AnyActiveMonitoring() || ViewCommands.CurrentView == ViewCommands.ViewMode.Mirror) { Loggers.LogInfo("Leaving terminal and disabling any active cameras"); SplitViewChecks.ShowCameraView(state: false); } } } public class TerminalStart { internal static bool AlwaysOnDisplay = false; internal static List vanillaNodes = new List(); internal static TerminalNode viewMonitorVanilla = null; internal static TerminalNode switchNodeVanilla = null; internal static TerminalKeyword RouteKeyword = null; internal static bool delayStartEnum = false; public static TerminalNode startNode { get; internal set; } = null; public static TerminalNode helpNode { get; internal set; } = null; internal static void OnTerminalStart() { TerminalStartGroup(); TerminalStartGroupDelay(); } internal static void TerminalStartGroup() { Loggers.LogInfo("Upgrading terminal with my stuff, smile."); OtherModWords(); OverWriteTextNodes(); VanillaNodesCache(); TerminalClockStuff.MakeClock(); ShortcutBindings.InitSavedShortcuts(); TerminalCustomizer.TerminalCustomization(); SaveManager.InitUnlocks(); StorePlus.GetStoreItems(); } private static void OtherModWords() { if (Plugin.instance.ITAPI) { InteractiveAPI.GetITAPIWords(); } } private static void OverWriteTextNodes() { Loggers.LogInfo("updating displaytext for help"); helpNode = Plugin.instance.Terminal.terminalNodes.specialNodes.ToArray()[13]; Plugin.instance.Terminal.terminalNodes.specialNodes[4].displayText = Plugin.instance.Terminal.terminalNodes.specialNodes[4].displayText.Replace("12", "[GetMaxPossibleItems]"); if (!GameStuff.OneTimeOnly) { string displayText = helpNode.displayText; string displayText2 = displayText.Replace("To see the list of moons the autopilot can route to.", "List of moons the autopilot can route to.").Replace("To see the company store's selection of useful items.", "Company store's selection of useful items."); Plugin.instance.Terminal.terminalNodes.specialNodes.ToArray()[13].displayText = displayText2; Loggers.LogDebug("~~~~~~~~~~~~~~~~~~~~~~~~~~~~ HELP MODIFIED ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); GameStuff.OneTimeOnly = true; } AddingThings.AddKeywordToExistingNode("home", Plugin.instance.Terminal.terminalNodes.specialNodes.ToArray()[1], true); } internal static void VanillaNodesCache() { vanillaNodes.Clear(); TerminalKeyword val = default(TerminalKeyword); if (DynamicBools.TryGetKeyword("store", ref val)) { TerminalNode specialKeywordResult = val.specialKeywordResult; vanillaNodes.Add(specialKeywordResult); Loggers.LogDebug("storeNode cached"); } TerminalKeyword val2 = default(TerminalKeyword); if (DynamicBools.TryGetKeyword("moons", ref val2)) { TerminalNode specialKeywordResult2 = val2.specialKeywordResult; vanillaNodes.Add(specialKeywordResult2); Loggers.LogDebug("moonsNode cached"); } TerminalKeyword val3 = default(TerminalKeyword); if (DynamicBools.TryGetKeyword("bestiary", ref val3)) { TerminalNode specialKeywordResult3 = val3.specialKeywordResult; vanillaNodes.Add(specialKeywordResult3); Loggers.LogDebug("bestiaryNode cached"); } if (DynamicBools.TryGetKeyword("route", ref RouteKeyword)) { Loggers.LogDebug("routeKeyword grabbed!"); } if (!Plugin.instance.splitViewCreated) { Loggers.LogDebug("Trying to cache vanilla view monitor"); if (LogicHandling.TryGetFromAllNodes("ViewInsideShipCam 1", ref viewMonitorVanilla)) { vanillaNodes.Add(viewMonitorVanilla); Loggers.LogDebug("cached vanilla view monitor!"); } } } internal static void TerminalStartGroupDelay() { Loggers.LogInfo("Starting TerminalDelayStartEnumerator"); ((MonoBehaviour)Plugin.instance.Terminal).StartCoroutine(TerminalDelayStartEnumerator()); } internal static IEnumerator TerminalDelayStartEnumerator() { if (!delayStartEnum) { delayStartEnum = true; yield return (object)new WaitForSeconds(1f); MenuBuild.CreateDarmuhsTerminalStuffMenus(); Loggers.LogInfo("1 Second delay methods starting."); CamEvents.UpdateCamsEvent.Invoke(ViewCommands.ViewMode.None); ViewCommands.isVideoPlaying = false; AlwaysOnStart(Plugin.instance.Terminal, startNode); MoonsPlus.MoonsPlusSetup(); yield return (object)new WaitForSeconds(0.1f); ((TMP_Text)Plugin.instance.Terminal.topRightText).text = $"${Plugin.instance.Terminal.groupCredits}"; StartCheck(Plugin.instance.Terminal, startNode); DebugShowInfo(); delayStartEnum = false; } } public static void ToggleScreen(bool status) { CommonTerminal.ToggleScreen(status); } internal static void InitiateTerminalStuff() { if (!((Object)(object)Plugin.instance.Terminal == (Object)null)) { TerminalEvents.terminalSettings.StartPage(QoLConfig.TerminalStartPage.Value); } } private static void AlwaysOnStart(Terminal thisterm, TerminalNode startNode) { if (AlwaysOnStuff.screenSettings.AlwaysOn && !AlwaysOnStuff.screenSettings.inUse) { Loggers.LogDebug("Setting AlwaysOn Display."); if (ConfigSettings.NetworkedNodes.Value && ConfigSettings.ModNetworking.Value) { Loggers.LogDebug("network nodes enabled, syncing alwayson status"); NetHandler.Instance.AlwaysOnDisplaySyncRpc(aod: true); } else { AlwaysOnDisplay = true; ToggleScreen(status: true); thisterm.LoadNewNode(startNode); } if (QoLConfig.TerminalLightBehaviour.Value == "alwayson") { TerminalEvents.ShouldDisableTerminalLight(value: false, "alwayson"); } } } private static void StartCheck(Terminal thisterm, TerminalNode startNode) { if (!Bools.GameIsLocalPlayerNull()) { if ((Object)(object)startNode == (Object)null) { startNode = Plugin.instance.Terminal.terminalNodes.specialNodes.ToArray()[13]; } if ((Object)(object)NetHandler.Instance == (Object)null || !ConfigSettings.NetworkedNodes.Value) { Loggers.LogDebug("Networking disabled, returning..."); thisterm.LoadNewNode(startNode); } else if (((NetworkBehaviour)GameNetworkManager.Instance.localPlayerController).IsHost) { GameStuff.TerminalMapRenderer.SwitchRadarTargetAndSync(0); NetHandler.Instance.SyncRadarZoomRpc(QoLConfig.TerminalRadarDefaultZoom.Value); thisterm.LoadNewNode(startNode); StartofHandling.CheckNetNode(startNode); } else { ((MonoBehaviour)Plugin.instance.Terminal).StartCoroutine(ClientStuffDelayed()); } } } private static IEnumerator ClientStuffDelayed() { yield return (object)new WaitForSeconds(1f); Loggers.LogDebug("------------ CLIENT JUST LOADED --------------"); Loggers.LogDebug("grabbing node from host"); Loggers.LogDebug("------------ CLIENT JUST LOADED --------------"); NetHandler.Instance.GetHostTerminalRpc(); } private static void DebugShowInfo() { Loggers.LogDebug($"Terminal Keywords Count: {Plugin.instance.Terminal.terminalNodes.allKeywords.Length}"); Loggers.LogDebug($"Plugin.Allnodes: {Plugin.Allnodes.Count}"); Loggers.LogDebug($"Commands.AllCommands: {Commands.AllCommands.Count}"); Loggers.LogDebug("------------------------ end of darmuh's debug info ------------------------"); } } } namespace TerminalStuff.SpecialStuff { public class StorePlusConfig { internal static List DontAddToOtherListing = new List(); internal static List HideItemListing = new List(); public static ConfigEntry StorePlusKeywords { get; internal set; } = null; public static ConfigEntry AffordableColor { get; internal set; } = null; public static ConfigEntry NotEnoughCredsColor { get; internal set; } = null; public static ConfigEntry RespectStoreRotation { get; internal set; } = null; public static ConfigEntry DontAddToOther { get; internal set; } = null; public static ConfigEntry MenuStartPage { get; set; } = null; public static ConfigEntry MenuPageSize { get; internal set; } = null; public static ConfigEntry HideFromStorePlus { get; internal set; } = null; public static ConfigEntry DefaultSortStyle { get; internal set; } = null; public static ConfigEntry DefaultSavings { get; internal set; } = null; internal static void Init() { StorePlusKeywords = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "StorePlus", "StorePlusKeywords", "store; shop", "This semi-colon separated list is all keywords that can be used in terminal to return command"); AffordableColor = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "StorePlus", "AffordableColor", "#00ab66", "The color of store items that you can afford"); NotEnoughCredsColor = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "StorePlus", "NotEnoughCredsColor", "#b22222", "The color of store items that you CANNOT afford"); RespectStoreRotation = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "StorePlus", "RespectStoreRotation", false, "Enable this if you want to respect the vanilla store rotation and not allow for purchasing all furniture/suits at all times"); DontAddToOther = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "StorePlus", "DontAddToOther", "othermenu,constellations", "Comma-separated list of external mod menu keywords that should NOT be added to the other list.\nThe keyword is the word that you would type to enter the other mod's menu"); MenuStartPage = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "StorePlus", "MenuStartPage", StorePlus.StartingPage.MainMenu, "The menu that will open when first running the moons command."); MenuPageSize = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "StorePlus", "MenuPageSize", 10, "The amount of menu items to display per page of this menu.\nNote: Anything over 10 will enable automated scrolling (beta)", 3, 30); DefaultSortStyle = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "StorePlus", "DefaultSortingStyle", StoreSettings.SortingStyle.AlphabeticalDown, "Set the default StorePlus setting for sorting store menu items"); DefaultSavings = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "StorePlus", "DefaultSavings", 0, "Set your default savings value here."); HideFromStorePlus = ConfigSetup.MakeGeneric(((BaseUnityPlugin)Plugin.instance).Config, "StorePlus", "HideFromStorePlus", "", "Comma-separated list of shop items that will be hidden from the StorePlus menu.\nThe names listed here are compared to the terminal node's \"creature name\"\nNOTE: These items will NOT be disabled completely"); Loggers.LogDebug("StorePlus configs done!"); UpdateLists(); } internal static void UpdateLists() { DontAddToOtherListing = CommonStringStuff.GetKeywordsPerConfigItem(DontAddToOther.Value, ','); string item = "skippedFirstEntryLol"; List keywordsPerConfigItem = CommonStringStuff.GetKeywordsPerConfigItem(HideFromStorePlus.Value, ','); List list = new List(1 + keywordsPerConfigItem.Count); list.Add(item); list.AddRange(keywordsPerConfigItem); HideItemListing = list; } } internal class AutoComplete { internal static int AutoCompleteIndex = -1; internal static List AutoCompleteResults = new List(); internal static List GetMatchingKeywords(string input) { List list = new List(); list.Add(input); Loggers.LogDebug("added " + input + " to automcomplete list"); TerminalKeyword[] allKeywords = Plugin.instance.Terminal.terminalNodes.allKeywords; foreach (TerminalKeyword val in allKeywords) { if (Misc.StringContainsInvariant(val.word, input, true)) { list.Add(val.word); Loggers.LogDebug("adding matching word: " + val.word + " to autocomplete list"); } } if (GameStuff.otherModWords.Count > 0) { foreach (string otherModWord in GameStuff.otherModWords) { if (Misc.StringContainsInvariant(otherModWord, input, true)) { list.Add(otherModWord); Loggers.LogDebug("adding otherModWord: " + otherModWord + " to autocomplete list"); } } } return list; } internal static bool CheckCurrentInput(List matchList, string input) { if (!matchList.Contains(input)) { AutoCompleteIndex = -1; return false; } return true; } internal static string ShowMatchingKeywords(List matchList, ref int currentIndex) { Loggers.LogDebug($"Matching Words: {matchList.Count}"); if (matchList.Count < 1) { Loggers.LogDebug("matchList count is 0"); currentIndex = 0; return string.Empty; } if (matchList.Count > QoLConfig.TerminalAutoCompleteMaxCount.Value) { Loggers.LogDebug("matchList count is too high"); currentIndex = -1; return matchList[0].ToString(); } if (currentIndex == -1) { currentIndex = 1; } if (currentIndex > matchList.Count - 1) { Loggers.LogDebug("setting autocompleteindex to 0"); currentIndex = -1; return matchList[0].ToString(); } string result = matchList[currentIndex].ToString(); currentIndex++; return result; } } internal class ConflictRes { private readonly TerminalKeyword word; private readonly int distance; private readonly int bonus; private readonly int priority; internal ConflictRes(TerminalKeyword word, int distance, int bonus, string verb = "none") { this.word = word; this.distance = distance; this.bonus = bonus; if (verb == "route") { priority = 1; } else if (verb == "buy") { priority = 2; } else { priority = 0; } Loggers.LogDebug($"{word.word} registered.\ndistance: {distance}\nbonus: {bonus}\nverb: {verb}"); } internal static bool ContainsWord(List conflictList, TerminalKeyword query) { foreach (ConflictRes conflict in conflictList) { if ((Object)(object)conflict.word == (Object)(object)query) { return true; } } return false; } internal static void InitRes(string playerWord, ref TerminalKeyword word) { if (!((Object)(object)word == (Object)null) && QoLConfig.TerminalConflictResolution.Value && playerWord.Length >= 0 && TryGetBestMatchingKeyword(playerWord, out TerminalKeyword returnWord)) { word = returnWord; Loggers.LogDebug("returning conflictresolution word"); } } internal static void QueryKeywords(ref List matching, string input) { List list = new List(2) { "buy", "route" }; TerminalKeyword[] allKeywords = Plugin.instance.Terminal.terminalNodes.allKeywords; foreach (TerminalKeyword val in allKeywords) { if (Misc.StringContainsInvariant(val.word, input, true) && !ContainsWord(matching, val)) { if (val.word.Length >= 2) { int num = Levenshtein.MatchingStart(val.word, input); int num2 = Levenshtein.Distance(val.word, input); Loggers.LogDebug($"Word {val.word} noted with score {num2} for input {input} with bonus {num}"); if ((Object)(object)val.defaultVerb == (Object)null) { matching.Add(new ConflictRes(val, num2, num)); } else if (list.Contains(val.defaultVerb.word.ToLower())) { Loggers.LogDebug("Word - " + val.word + " given high priority attribute due to matching high priority verb: " + val.defaultVerb.word); matching.Add(new ConflictRes(val, num2, num, val.defaultVerb.word.ToLower())); } else { matching.Add(new ConflictRes(val, num2, num)); } } } else { if (val.compatibleNouns == null) { continue; } CompatibleNoun[] compatibleNouns = val.compatibleNouns; foreach (CompatibleNoun val2 in compatibleNouns) { if (input.Contains(val2.noun.word) && !ContainsWord(matching, val2.noun) && val2.noun.word.Length >= 3 && !((Object)(object)val2.noun.defaultVerb == (Object)null)) { Loggers.LogDebug(val.word + " has compatible noun: " + val2.noun.word + " which is in " + input); int num3 = Levenshtein.MatchingStart(val2.noun.word, input); int num4 = Levenshtein.Distance(val2.noun.word, input); Loggers.LogDebug($"score: {num4}"); if (list.Contains(val2.noun.defaultVerb.word.ToLower())) { Loggers.LogDebug("Word - " + val2.noun.word + " given high priority attribute due to matching high priority verb: " + val2.noun.defaultVerb.word); matching.Add(new ConflictRes(val2.noun, num4, num3, val2.noun.defaultVerb.word.ToLower())); } else { matching.Add(new ConflictRes(val2.noun, num4, num3)); } } } } } } internal static bool TryGetBestMatchingKeyword(string query, out TerminalKeyword returnWord) { List matching = new List(); List list = new List(); QueryKeywords(ref matching, query); if (matching.Count < 1) { Plugin.Log.LogWarning((object)("No matching keywords could be found for input: " + query)); returnWord = null; return false; } foreach (ConflictRes item in matching) { if (item.priority > 0) { list.Add(item); } } ConflictRes bestMatch = null; if (list.Count > 0) { GetResolution(list, ref bestMatch); } else { GetResolution(matching, ref bestMatch); } if (bestMatch == null) { returnWord = null; return false; } if ((Object)(object)bestMatch.word == (Object)null) { Plugin.Log.LogWarning((object)("No matching keywords found for input: " + query)); returnWord = null; return false; } Loggers.LogDebug($"Conflict resolution has determined word: {bestMatch.word.word} is the best match with distance: {bestMatch.distance} and starswith bonus: {bestMatch.bonus}"); returnWord = bestMatch.word; return true; } internal static bool TryGetHighestPriority(List resolutionList, ConflictRes currentRes) { bool result = false; foreach (ConflictRes resolution in resolutionList) { if (currentRes.priority >= resolution.priority) { result = true; } } return result; } internal static void GetResolution(List resolutionList, ref ConflictRes bestMatch) { int num = 0; foreach (ConflictRes resolution in resolutionList) { if (resolution.bonus > num && TryGetHighestPriority(resolutionList, resolution)) { Loggers.LogDebug($"Highest priority: {resolution.priority}"); bestMatch = resolution; num = resolution.bonus; Loggers.LogDebug($"highestBonus updated to {num} - from {bestMatch.word}"); } else if (resolution.bonus == num && bestMatch != null) { Loggers.LogDebug("matching highestBonus found for word " + resolution.word.word); if (resolution.distance < bestMatch.distance && resolution.priority >= bestMatch.priority) { Loggers.LogDebug("distance for " + resolution.word.word + " is lower than " + bestMatch.word.word); Loggers.LogDebug("setting bestMatch to " + resolution.word.word); bestMatch = resolution; } } } } } internal static class HandleDelayRun { internal static List DelayRuns = new List(); internal static string HandleCommandDelay() { List keywordsPerConfigItem = StringStuff.GetKeywordsPerConfigItem(KeywordConfigs.DelayKWs.Value); string result = "Invalid usage of " + keywordsPerConfigItem[0] + " command! Please follow the following format:\n\n\t" + keywordsPerConfigItem[0] + "