using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using OpenLib;
using OpenLib.Common;
using OpenLib.Compat;
using OpenLib.ConfigManager;
using OpenLib.CoreMethods;
using OpenLib.Events;
using OpenLib.InteractiveMenus;
using TMPro;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.Rendering;
using UnityEngine.UI;
using UnityEngine.Video;
using suitsTerminal.EventSub;
using suitsTerminal.Suit_Stuff;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace suitsTerminal
{
internal class ChatHandler
{
internal static string lastCommandRun = "";
internal static void HandleChatMessage(string command)
{
if (lastCommandRun == command)
{
return;
}
if (command.StartsWith("!suits"))
{
string[] array = command.Split(' ');
if (array.Length == 1)
{
AdvancedMenu.GetCurrentSuitID();
string text = StringStuff.ChatListing(AllSuits.suitListing, 6, 1);
HUDManager.Instance.AddTextToChatOnServer("[suitsTerminal]:\t " + text, -1);
lastCommandRun = command;
}
else if (array.Length > 1)
{
string text2 = array[1];
if (int.TryParse(text2, out var result))
{
string text3 = StringStuff.ChatListing(AllSuits.suitListing, 6, result);
HUDManager.Instance.AddTextToChatOnServer("[suitsTerminal]:\t " + text3, -1);
lastCommandRun = command;
}
else
{
HUDManager.Instance.AddTextToChatOnServer("[suitsTerminal]:\t Invalid page number format: " + text2, -1);
Plugin.WARNING("Invalid page number format: " + text2);
lastCommandRun = command;
}
}
}
else if (command.StartsWith("!wear"))
{
string[] array2 = command.Split(' ');
if (array2.Length == 1)
{
HUDManager.Instance.AddTextToChatOnServer("[suitsTerminal]:\t No suit specified...", -1);
lastCommandRun = command;
}
else
{
if (array2.Length <= 1)
{
return;
}
string text4 = array2[1];
if (int.TryParse(text4, out var result2))
{
if (result2 >= 0 && result2 < AllSuits.suitListing.SuitsList.Count)
{
SuitAttributes suit = AllSuits.suitListing.SuitsList[result2];
Plugin.X("wear command");
CommandHandler.BetterSuitPick(suit);
AdvancedMenu.GetCurrentSuitID();
lastCommandRun = command;
}
else
{
HUDManager.Instance.AddTextToChatOnServer("[suitsTerminal]:\t Invalid suit number: " + text4, -1);
Plugin.WARNING("Invalid suit number: " + text4);
lastCommandRun = command;
}
}
else
{
HUDManager.Instance.AddTextToChatOnServer("[suitsTerminal]:\t Invalid suit number format: " + text4, -1);
Plugin.WARNING("Invalid suit number format: " + text4);
lastCommandRun = command;
}
}
}
else if (command.StartsWith("!clear"))
{
((TMP_Text)HUDManager.Instance.chatText).text.Remove(0, ((TMP_Text)HUDManager.Instance.chatText).text.Length);
HUDManager.Instance.ChatMessageHistory.Clear();
lastCommandRun = command;
}
}
}
[HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")]
public class Chat_Patch : MonoBehaviour
{
internal static string lastMessage = "";
private static void Postfix(HUDManager __instance)
{
if (SConfig.ChatCommands.Value && !(lastMessage == __instance.lastChatMessage))
{
Plugin.X("Testing message [" + __instance.lastChatMessage + "] for command.");
string lastChatMessage = __instance.lastChatMessage;
ChatHandler.HandleChatMessage(lastChatMessage);
}
}
}
[HarmonyPatch(typeof(StartOfRound), "PositionSuitsOnRack")]
public class SuitBoughtByOthersPatch
{
private static void Postfix(StartOfRound __instance)
{
if (!((Object)(object)__instance == (Object)null) && Misc.hasLaunched)
{
Plugin.X("suits rack func called, calling FixRack func");
Subscribers.ResetSuitPlacementVars(unlocksReset: false);
AllSuits.FixRack();
}
}
}
public class Page
{
public StringBuilder Content { get; set; }
public int PageNumber { get; set; }
}
public class PageSplitter
{
public static List<Page> SplitTextIntoPages(string inputText, int maxLinesPerPage)
{
string[] array = inputText.Split(new string[1] { Environment.NewLine }, StringSplitOptions.None);
List<Page> list = new List<Page>();
int num = 0;
int num2 = 1;
while (num < array.Length)
{
Page page = new Page
{
Content = new StringBuilder(),
PageNumber = num2
};
page.Content.AppendLine($"=== Choose your Suit! Page {num2} ===\r\n\r\n");
for (int i = 0; i < maxLinesPerPage; i++)
{
if (num >= array.Length)
{
break;
}
page.Content.AppendLine(array[num]);
num++;
}
if (num < array.Length)
{
page.Content.AppendLine($"> Use command 'suits {num2 + 1}' to see the next page of suits!\r\n");
}
list.Add(page);
num2++;
}
return list;
}
}
internal class Bools
{
internal static bool ShouldShowSuit(SuitAttributes suit)
{
SuitAttributes suit2 = suit;
List<string> keywordsPerConfigItem = CommonStringStuff.GetKeywordsPerConfigItem(SConfig.SuitsOnRackOnly.Value, ',');
List<string> listToLower = CommonStringStuff.GetListToLower(CommonStringStuff.GetKeywordsPerConfigItem(SConfig.DontAddToRack.Value, ','));
if (SConfig.HideRack.Value)
{
return false;
}
if (listToLower.Contains(suit2.Name.ToLower()))
{
return false;
}
if (keywordsPerConfigItem.Count == 0 && Misc.suitsOnRack >= SConfig.SuitsOnRack.Value && !Misc.rackSituated)
{
return false;
}
if (Misc.suitsOnRack == SConfig.SuitsOnRack.Value && !Misc.rackSituated)
{
return false;
}
if (Misc.rackSituated && !suit2.IsOnRack)
{
return false;
}
if (suit2.Name.Length > 1 && keywordsPerConfigItem.Count > 0 && !keywordsPerConfigItem.Any((string s) => s.ToLower() == suit2.Name.ToLower()))
{
return false;
}
if (Misc.suitsOnRack < SConfig.SuitsOnRack.Value && !Misc.rackSituated)
{
return true;
}
return false;
}
}
public static class SConfig
{
public static List<ConfigEntry<string>> KeyBinds = new List<ConfigEntry<string>>();
public static ConfigEntry<bool> ExtensiveLogging { get; internal set; }
public static ConfigEntry<int> SuitsOnRack { get; internal set; }
public static ConfigEntry<bool> HideRack { get; internal set; }
public static ConfigEntry<bool> HideBoots { get; internal set; }
public static ConfigEntry<bool> RandomSuitCommand { get; internal set; }
public static ConfigEntry<bool> ChatCommands { get; internal set; }
public static ConfigEntry<bool> DontRemove { get; internal set; }
public static ConfigEntry<bool> EnforcePaidSuits { get; internal set; }
public static ConfigEntry<bool> TerminalCommands { get; internal set; }
public static ConfigEntry<bool> AdvancedTerminalMenu { get; internal set; }
public static ConfigEntry<bool> EnablePiPCamera { get; internal set; }
public static ConfigEntry<bool> ChatHints { get; internal set; }
public static ConfigEntry<bool> BannerHints { get; internal set; }
public static ConfigEntry<bool> UseOpenBodyCams { get; internal set; }
public static ConfigEntry<string> ObcResolution { get; internal set; }
public static ConfigEntry<string> DefaultSuit { get; internal set; }
public static ConfigEntry<string> MenuUp { get; internal set; }
public static ConfigEntry<string> MenuDown { get; internal set; }
public static ConfigEntry<string> MenuLeft { get; internal set; }
public static ConfigEntry<string> MenuRight { get; internal set; }
public static ConfigEntry<string> LeaveMenu { get; internal set; }
public static ConfigEntry<string> SelectMenu { get; internal set; }
public static ConfigEntry<string> FavItemKey { get; internal set; }
public static ConfigEntry<string> TogglePiP { get; internal set; }
public static ConfigEntry<string> TogglePiPZoom { get; internal set; }
public static ConfigEntry<string> TogglePiPRotation { get; internal set; }
public static ConfigEntry<string> TogglePiPHeight { get; internal set; }
public static ConfigEntry<string> MenuStartPage { get; internal set; }
public static ConfigEntry<string> SuitsOnRackOnly { get; internal set; }
public static ConfigEntry<string> DontAddToRack { get; internal set; }
public static ConfigEntry<string> DontAddToTerminal { get; internal set; }
public static ConfigEntry<string> FavoritesMenuList { get; internal set; }
public static ConfigEntry<bool> PersonalizedFavorites { get; internal set; }
public static ConfigEntry<string> SuitsSortingStyle { get; internal set; }
public static void Settings()
{
Plugin.Log.LogInfo((object)"Reading configuration settings");
AdvancedTerminalMenu = ConfigSetup.MakeBool(((BaseUnityPlugin)Plugin.instance).Config, "General", "AdvancedTerminalMenu", true, "Enable this to utilize the advanced menu system and keybinds below");
ExtensiveLogging = ConfigSetup.MakeBool(((BaseUnityPlugin)Plugin.instance).Config, "General", "ExtensiveLogging", false, "Enable or Disable extensive logging for this mod.");
EnforcePaidSuits = ConfigSetup.MakeBool(((BaseUnityPlugin)Plugin.instance).Config, "General", "EnforcePaidSuits", true, "Enable or Disable enforcing paid suits being locked until they are paid for & unlocked.");
RandomSuitCommand = ConfigSetup.MakeBool(((BaseUnityPlugin)Plugin.instance).Config, "General", "RandomSuitCommand", false, "Enable/Disable the randomsuit terminal command.");
ChatCommands = ConfigSetup.MakeBool(((BaseUnityPlugin)Plugin.instance).Config, "General", "ChatCommands", false, "Enable/Disable suits commands via chat (!suits/!wear).");
TerminalCommands = ConfigSetup.MakeBool(((BaseUnityPlugin)Plugin.instance).Config, "General", "TerminalCommands", true, "Enable/Disable the base suits commands via terminal (suits, wear).");
DontRemove = ConfigSetup.MakeBool(((BaseUnityPlugin)Plugin.instance).Config, "General", "DontRemove", false, "Enable this to stop this mod from removing suits from the rack and make it compatible with other mods like TooManySuits.");
DefaultSuit = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "General", "DefaultSuit", "", "Automatically equip this suit when first loading in (in-place of the default orange\nThis configuration option is disabled if SuitSaver is present.");
DontAddToTerminal = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "General", "DontAddToTerminal", "", "Comma-separated list of suits you do NOT want added to the terminal in any situation. Leave blank to disable this list.");
SuitsOnRack = ConfigSetup.MakeClampedInt(((BaseUnityPlugin)Plugin.instance).Config, "Rack Settings", "SuitsOnRack", 13, "Number of suits to keep on the rack. (Up to 13)", 0, 13);
SuitsOnRackOnly = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Rack Settings", "SuitsOnRackOnly", "", "Comma-separated list of suits to display on the rack by name. Leave blank to disable this list.\nNOTE: This will make it so ONLY suits listed here will be added to the rack.\nIf no suits match this configuration item, no suits will be added to the rack.");
DontAddToRack = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "Rack Settings", "DontAddToRack", "", "Comma-separated list of suits you do NOT want added to the rack in any situation. Leave blank to disable this list.");
HideBoots = ConfigSetup.MakeBool(((BaseUnityPlugin)Plugin.instance).Config, "Rack Settings", "HideBoots", false, "Enable this to hide the boots by the rack.");
HideRack = ConfigSetup.MakeBool(((BaseUnityPlugin)Plugin.instance).Config, "Rack Settings", "HideRack", false, "Enable this to hide the rack, (rack will not be hidden if DontRemove is enabled, SuitsOnRack integer will be ignored if rack hidden).");
SuitsSortingStyle = ConfigSetup.MakeClampedString(((BaseUnityPlugin)Plugin.instance).Config, "Rack Settings", "SuitsSortingStyle", "alphabetical (UnlockableName)", "How suits will be sorted in menus & on the rack", new AcceptableValueList<string>(new string[3] { "alphabetical", "numerical", "none" }));
MenuStartPage = ConfigSetup.MakeClampedString(((BaseUnityPlugin)Plugin.instance).Config, "AdvancedTerminalMenu", "MenuStartPage", "main", "How suits will be sorted in menus & on the rack", new AcceptableValueList<string>(new string[4] { "main", "favs", "change", "help" }));
FavoritesMenuList = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "AdvancedTerminalMenu", "FavoritesMenuList", "", "Favorited suit names will be stored here and displayed in the AdvancedTerminalMenu.");
PersonalizedFavorites = ConfigSetup.MakeBool(((BaseUnityPlugin)Plugin.instance).Config, "AdvancedTerminalMenu", "PersonalizedFavorites", false, "Enable this to ignore the FavoritesMenuList configuration item in favor of a personal file saving your favorites list.\nUse this if you dont want your favorites list to be shared with other players in modpacks/profile codes.");
EnablePiPCamera = ConfigSetup.MakeBool(((BaseUnityPlugin)Plugin.instance).Config, "AdvancedTerminalMenu", "EnablePiPCamera", true, "Disable this to stop the PiP camera from being created");
MenuLeft = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "AdvancedTerminalMenu", "MenuLeft", "LeftArrow", "Set key to press to go to previous page in advanced menu system");
MenuRight = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "AdvancedTerminalMenu", "MenuRight", "RightArrow", "Set key to press to go to next page in advanced menu system");
MenuUp = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "AdvancedTerminalMenu", "MenuUp", "UpArrow", "Set key to press to go to previous item on page in advanced menu system");
MenuDown = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "AdvancedTerminalMenu", "MenuDown", "DownArrow", "Set key to press to go to next item on page in advanced menu system");
LeaveMenu = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "AdvancedTerminalMenu", "LeaveMenu", "Backspace", "Set key to press to leave advanced menu system");
SelectMenu = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "AdvancedTerminalMenu", "SelectMenu", "Enter", "Set key to press to select an item in advanced menu system");
FavItemKey = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "AdvancedTerminalMenu", "FavItemKey", "F", "Set key to press to set an item as a favorite in advanced menu system");
TogglePiP = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "AdvancedTerminalMenu", "TogglePiP", "F12", "Set key to press to toggle PiP (mirror cam) on/off in advanced menu system");
TogglePiPZoom = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "AdvancedTerminalMenu", "TogglePiPZoom", "Minus", "Set key to press to toggle PiP (mirror cam) zoom in advanced menu system");
TogglePiPRotation = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "AdvancedTerminalMenu", "TogglePiPRotation", "Equals", "Set key to press to toggle PiP (mirror cam) rotation in advanced menu system");
TogglePiPHeight = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "AdvancedTerminalMenu", "TogglePiPHeight", "Backslash", "Set key to press to toggle PiP (mirror cam) height in advanced menu system");
KeyBinds.AddRange(new <>z__ReadOnlyArray<ConfigEntry<string>>(new ConfigEntry<string>[11]
{
MenuLeft, MenuRight, MenuUp, MenuDown, LeaveMenu, SelectMenu, FavItemKey, TogglePiP, TogglePiPZoom, TogglePiPRotation,
TogglePiPHeight
}));
ChatHints = ConfigSetup.MakeBool(((BaseUnityPlugin)Plugin.instance).Config, "Hints", "ChatHints", false, "Determines whether chat hints are displayed at load in.");
BannerHints = ConfigSetup.MakeBool(((BaseUnityPlugin)Plugin.instance).Config, "Hints", "BannerHints", true, "Determines whether banner hints are displayed at load in.");
UseOpenBodyCams = ConfigSetup.MakeBool(((BaseUnityPlugin)Plugin.instance).Config, "OpenBodyCams", "UseOpenBodyCams", true, "Disable this to remove the banner hints displayed at load in.");
ObcResolution = ConfigSetup.MakeString(((BaseUnityPlugin)Plugin.instance).Config, "OpenBodyCams", "ObcResolution", "1000; 700", "Set the resolution of the Mirror Camera created with OpenBodyCams");
ConfigSetup.RemoveOrphanedEntries(((BaseUnityPlugin)Plugin.instance).Config);
((BaseUnityPlugin)Plugin.instance).Config.Save();
((BaseUnityPlugin)Plugin.instance).Config.SettingChanged += OnSettingChanged;
}
private static void OnSettingChanged(object sender, SettingChangedEventArgs settingChangedArg)
{
SettingChangedEventArgs settingChangedArg2 = settingChangedArg;
if (settingChangedArg2.ChangedSetting != null)
{
Plugin.X("CONFIG SETTING CHANGE EVENT");
if (settingChangedArg2.ChangedSetting == PersonalizedFavorites)
{
AllSuits.InitFavoritesListing();
}
if (KeyBinds.Any((ConfigEntry<string> k) => k == settingChangedArg2.ChangedSetting))
{
AdvancedMenu.RefreshKeys();
}
}
}
}
internal class Enums
{
internal static IEnumerator DelayFixRack()
{
yield return (object)new WaitForSeconds(2f);
Misc.suitsOnRack = 0;
Misc.rackSituated = false;
AdvancedMenu.specialMenusActive = false;
Subscribers.ResetSuitPlacementVars(unlocksReset: true);
Plugin.X("ShipResetStuff!");
AllSuits.FixRack();
Subscribers.DefaultSuit();
}
internal static IEnumerator ChatHints()
{
if (SConfig.ChatHints.Value)
{
yield return (object)new WaitForSeconds(5f);
Plugin.X("hint in chat.");
if (SConfig.TerminalCommands.Value)
{
HUDManager.Instance.AddTextToChatOnServer("[suitsTerminal]: Access more suits by typing 'suits' in the terminal.", -1);
}
if (SConfig.ChatCommands.Value)
{
HUDManager.Instance.AddTextToChatOnServer("[suitsTerminal]: Access more suits by typing '!suits' in chat.", -1);
}
}
}
internal static IEnumerator HudHints()
{
if (SConfig.BannerHints.Value)
{
yield return (object)new WaitForSeconds(20f);
Plugin.X("hint on hud.");
if (SConfig.SuitsOnRack.Value > 0 && !SConfig.DontRemove.Value && SConfig.TerminalCommands.Value && !SConfig.ChatCommands.Value)
{
HUDManager.Instance.DisplayTip("Suits Access", "Excess suits have been moved to the terminal for storage. Use command 'suits' in the terminal to access them and change your suit!", false, false, "suitsTerminal-Hint");
}
else if (SConfig.SuitsOnRack.Value == 0 && !SConfig.DontRemove.Value && SConfig.TerminalCommands.Value && !SConfig.ChatCommands.Value)
{
HUDManager.Instance.DisplayTip("Suits Access", "All suits have been moved to the terminal for storage. Use command 'suits' in the terminal to access them and change your suit!", false, false, "suitsTerminal-Hint");
}
else if (SConfig.SuitsOnRack.Value == 0 && !SConfig.DontRemove.Value && SConfig.TerminalCommands.Value && SConfig.ChatCommands.Value)
{
HUDManager.Instance.DisplayTip("Suits Access", "All suits have been moved to the terminal for storage. Use command 'suits' in the terminal or !suits in the chat to access them and change your suit!", false, false, "suitsTerminal-Hint");
}
else if (SConfig.SuitsOnRack.Value > 0 && !SConfig.DontRemove.Value && SConfig.TerminalCommands.Value && SConfig.ChatCommands.Value)
{
HUDManager.Instance.DisplayTip("Suits Access", "Excess suits have been moved to the terminal for storage. Use command 'suits' in the terminal or !suits in the chat to access them and change your suit!", false, false, "suitsTerminal-Hint");
}
}
}
}
internal class InitThisPlugin
{
internal static bool initStarted;
internal static void InitSuitsTerm()
{
if (initStarted)
{
Plugin.X("init already started, ending func");
return;
}
initStarted = true;
Plugin.X($"Suits patch, showSuit value: {Misc.suitsOnRack}");
AllSuits.InitSuitsListing();
if (!Misc.hintOnce)
{
if ((Object)(object)Plugin.Terminal == (Object)null)
{
Plugin.Log.LogError((object)"~~ FATAL ERROR ~~");
Plugin.Log.LogError((object)"Terminal instance is NULL");
Plugin.Log.LogError((object)"~~ FATAL ERROR ~~");
}
else
{
((MonoBehaviour)Plugin.Terminal).StartCoroutine(Enums.ChatHints());
((MonoBehaviour)Plugin.Terminal).StartCoroutine(Enums.HudHints());
Misc.hintOnce = true;
}
}
}
}
internal class Misc
{
internal static bool keywordsCreated;
internal static bool rackSituated;
internal static int suitsOnRack;
internal static int weirdSuitNum;
internal static bool hasLaunched;
internal static bool hintOnce;
internal static bool TryGetGameObject(string location, out GameObject gameobj)
{
gameobj = GameObject.Find(location);
return (Object)(object)gameobj != (Object)null;
}
internal static string HelpMenuDisplay()
{
//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_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
Plugin.X("Help Menu Enabled, showing help information");
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append("========= AdvancedsuitsMenu Help Page =========\r\n");
stringBuilder.Append("\r\n\r\n");
stringBuilder.Append($"Highlight Next Item: [{AdvancedMenu.suitsMenu.downMenu}]\r\nHighlight Last Item: [{AdvancedMenu.suitsMenu.upMenu}]\r\nFavorite Item: [{AdvancedMenu.favItemKeyString}]\r\n");
if (SConfig.EnablePiPCamera.Value)
{
stringBuilder.Append("Toggle Camera Preview: [" + AdvancedMenu.togglePiPstring + "]\r\nRotate Camera: [" + AdvancedMenu.pipRotateString + "]\r\nChange Camera Height: [" + AdvancedMenu.pipHeightString + "]\r\nChange Camera Zoom: [" + AdvancedMenu.pipZoomString + "]\r\n");
}
stringBuilder.Append($"Leave Suits Menu: [{AdvancedMenu.suitsMenu.leaveMenu}]\r\nSelect Suit: [{AdvancedMenu.suitsMenu.selectMenu}]\r\n");
stringBuilder.Append("\r\n>>>\tReturn to Menu: [ANY KEY]\t<<\r\n");
return stringBuilder.ToString();
}
internal static void SaveToConfig(List<string> stringList, out string configItem)
{
configItem = string.Join(", ", stringList);
Plugin.X("Saving to config\n" + configItem);
}
internal static void SaveFavorites(string saveText)
{
if (SConfig.PersonalizedFavorites.Value)
{
string name = Path.Combine("%userprofile%\\appdata\\locallow\\ZeekerssRBLX\\Lethal Company", "suitsTerminal") + "\\masterFavsListing.txt";
name = Environment.ExpandEnvironmentVariables(name);
File.WriteAllText(name, saveText);
Plugin.X("Favorites saved to file at " + name);
}
else
{
SConfig.FavoritesMenuList.Value = saveText;
}
}
}
[BepInPlugin("darmuh.suitsTerminal", "suitsTerminal", "1.6.2")]
[BepInDependency("darmuh.OpenLib", "0.3.2")]
public class Plugin : BaseUnityPlugin
{
public static class PluginInfo
{
public const string PLUGIN_GUID = "darmuh.suitsTerminal";
public const string PLUGIN_NAME = "suitsTerminal";
public const string PLUGIN_VERSION = "1.6.2";
}
public static Plugin instance;
internal static bool SuitSaver;
internal static bool TooManySuits;
public static Terminal Terminal;
internal static ManualLogSource Log;
private void Awake()
{
instance = this;
Log = ((BaseUnityPlugin)this).Logger;
Log.LogInfo((object)"suitsTerminal version 1.6.2 has been started!");
Misc.keywordsCreated = false;
SConfig.Settings();
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
Subscribers.Subscribe();
AdvancedMenu.CreateBetterCommand();
}
public static void X(string message)
{
if (SConfig.ExtensiveLogging.Value)
{
Log.LogInfo((object)message);
}
}
public static void WARNING(string message)
{
Log.LogWarning((object)message);
}
public static void ERROR(string message)
{
Log.LogError((object)message);
}
}
internal class StringStuff
{
internal static string TerminalFriendlyString(string s)
{
StringBuilder stringBuilder = new StringBuilder();
foreach (char c in s)
{
if (!char.IsPunctuation(c))
{
stringBuilder.Append(c);
}
}
if (stringBuilder.Length > 14)
{
int length = stringBuilder.Length - 14;
stringBuilder.Remove(14, length);
}
return stringBuilder.ToString().ToLower();
}
internal static string ChatListing(SuitListing suitListing, int pageSize, int currentPage)
{
int count = suitListing.SuitsList.Count;
currentPage = Mathf.Clamp(currentPage, 1, Mathf.CeilToInt((float)count / (float)pageSize));
int num = (currentPage - 1) * pageSize;
int num2 = Mathf.Min(num + pageSize, count);
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append("\r\n");
for (int i = num; i < num2; i++)
{
SuitAttributes suitAttributes = suitListing.SuitsList[i];
string text = suitAttributes.Name + (suitAttributes.currentSuit ? " [EQUIPPED]" : "");
stringBuilder.Append($"'!wear {i}' (" + text + ")\r\n");
}
stringBuilder.Append("\r\n");
stringBuilder.Append($"Page {currentPage}/{Mathf.CeilToInt((float)count / (float)pageSize)}\r\n");
return stringBuilder.ToString();
}
}
internal class AllSuits
{
internal static List<UnlockableItem> UnlockableItems = new List<UnlockableItem>();
internal static Dictionary<int, string> suitNameToID = new Dictionary<int, string>();
internal static SuitListing suitListing = new SuitListing();
internal static List<string> favsList = new List<string>();
internal static bool AddSuitToList(UnlockableSuit suit)
{
if (!SConfig.EnforcePaidSuits.Value)
{
return true;
}
if ((Object)(object)UnlockableItems[suit.syncedSuitID.Value].shopSelectionNode == (Object)null)
{
return true;
}
if (!UnlockableItems[suit.syncedSuitID.Value].spawnPrefab)
{
Plugin.WARNING("Locked suit [" + UnlockableItems[suit.syncedSuitID.Value].unlockableName + "] detected, not adding to listings.");
Plugin.X($"hasBeenUnlockedByPlayer: {UnlockableItems[suit.syncedSuitID.Value].hasBeenUnlockedByPlayer} \nalreadyUnlocked: {UnlockableItems[suit.syncedSuitID.Value].alreadyUnlocked}");
return false;
}
if ((Object)(object)((Component)suit.suitRenderer).gameObject == (Object)null)
{
Plugin.WARNING("Suit [" + UnlockableItems[suit.syncedSuitID.Value].unlockableName + "] game object detected as null, not adding to listings.");
Plugin.X($"hasBeenUnlockedByPlayer: {UnlockableItems[suit.syncedSuitID.Value].hasBeenUnlockedByPlayer} \nalreadyUnlocked: {UnlockableItems[suit.syncedSuitID.Value].alreadyUnlocked}");
return false;
}
Plugin.X($"{UnlockableItems[suit.syncedSuitID.Value].unlockableName}:\nhasBeenUnlockedByPlayer: {UnlockableItems[suit.syncedSuitID.Value].hasBeenUnlockedByPlayer} \nalreadyUnlocked: {UnlockableItems[suit.syncedSuitID.Value].alreadyUnlocked}");
return true;
}
private static void RemoveBadSuitIDs()
{
Plugin.X("Removing suits with negative suitID values.");
foreach (UnlockableSuit rawSuits in suitListing.RawSuitsList)
{
if (rawSuits.syncedSuitID.Value < 0)
{
Plugin.X($"Negative value [ {rawSuits.syncedSuitID.Value} ] detected for suit\nRemoving from suitsTerminal listing");
}
}
suitListing.RawSuitsList.RemoveAll((UnlockableSuit suit) => suit.syncedSuitID.Value < 0);
if (SConfig.SuitsSortingStyle.Value == "alphabetical")
{
OrderSuitsByName();
}
else if (SConfig.SuitsSortingStyle.Value == "numerical")
{
OrderSuitsByID();
}
else if (SConfig.SuitsSortingStyle.Value == "none")
{
Plugin.Log.LogInfo((object)"No sorting requested.");
}
else
{
Plugin.WARNING("Config failure, no sorting");
}
}
internal static void InitFavoritesListing()
{
if (SConfig.PersonalizedFavorites.Value)
{
string name = Path.Combine("%userprofile%\\appdata\\locallow\\ZeekerssRBLX\\Lethal Company", "suitsTerminal");
name = Environment.ExpandEnvironmentVariables(name);
if (!Directory.Exists(name))
{
Directory.CreateDirectory(name);
}
Plugin.X("Favorites file path - " + name);
if (!File.Exists(name + "\\masterFavsListing.txt"))
{
File.WriteAllText(name + "\\masterFavsListing.txt", SConfig.FavoritesMenuList.Value);
}
string text = File.ReadAllText(name + "\\masterFavsListing.txt");
Plugin.X("favoritesText: " + text);
favsList = CommonStringStuff.GetKeywordsPerConfigItem(text, ',');
{
foreach (string favs in favsList)
{
Plugin.X("-- " + favs + " --");
}
return;
}
}
favsList = CommonStringStuff.GetKeywordsPerConfigItem(SConfig.FavoritesMenuList.Value, ',');
}
internal static void InitSuitsListing()
{
Plugin.X("InitSuitsListing");
InitFavoritesListing();
FixRack();
OldCommands.MakeRandomSuitCommand();
}
private static void OrderSuitsByName()
{
suitListing.RawSuitsList = suitListing.RawSuitsList.OrderBy((UnlockableSuit suit) => UnlockableItems[suit.syncedSuitID.Value].unlockableName).ToList();
}
private static void OrderSuitsByID()
{
suitListing.RawSuitsList = suitListing.RawSuitsList.OrderBy((UnlockableSuit suit) => suit.syncedSuitID.Value).ToList();
}
private static void HideBootsAndRack()
{
if (!Misc.rackSituated)
{
if (SConfig.HideBoots.Value && Misc.TryGetGameObject("Environment/HangarShip/ScavengerModelSuitParts/Circle.004", out GameObject gameobj))
{
Object.Destroy((Object)(object)gameobj);
}
if (!SConfig.DontRemove.Value && SConfig.HideRack.Value && Misc.TryGetGameObject("Environment/HangarShip/NurbsPath.002", out GameObject gameobj2))
{
Object.Destroy((Object)(object)gameobj2);
}
}
}
internal static void FixRack()
{
suitListing.RawSuitsList.Clear();
suitListing.RawSuitsList = Object.FindObjectsByType<UnlockableSuit>((FindObjectsInactive)0, (FindObjectsSortMode)0).ToList();
suitNameToID.Clear();
suitListing.NameList.Clear();
UnlockableItems = StartOfRound.Instance.unlockablesList.unlockables;
RemoveBadSuitIDs();
Plugin.X($"Raw Suit Count: {suitListing.RawSuitsList.Count}");
Plugin.X($"Unlockables Count: {UnlockableItems.Count}");
Misc.weirdSuitNum = 0;
Misc.suitsOnRack = 0;
HideBootsAndRack();
List<string> suitNames = new List<string>();
foreach (UnlockableSuit rawSuits in suitListing.RawSuitsList)
{
Plugin.X($"checking - {rawSuits.syncedSuitID.Value}");
if (!AddSuitToList(rawSuits))
{
continue;
}
AutoParentToShip component = ((Component)rawSuits).gameObject.GetComponent<AutoParentToShip>();
if (suitListing.Contains(rawSuits, out SuitAttributes thisSuit))
{
thisSuit.UpdateSuit(rawSuits, UnlockableItems, ref suitNameToID);
Plugin.X($"Updated suit attributes for {thisSuit.Name} with ID {thisSuit.UniqueID}");
}
else if (suitListing.Contains(rawSuits.syncedSuitID.Value, out thisSuit))
{
thisSuit.UpdateSuit(rawSuits, UnlockableItems, ref suitNameToID);
Plugin.X($"Updated suit attributes for {thisSuit.Name} with ID {thisSuit.UniqueID}");
}
else
{
thisSuit = new SuitAttributes(rawSuits, UnlockableItems, ref suitNameToID);
suitListing.SuitsList.Add(thisSuit);
Plugin.X($"Added suit attributes for {thisSuit.Name} with ID {thisSuit.UniqueID}");
}
OldCommands.CreateOldWearCommands(thisSuit, ref suitNames);
if (!SConfig.DontRemove.Value && !Plugin.TooManySuits && (!thisSuit.IsOnRack || !Misc.rackSituated))
{
if (Bools.ShouldShowSuit(thisSuit))
{
thisSuit.IsOnRack = true;
ProcessRack.ProcessVisibleSuit(component, Misc.suitsOnRack);
Plugin.X("Showing suit - [ " + thisSuit.Name + " ]");
}
else
{
thisSuit.IsOnRack = false;
ProcessRack.ProcessHiddenSuit(component);
Plugin.X("Hiding suit - [ " + thisSuit.Name + " ]");
}
if (Misc.suitsOnRack == SConfig.SuitsOnRack.Value && !Misc.rackSituated)
{
Misc.rackSituated = true;
Plugin.X("Max suits are on the rack now. rack is situated, yippeee!!!");
}
}
}
if (SConfig.DontRemove.Value)
{
Plugin.WARNING("suitsTerminal is NOT touching the rack!!!");
}
Plugin.X($"Main list count: {suitListing.NameList.Count}\nFav list count: {suitListing.FavList.Count}");
OldCommands.CreateOldPageCommands();
InitThisPlugin.initStarted = false;
}
}
internal class ProcessRack
{
internal static void ProcessHiddenSuit(AutoParentToShip component)
{
component.disableObject = true;
((Renderer)((Component)component).gameObject.GetComponentInChildren<SkinnedMeshRenderer>()).enabled = false;
((Renderer)((Component)component).gameObject.GetComponentInChildren<MeshRenderer>()).enabled = false;
}
internal static void ProcessVisibleSuit(AutoParentToShip component, int suitNumber)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//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_0044: 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_005e: Unknown result type (might be due to invalid IL or missing references)
component.overrideOffset = true;
float num = 0.18f;
component.positionOffset = new Vector3(-2.45f, 2.75f, -8.41f) + StartOfRound.Instance.rightmostSuitPosition.forward * num * (float)suitNumber;
component.rotationOffset = new Vector3(0f, 90f, 0f);
Misc.suitsOnRack++;
}
}
public class AdvancedMenu
{
[CompilerGenerated]
private static class <>O
{
public static Event <0>__OnEnterStuff;
public static Event <1>__OnExitStuff;
public static Func<string> <2>__MainFooter;
public static Action <3>__MainMenuStuff;
public static Func<string> <4>__GetFooter;
public static Event <5>__ShowFavs;
public static Event <6>__ShowNormal;
public static Event <7>__ShowHelpPage;
public static Func<string> <8>__AdvancedSuitsTerm;
public static Action <9>__FavItem;
public static Action <10>__PipHeight;
public static Action <11>__PipRotate;
public static Action <12>__PipZoom;
public static Action <13>__PipAction;
}
internal static BetterMenu<SuitMenuItem> suitsMenu = null;
internal static Dictionary<Key, Action> ExtraKeyActions = new Dictionary<Key, Action>();
internal static bool InitOnce = false;
internal static SuitMenuItem HomePage = null;
internal static SuitMenuItem FavoritesList = null;
internal static SuitMenuItem SuitsList = null;
internal static SuitMenuItem HelpPage = null;
internal static CustomEvent OpenFavs = new CustomEvent();
internal static CustomEvent ShowAllSuits = new CustomEvent();
internal static CustomEvent ShowHelp = new CustomEvent();
internal static CommandManager Command = null;
internal static string favItemKeyString = string.Empty;
internal static string togglePiPstring = string.Empty;
internal static string pipHeightString = string.Empty;
internal static string pipRotateString = string.Empty;
internal static string pipZoomString = string.Empty;
private static TerminalNode menuDisplay = null;
internal static bool initKeySettings = false;
public static Color CaretOriginal = Color.green;
public static bool specialMenusActive = false;
internal static void InitBetterMenu()
{
if (!initKeySettings && SConfig.AdvancedTerminalMenu.Value)
{
initKeySettings = true;
SetupExtraKeys();
Plugin.X("Loading keybinds from config");
if ((Object)(object)menuDisplay == (Object)null)
{
menuDisplay = Command.terminalNode;
}
InitOneTime();
UpdateMainKeys();
suitsMenu.MenuNode = menuDisplay;
initKeySettings = false;
}
}
private static void InitOneTime()
{
//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_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
if (!InitOnce)
{
Plugin.Log.LogMessage((object)"InitOneTime for BetterMenu stuff!");
AddHintToOther();
suitsMenu = new BetterMenu<SuitMenuItem>("suitsTerminal", ExtraKeyActions);
suitsMenu.PageSize = 10;
CustomEvent onEnter = suitsMenu.OnEnter;
object obj = <>O.<0>__OnEnterStuff;
if (obj == null)
{
Event val = OnEnterStuff;
<>O.<0>__OnEnterStuff = val;
obj = (object)val;
}
onEnter.AddListener((Event)obj);
CustomEvent onExit = suitsMenu.OnExit;
object obj2 = <>O.<1>__OnExitStuff;
if (obj2 == null)
{
Event val2 = OnExitStuff;
<>O.<1>__OnExitStuff = val2;
obj2 = (object)val2;
}
onExit.AddListener((Event)obj2);
InitMenuListing();
InitOnce = true;
}
}
private static void MainMenuStuff()
{
PictureInPicture.TogglePiP(state: false);
}
private static void InitMenuListing()
{
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Expected O, but got Unknown
//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_01c1: Expected O, but got Unknown
//IL_0200: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_020b: Expected O, but got Unknown
HomePage = new SuitMenuItem("suitsTerminal Home");
((MenuItem)HomePage).Header = () => "============= AdvancedsuitsMenu =============\r\n";
((MenuItem)HomePage).Footer = MainFooter;
((MenuItem)HomePage).OnPageLoad = MainMenuStuff;
((BetterMenuBase)suitsMenu).MainMenu = (MenuItem)(object)HomePage;
FavoritesList = new SuitMenuItem("Favorites", OpenFavs);
((MenuItem)FavoritesList).ShowIfEmptyNest = false;
((MenuItem)FavoritesList).Header = () => "============= Favorite Suits =============\r\n";
((MenuItem)FavoritesList).Footer = GetFooter;
CustomEvent openFavs = OpenFavs;
object obj = <>O.<5>__ShowFavs;
if (obj == null)
{
Event val = ShowFavs;
<>O.<5>__ShowFavs = val;
obj = (object)val;
}
openFavs.AddListener((Event)obj);
((MenuItem)FavoritesList).SetParentMenu((MenuItem)(object)HomePage);
SuitsList = new SuitMenuItem("Change Suits", ShowAllSuits);
((MenuItem)SuitsList).Header = () => "============= Select a Suit! =============\r\n";
((MenuItem)SuitsList).Footer = GetFooter;
CustomEvent showAllSuits = ShowAllSuits;
object obj2 = <>O.<6>__ShowNormal;
if (obj2 == null)
{
Event val2 = ShowNormal;
<>O.<6>__ShowNormal = val2;
obj2 = (object)val2;
}
showAllSuits.AddListener((Event)obj2);
((MenuItem)SuitsList).SetParentMenu((MenuItem)(object)HomePage);
HelpPage = new SuitMenuItem("Help Page", ShowHelp);
CustomEvent showHelp = ShowHelp;
object obj3 = <>O.<7>__ShowHelpPage;
if (obj3 == null)
{
Event val3 = ShowHelpPage;
<>O.<7>__ShowHelpPage = val3;
obj3 = (object)val3;
}
showHelp.AddListener((Event)obj3);
((MenuItem)HelpPage).SetParentMenu((MenuItem)(object)HomePage);
SuitMenuItem.AddListToBetterMenu(new List<SuitMenuItem>(4) { HomePage, FavoritesList, SuitsList, HelpPage });
}
private static void ReplaceKey(ref Key current, Key newKey, ref int replacements)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Expected I4, but got Unknown
current = (Key)(int)newKey;
replacements++;
}
internal static void RefreshKeys()
{
//IL_002d: 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_0049: 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_007d: 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_00b1: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)suitsMenu.MenuNode == (Object)null))
{
int replacements = 0;
if (IsValidReplacement(SConfig.MenuUp.Value, suitsMenu.upMenu, out var validKey))
{
ReplaceKey(ref suitsMenu.upMenu, validKey, ref replacements);
}
if (IsValidReplacement(SConfig.MenuDown.Value, suitsMenu.downMenu, out var validKey2))
{
ReplaceKey(ref suitsMenu.downMenu, validKey2, ref replacements);
}
if (IsValidReplacement(SConfig.MenuLeft.Value, suitsMenu.leftMenu, out var validKey3))
{
ReplaceKey(ref suitsMenu.leftMenu, validKey3, ref replacements);
}
if (IsValidReplacement(SConfig.MenuRight.Value, suitsMenu.rightMenu, out var validKey4))
{
ReplaceKey(ref suitsMenu.rightMenu, validKey4, ref replacements);
}
if (IsValidReplacement(SConfig.LeaveMenu.Value, suitsMenu.leaveMenu, out var validKey5))
{
ReplaceKey(ref suitsMenu.leaveMenu, validKey5, ref replacements);
}
if (IsValidReplacement(SConfig.SelectMenu.Value, suitsMenu.selectMenu, out var validKey6))
{
ReplaceKey(ref suitsMenu.selectMenu, validKey6, ref replacements);
}
if (replacements > 0)
{
suitsMenu.UpdateMainActions();
}
if (IsAnyExtraKeyDifferent())
{
SetupExtraKeys();
suitsMenu.OtherActions = ExtraKeyActions;
}
}
}
private static bool IsAnyExtraKeyDifferent()
{
if (favItemKeyString.ToLowerInvariant() != SConfig.FavItemKey.Value.ToLowerInvariant())
{
return true;
}
if (!SConfig.EnablePiPCamera.Value)
{
return false;
}
if (pipHeightString.ToLowerInvariant() != SConfig.TogglePiPHeight.Value.ToLowerInvariant())
{
return true;
}
if (pipRotateString.ToLowerInvariant() != SConfig.TogglePiPRotation.Value.ToLowerInvariant())
{
return true;
}
if (pipZoomString.ToLowerInvariant() != SConfig.TogglePiPZoom.Value.ToLowerInvariant())
{
return true;
}
if (togglePiPstring.ToLowerInvariant() != SConfig.TogglePiP.Value.ToLowerInvariant())
{
return true;
}
return false;
}
private static void GetCurrentSuitNum()
{
if (StartOfRound.Instance.localPlayerController.currentSuitID >= 0)
{
GetCurrentSuitID();
Plugin.X($"currentSuitID: {StartOfRound.Instance.localPlayerController.currentSuitID}\n UnlockableItems: {AllSuits.UnlockableItems.Count}");
}
}
internal static void CreateBetterCommand()
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Expected O, but got Unknown
Command = new CommandManager("suitsTerminal", SConfig.AdvancedTerminalMenu, new List<string>(2) { "suits", "suits menu" }, (Func<string>)CommandHandler.AdvancedSuitsTerm, 0, true);
}
internal static void AddHintToOther()
{
TerminalNode val = default(TerminalNode);
if (LogicHandling.TryGetFromAllNodes("OtherCommands", ref val))
{
AddingThings.AddToExistingNodeText("\n>SUITS\nsuitsTerminal advanced menu for changing & viewing suits", ref val);
}
}
private static void SetupExtraKeys()
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
ExtraKeyActions = new Dictionary<Key, Action>();
CheckKeys(SConfig.FavItemKey.Value, out var usingKey, out favItemKeyString);
BindKeys(FavItem, usingKey, ref favItemKeyString, "F", (Key)20);
PiPKeys();
}
private static void UpdateMainKeys()
{
//IL_0010: 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)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: 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_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: 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_00c0: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: 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)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
if (IsValidReplacement(SConfig.MenuUp.Value, suitsMenu.upMenu, out var validKey))
{
suitsMenu.upMenu = validKey;
}
if (IsValidReplacement(SConfig.MenuDown.Value, suitsMenu.downMenu, out var validKey2))
{
suitsMenu.downMenu = validKey2;
}
if (IsValidReplacement(SConfig.MenuLeft.Value, suitsMenu.leftMenu, out var validKey3))
{
suitsMenu.leftMenu = validKey3;
}
if (IsValidReplacement(SConfig.MenuRight.Value, suitsMenu.rightMenu, out var validKey4))
{
suitsMenu.rightMenu = validKey4;
}
if (IsValidReplacement(SConfig.LeaveMenu.Value, suitsMenu.leaveMenu, out var validKey5))
{
suitsMenu.leaveMenu = validKey5;
}
if (IsValidReplacement(SConfig.SelectMenu.Value, suitsMenu.selectMenu, out var validKey6))
{
suitsMenu.selectMenu = validKey6;
}
suitsMenu.UpdateMainActions();
}
internal static string GetFooter()
{
//IL_0037: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
string suitName = GetSuitName();
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append("\r\n\r\n\r\n\r\nCurrently Wearing: " + suitName + "\r\n\r\n");
stringBuilder.Append($"Page [{suitsMenu.leftMenu}] < {suitsMenu.CurrentPage}/{Mathf.CeilToInt((float)suitsMenu.DisplayMenuItemsOfType.Count / (float)suitsMenu.PageSize)} > [{suitsMenu.rightMenu}]\r\n");
stringBuilder.Append($"Leave Menu: [{suitsMenu.leaveMenu}] Select Suit: [{suitsMenu.selectMenu}]\r\n");
return stringBuilder.ToString();
}
internal static string MainFooter()
{
//IL_001a: 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_0088: 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)
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append($"\r\n\r\n\r\n\r\nPage [{suitsMenu.leftMenu}] < {suitsMenu.CurrentPage}/{Mathf.CeilToInt((float)suitsMenu.DisplayMenuItemsOfType.Count / (float)suitsMenu.PageSize)} > [{suitsMenu.rightMenu}]\r\n");
stringBuilder.Append($"Leave Menu: [{suitsMenu.leaveMenu}] Select Item: [{suitsMenu.selectMenu}]\r\n");
return stringBuilder.ToString();
}
private static string GetSuitName()
{
string empty = string.Empty;
if (AllSuits.UnlockableItems.Count == 0)
{
return empty;
}
if ((Object)(object)StartOfRound.Instance == (Object)null)
{
return empty;
}
if ((Object)(object)StartOfRound.Instance.localPlayerController == (Object)null)
{
return empty;
}
if (StartOfRound.Instance.localPlayerController.currentSuitID > AllSuits.UnlockableItems.Count)
{
return empty;
}
return AllSuits.UnlockableItems[StartOfRound.Instance.localPlayerController.currentSuitID].unlockableName;
}
private static void BindKeys(Action menuAction, Key givenKey, ref string givenKeyString, string defaultKeyString, Key defaultKey)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Invalid comparison between Unknown and I4
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
Plugin.X($"Binding {menuAction}");
if ((int)givenKey > 0)
{
ExtraKeyActions.Add(givenKey, menuAction);
Plugin.X(givenKeyString + " bound");
}
else
{
ExtraKeyActions.Add(defaultKey, menuAction);
givenKeyString = defaultKeyString;
Plugin.X(givenKeyString + " bound");
}
}
private static void CheckKeys(string configString, out Key usingKey, out string keyString)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected I4, but got Unknown
if (IsValidKey(configString, out var validKey))
{
usingKey = (Key)(int)validKey;
keyString = ((object)(Key)(ref validKey)).ToString();
}
else
{
usingKey = (Key)0;
keyString = "FAIL";
}
}
private static void PiPKeys()
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: 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_011a: Unknown result type (might be due to invalid IL or missing references)
if (SConfig.EnablePiPCamera.Value)
{
CheckKeys(SConfig.TogglePiPHeight.Value, out var usingKey, out pipHeightString);
BindKeys(PipHeight, usingKey, ref pipHeightString, "Backslash", (Key)10);
CheckKeys(SConfig.TogglePiPRotation.Value, out var usingKey2, out pipRotateString);
BindKeys(PipRotate, usingKey2, ref pipRotateString, "Equals", (Key)14);
CheckKeys(SConfig.TogglePiPZoom.Value, out var usingKey3, out pipZoomString);
BindKeys(PipZoom, usingKey3, ref pipZoomString, "Minus", (Key)13);
CheckKeys(SConfig.TogglePiP.Value, out var usingKey4, out togglePiPstring);
BindKeys(PipAction, usingKey4, ref togglePiPstring, "F12", (Key)105);
}
}
private static bool IsValidReplacement(string key, Key original, out Key validKey)
{
//IL_0021: 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)
//IL_0036: 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_002d: Expected I4, but got Unknown
//IL_0060: 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_00bc: Expected I4, but got Unknown
List<Key> list = new List<Key>(1) { (Key)3 };
if (Enum.TryParse<Key>(key, ignoreCase: true, out Key result))
{
if (original == result)
{
validKey = (Key)(int)original;
return false;
}
if (list.Contains(result))
{
Plugin.WARNING("Tab Key detected, rejecting bind.");
validKey = (Key)0;
return false;
}
if (suitsMenu.MainActions.ContainsKey(result))
{
Plugin.WARNING("Key was already bound to something, returning false");
string text = string.Join(", ", suitsMenu.MainActions.Keys);
Plugin.WARNING("Key list: " + text);
validKey = (Key)0;
return false;
}
Plugin.X("Valid Key Detected and being assigned");
validKey = (Key)(int)result;
return true;
}
validKey = (Key)0;
return false;
}
private static bool IsValidKey(string key, out Key validKey)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Expected I4, but got Unknown
List<Key> list = new List<Key>(1) { (Key)3 };
if (Enum.TryParse<Key>(key, ignoreCase: true, out Key result))
{
if (list.Contains(result))
{
Plugin.WARNING("Tab Key detected, rejecting bind.");
validKey = (Key)0;
return false;
}
if (ExtraKeyActions.ContainsKey(result))
{
Plugin.WARNING("Key was already bound to something, returning false");
string text = string.Join(", ", ExtraKeyActions.Keys);
Plugin.WARNING("Key list: " + text);
validKey = (Key)0;
return false;
}
Plugin.X("Valid Key Detected and being assigned to bind");
validKey = (Key)(int)result;
return true;
}
validKey = (Key)0;
return false;
}
private static Camera GetCam()
{
if (Plugin.instance.OpenBodyCamsMod && SConfig.UseOpenBodyCams.Value)
{
Plugin.X("Returning Cam from OpenLib OpenBodyCams Compat!");
return OpenBodyCamFuncs.GetCam(OpenBodyCamFuncs.TerminalMirrorCam);
}
PictureInPicture.playerCam = CamStuff.MyCameraHolder.GetComponent<Camera>();
return PictureInPicture.playerCam;
}
private static void PipAction()
{
PictureInPicture.TogglePiP(!PictureInPicture.pipActive);
Plugin.X($"Toggling PiP to state {!PictureInPicture.pipActive}");
}
private static void PipHeight()
{
if (PictureInPicture.pipActive)
{
Camera cam = GetCam();
if (!((Object)(object)cam == (Object)null))
{
PictureInPicture.MoveCamera(((Component)cam).transform, ref PictureInPicture.heightStep);
Plugin.X($"Changing PiP height to {PictureInPicture.heightStep}");
}
}
}
private static void PipRotate()
{
if (PictureInPicture.pipActive)
{
Camera cam = GetCam();
if (!((Object)(object)cam == (Object)null))
{
PictureInPicture.RotateCameraAroundPlayer(StartOfRound.Instance.localPlayerController.meshContainer, ((Component)cam).transform);
Plugin.X("Rotating PiP around player");
}
}
}
private static void PipZoom()
{
if (PictureInPicture.pipActive)
{
Camera cam = GetCam();
if (!((Object)(object)cam == (Object)null))
{
PictureInPicture.ChangeCamZoom(cam, ref PictureInPicture.zoomStep);
Plugin.X($"Changing PiP zoom to zoomStep: [{PictureInPicture.zoomStep}]");
}
}
}
private static void ShowHelpPage()
{
suitsMenu.MenuNode.displayText = Misc.HelpMenuDisplay();
suitsMenu.AcceptAnything = true;
suitsMenu.Load();
PictureInPicture.TogglePiP(state: false);
}
private static void ShowFavs()
{
if (((MenuItem)FavoritesList).NestedMenus.Count < 1)
{
Plugin.Terminal.PlayTerminalAudioServerRpc(1);
Plugin.Log.LogInfo((object)"Empty favorites menu! Playing error audio for user");
}
else
{
((MonoBehaviour)Plugin.Terminal).StartCoroutine(SuitsMenuStart());
}
}
private static void ShowNormal()
{
((MonoBehaviour)Plugin.Terminal).StartCoroutine(SuitsMenuStart());
}
private static void FavItem()
{
if (!((MenuItem)FavoritesList).IsActive && !((MenuItem)SuitsList).IsActive)
{
Plugin.X("Current menu does not accept favorites as input!");
return;
}
MenuItem selection = null;
selection = suitsMenu.DisplayMenuItemsOfType[suitsMenu.ActiveSelection];
if (selection == null)
{
Plugin.WARNING($"SELECTION NULL AT FAVITEM\nActiveSelection - {suitsMenu.ActiveSelection}\nFavList Count - {((MenuItem)FavoritesList).NestedMenus.Count}");
return;
}
SuitAttributes suitAttributes = AllSuits.suitListing.SuitsList.FirstOrDefault((SuitAttributes x) => x.Name == selection.Name);
if (suitAttributes == null)
{
return;
}
if (suitAttributes.IsFav)
{
suitAttributes.RemoveFromFavs();
Plugin.Log.LogInfo((object)(suitAttributes.Name + " removed from favorites listing"));
if (AllSuits.suitListing.FavList.Count < 1 && ((MenuItem)FavoritesList).IsActive)
{
Misc.SaveToConfig(AllSuits.suitListing.FavList, out string configItem);
Misc.SaveFavorites(configItem);
GetCurrentSuitNum();
suitsMenu.ExitInTerminal();
return;
}
}
else
{
suitAttributes.AddToFavs();
Plugin.Log.LogInfo((object)(suitAttributes.Name + " added to favorites listing"));
}
Misc.SaveToConfig(AllSuits.suitListing.FavList, out string configItem2);
Misc.SaveFavorites(configItem2);
suitsMenu.Load();
}
internal static void GetCurrentSuitID()
{
foreach (SuitAttributes suits in AllSuits.suitListing.SuitsList)
{
if (suits.Suit.suitID == StartOfRound.Instance.localPlayerController.currentSuitID || suits.Suit.syncedSuitID.Value == StartOfRound.Instance.localPlayerController.currentSuitID)
{
suits.currentSuit = true;
Plugin.X("Detected wearing - " + suits.Name);
}
else
{
suits.currentSuit = false;
}
}
}
private static void PiPSetParent()
{
if (SConfig.EnablePiPCamera.Value)
{
((Component)PictureInPicture.pipRawImage).transform.SetParent(((Component)((Selectable)Plugin.Terminal.screenText).image).transform);
}
}
private static void OnExitStuff()
{
PictureInPicture.TogglePiP(state: false);
}
private static void OnEnterStuff()
{
PictureInPicture.rotateStep = 0;
PictureInPicture.heightStep = 0;
PictureInPicture.zoomStep = 1;
GetCurrentSuitNum();
}
internal static IEnumerator SuitsMenuStart()
{
GetCurrentSuitNum();
yield return (object)new WaitForEndOfFrame();
PictureInPicture.TogglePiP(state: true);
yield return (object)new WaitForEndOfFrame();
}
}
internal class CommandHandler
{
internal static string RandomSuit()
{
Plugin.X($"Suit Count: {AllSuits.suitListing.SuitsList.Count}");
Random random = new Random();
int num = random.Next(AllSuits.suitListing.SuitsList.Count);
SuitAttributes suitAttributes = AllSuits.suitListing.SuitsList[num];
suitAttributes.Suit.SwitchSuitToThis(StartOfRound.Instance.localPlayerController);
return $"Rolled random number [ {num} ]\n\n\nChanging suit to {suitAttributes.Name}!\r\n\r\n";
}
internal static string SuitPickCommand()
{
return PickSuit();
}
internal static string AdvancedSuitsTerm()
{
AdvancedMenu.suitsMenu.EnterAtPage(SuitMenuItem.GetStartMenu());
return "";
}
internal static void BetterSuitPick(SuitAttributes suit)
{
if ((Object)(object)suit.Suit == (Object)null)
{
Plugin.ERROR("suit is null!");
return;
}
suit.Suit.SwitchSuitToThis(StartOfRound.Instance.localPlayerController);
Plugin.Log.LogMessage((object)("Switched suit to " + suit.Name));
CollectionExtensions.Do<SuitAttributes>((IEnumerable<SuitAttributes>)AllSuits.suitListing.SuitsList, (Action<SuitAttributes>)delegate(SuitAttributes x)
{
x.currentSuit = false;
});
suit.currentSuit = true;
Plugin.X("Updated currentSuit bool");
}
internal static string PickSuit()
{
Plugin.X($"Suit Count: {AllSuits.suitListing.SuitsList.Count}");
Plugin.X($"Unlockables Count: {AllSuits.UnlockableItems.Count}");
string text = CommonStringStuff.GetCleanedScreenText(Plugin.Terminal).ToLower();
foreach (SuitAttributes suits in AllSuits.suitListing.SuitsList)
{
if (suits.Suit.syncedSuitID.Value >= 0)
{
string text2 = StringStuff.TerminalFriendlyString(suits.Name);
if (text.Equals("wear " + text2))
{
suits.Suit.SwitchSuitToThis(StartOfRound.Instance.localPlayerController);
return "Changing suit to " + suits.Name + "\r\n";
}
Plugin.X("SuitName: " + suits.Name + " doesn't match Cleaned Text: " + text);
}
else
{
Plugin.X($"suit ID was {suits.Suit.syncedSuitID.Value}");
}
}
return "Unable to set suit to match command: " + text;
}
internal static void AddBasicCommand(string nodeName, string keyWord, string displayText, string category = "", string description = "")
{
AddingThings.AddBasicCommand(nodeName, keyWord, displayText, false, true, category, description);
}
}
internal class OldCommands
{
internal static void CreateOldWearCommands(SuitAttributes suit, ref List<string> suitNames)
{
if (!SConfig.TerminalCommands.Value || SConfig.AdvancedTerminalMenu.Value || suit.HideFromTerminal)
{
return;
}
if (suit.Suit.syncedSuitID.Value >= 0 && !Misc.keywordsCreated)
{
suit.Name = StringStuff.TerminalFriendlyString(suit.Name);
if (suitNames.Contains(suit.Name.ToLower()))
{
suit.Name += "z";
Plugin.WARNING("Duplicate found. Updated SuitName: " + suit.Name);
}
suitNames.Add(suit.Name.ToLower());
AddWearCommandFor(suit);
Plugin.X("Keyword for " + suit.Name + " added");
}
else if (suit.Suit.syncedSuitID.Value >= 0 && Misc.keywordsCreated)
{
suit.Name = StringStuff.TerminalFriendlyString(suit.Name);
AddWearCommandFor(suit);
Plugin.X("Keyword for " + suit.Name + " updated");
}
else if (suit.Suit.syncedSuitID.Value < 0)
{
Misc.weirdSuitNum++;
Plugin.WARNING($"Skipping suit with invalid ID number: {suit.Suit.syncedSuitID.Value}");
}
else
{
Plugin.WARNING("Unexpected condition in CreateOldWearCommands!");
}
}
internal static void AddWearCommandFor(SuitAttributes suit)
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Expected O, but got Unknown
CommandManager val = new CommandManager(suit.Name, new List<string>(1) { "wear " + suit.Name }, (Func<string>)CommandHandler.SuitPickCommand, (ConfigEntry<bool>)null, 0, true);
val.AddAtAwake = false;
val.RegisterCommand();
}
internal static void CreateOldPageCommands()
{
if (SConfig.TerminalCommands.Value && !SConfig.AdvancedTerminalMenu.Value)
{
if ((Object)(object)Plugin.Terminal != (Object)null && !Misc.keywordsCreated)
{
StringBuilder suitsList = BuildSuitsList();
CreateSuitPages(suitsList);
Misc.keywordsCreated = true;
}
else if (Misc.keywordsCreated)
{
StringBuilder suitsList2 = BuildSuitsList();
UpdateOrRecreateSuitKeywords(suitsList2);
}
}
}
private static StringBuilder BuildSuitsList()
{
StringBuilder stringBuilder = new StringBuilder();
Misc.weirdSuitNum = 0;
foreach (SuitAttributes suits in AllSuits.suitListing.SuitsList)
{
if ((Object)(object)suits.Suit == (Object)null)
{
Plugin.WARNING(suits.Name + " contains NULL suit ref");
}
else if (!suits.HideFromTerminal)
{
if (suits.Suit.syncedSuitID.Value >= 0)
{
string name = suits.Name;
name = StringStuff.TerminalFriendlyString(name);
stringBuilder.AppendLine("> wear " + name + "\n");
}
else
{
Misc.weirdSuitNum++;
Plugin.X("Skipping suit.");
}
}
}
Plugin.X($"Full Suit List: {stringBuilder}");
return stringBuilder;
}
private static void CreateSuitPages(StringBuilder suitsList)
{
List<Page> list = PageSplitter.SplitTextIntoPages(suitsList.ToString(), 6);
if (!SConfig.TerminalCommands.Value)
{
return;
}
foreach (Page item in list)
{
if (item.PageNumber == 1)
{
CreateOrUpdateMainSuitCommand(item);
}
else
{
CreateOrUpdateSuitPage(item);
}
}
}
private static void UpdateOrRecreateSuitKeywords(StringBuilder suitsList)
{
List<Page> list = PageSplitter.SplitTextIntoPages(suitsList.ToString(), 6);
if (!SConfig.TerminalCommands.Value)
{
return;
}
foreach (Page item in list)
{
if (item.PageNumber == 1)
{
CreateOrUpdateMainSuitCommand(item);
}
else
{
CreateOrUpdateSuitPage(item);
}
}
}
private static void CreateOrUpdateMainSuitCommand(Page page)
{
CommandHandler.AddBasicCommand("suits (main)", "suits", $"{page.Content}", "other", "Display a listing of available suits to wear");
Plugin.X("Updating main suits command");
}
private static void CreateOrUpdateSuitPage(Page page)
{
Plugin.X($"Creating page {page.PageNumber} keyword");
CommandHandler.AddBasicCommand("suits (pg.{page.PageNumber})", $"suits {page.PageNumber}", $"{page.Content}");
}
internal static void MakeRandomSuitCommand()
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Expected O, but got Unknown
if (SConfig.RandomSuitCommand.Value)
{
CommandManager val = new CommandManager("suitsTerminal random", new List<string>(1) { "randomsuit" }, (Func<string>)CommandHandler.RandomSuit, SConfig.RandomSuitCommand, 0, true);
val.AddAtAwake = false;
val.RegisterCommand();
TerminalNode val2 = default(TerminalNode);
if (LogicHandling.TryGetFromAllNodes("OtherCommands", ref val2))
{
AddingThings.AddToExistingNodeText("\n>RANDOMSUIT\nsuitsTerminal equip a random suit", ref val2);
}
}
}
}
internal class SuitMenuItem : MenuItem
{
private string _name;
public bool _showEmpty;
private CustomEvent _selection;
private List<MenuItem> _nested;
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<MenuItem> NestedMenus
{
get
{
return _nested;
}
set
{
_nested = value;
}
}
public SuitMenuItem(string name, CustomEvent select = null)
{
_name = name;
_showEmpty = true;
_selection = select;
_nested = new List<MenuItem>();
((MenuItem)this)..ctor();
}
public void AddToBetterMenu()
{
if (AdvancedMenu.suitsMenu != null && AdvancedMenu.suitsMenu.AllMenuItemsOfType != null && !AdvancedMenu.suitsMenu.AllMenuItemsOfType.Contains((MenuItem)(object)this))
{
AdvancedMenu.suitsMenu.AllMenuItemsOfType.Add((MenuItem)(object)this);
}
}
public static void AddListToBetterMenu(List<SuitMenuItem> menuList)
{
AdvancedMenu.suitsMenu.AllMenuItemsOfType.AddRange((IEnumerable<MenuItem>)menuList);
}
internal static MenuItem GetStartMenu()
{
if (SConfig.MenuStartPage.Value == "favs")
{
return (MenuItem)(object)AdvancedMenu.FavoritesList;
}
if (SConfig.MenuStartPage.Value == "change")
{
return (MenuItem)(object)AdvancedMenu.SuitsList;
}
if (SConfig.MenuStartPage.Value == "help")
{
return (MenuItem)(object)AdvancedMenu.HelpPage;
}
return (MenuItem)(object)AdvancedMenu.HomePage;
}
}
internal class PictureInPicture
{
internal static bool PiPCreated;
internal static GameObject pipGameObject;
internal static int cullingMaskInt;
internal static Camera playerCam;
internal static RenderTexture camTexture;
internal static RawImage pipRawImage;
internal static bool pipActive;
internal static int heightStep;
internal static int zoomStep;
internal static int rotateStep;
internal static ShadowCastingMode shadowDefault;
internal static int modelLayerDefault;
internal static void InitPiP()
{
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
if (PiPCreated || !SConfig.EnablePiPCamera.Value)
{
return;
}
if ((Object)(object)Plugin.Terminal.terminalImage == (Object)null)
{
Plugin.WARNING("Original terminalImage not found");
return;
}
if ((Object)(object)pipGameObject != (Object)null && (Object)(object)pipGameObject.gameObject != (Object)null)
{
Object.Destroy((Object)(object)pipGameObject.gameObject);
}
pipGameObject = Object.Instantiate<GameObject>(((Component)Plugin.Terminal.terminalImage).gameObject, ((Component)Plugin.Terminal.terminalImage).transform.parent);
((Object)pipGameObject).name = "suitsTerminal PiP (Clone)";
if ((Object)(object)pipGameObject.GetComponent<VideoPlayer>() != (Object)null)
{
VideoPlayer component = pipGameObject.GetComponent<VideoPlayer>();
Object.Destroy((Object)(object)component);
Plugin.X("extra videoPlayer deleted");
}
pipRawImage = pipGameObject.GetComponent<RawImage>();
SetRawImageDimensionsAndPosition(((Graphic)pipRawImage).rectTransform, 0.45f, 0.33f, 95f, -20f);
((Graphic)pipRawImage).color = new Color(1f, 1f, 1f, 0.9f);
pipGameObject.SetActive(false);
PiPCreated = true;
}
private static void SetRawImageDimensionsAndPosition(RectTransform rectTransform, float heightPercentage, float widthPercentage, float anchoredPosX, float anchoredPosY)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: 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_0028: 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_0045: Unknown result type (might be due to invalid IL or missing references)
RectTransform component = ((Component)Plugin.Terminal.terminalUIScreen).GetComponent<RectTransform>();
Rect rect = component.rect;
float num = ((Rect)(ref rect)).height * heightPercentage;
rect = component.rect;
float num2 = ((Rect)(ref rect)).width * widthPercentage;
rectTransform.sizeDelta = new Vector2(num2, num);
rectTransform.anchoredPosition = new Vector2(anchoredPosX, anchoredPosY);
}
internal static void RotateCameraAroundPlayer(Transform playerTransform, Transform cameraTransform)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//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_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: 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_0053: Unknown result type (might be due to invalid IL or missing references)
Quaternion val = Quaternion.LookRotation(-playerTransform.right, playerTransform.up);
Quaternion rotation = val * cameraTransform.rotation;
cameraTransform.rotation = rotation;
Vector3 val2 = cameraTransform.position - playerTransform.position;
Vector3 position = playerTransform.position + val * val2;
cameraTransform.position = position;
}
internal static void ChangeCamZoom(Camera camera, ref int currentStep)
{
float[] array = new float[4] { 120f, 60f, 80f, 100f };
currentStep++;
if (currentStep >= array.Length)
{
currentStep = 0;
}
camera.fieldOfView = array[currentStep];
}
internal static void MoveCamera(Transform cameraTransform, ref int currentStep)
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
float[] array = new float[5] { 0f, 0.2f, -2.2f, -1.2f, -0.7f };
currentStep++;
if (currentStep >= array.Length)
{
currentStep = 0;
}
float y = ((Component)Plugin.Terminal.terminalImage).transform.position.y + array[currentStep];
Vector3 position = cameraTransform.position;
position.y = y;
cameraTransform.position = position;
}
internal static void TogglePiP(bool state)
{
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
if (!SConfig.EnablePiPCamera.Value || pipActive == state)
{
return;
}
Plugin.X($"TogglePiP: {state}");
pipActive = state;
((Behaviour)pipRawImage).enabled = state;
pipGameObject.SetActive(state);
if (Plugin.instance.OpenBodyCamsMod && SConfig.UseOpenBodyCams.Value)
{
Plugin.X($"OpenBodyCams detected, using OBC for Mirror (state:{state})");
OpenBodyCamFuncs.OpenBodyCamsMirrorStatus(state, SConfig.ObcResolution.Value, 0.1f, false, ref CamStuff.ObcCameraHolder);
if (!state)
{
return;
}
Camera cam = OpenBodyCamFuncs.GetCam(OpenBodyCamFuncs.TerminalMirrorCam);
cam.fieldOfView = 100f;
Plugin.X($"isActive [ Cam ] - {((Behaviour)cam).isActiveAndEnabled}");
pipRawImage.texture = OpenBodyCamFuncs.GetTexture(OpenBodyCamFuncs.TerminalMirrorCam);
}
else
{
if ((Object)(object)playerCam == (Object)null)
{
playerCam = CamStuff.HomebrewCam(ref camTexture, ref CamStuff.MyCameraHolder);
}
CamStuff.CamInitMirror(CamStuff.MyCameraHolder, playerCam, 0.1f, false);
CamStuff.HomebrewCameraState(state, playerCam);
if (state)
{
playerCam.fieldOfView = 100f;
pipRawImage.texture = (Texture)(object)playerCam.targetTexture;
}
if (!Plugin.instance.ModelReplacement)
{
if (state)
{
((Renderer)StartOfRound.Instance.localPlayerController.thisPlayerModel).shadowCastingMode = (ShadowCastingMode)0;
Plugin.Log.LogInfo((object)"Showing PlayerModel to player (player should be in terminal)");
}
else
{
((Renderer)StartOfRound.Instance.localPlayerController.thisPlayerModel).shadowCastingMode = shadowDefault;
Plugin.Log.LogInfo((object)"Hiding PlayerModel from player (PiP disabled or leaving suits menu)");
}
}
}
Plugin.X($"isActive [ pipGameObject ] - {pipGameObject.activeSelf}\nisActive [ pipRawImage ] {((Behaviour)pipRawImage).isActiveAndEnabled}\nisActive [ pipActive ] - {pipActive}");
}
}
}
namespace suitsTerminal.Suit_Stuff
{
internal class SuitListing
{
internal List<SuitAttributes> SuitsList = new List<SuitAttributes>();
internal List<UnlockableSuit> RawSuitsList = new List<UnlockableSuit>();
internal List<string> NameList = new List<string>();
internal List<string> FavList = new List<string>();
internal void ClearAll()
{
NameList.Clear();
SuitsList.ForEach(delegate(SuitAttributes x)
{
x.Reset();
});
}
internal bool Contains(int query, out SuitAttributes thisSuit)
{
foreach (SuitAttributes suits in SuitsList)
{
if (suits.UniqueID == query)
{
thisSuit = suits;
return true;
}
}
thisSuit = null;
return false;
}
internal bool Contains(UnlockableSuit query, out SuitAttributes thisSuit)
{
foreach (SuitAttributes suits in SuitsList)
{
if ((Object)(object)suits.Suit == (Object)(object)query)
{
thisSuit = suits;
return true;
}
}
thisSuit = null;
return false;
}
}
internal class SuitAttributes
{
internal SuitMenuItem menuItem;
internal CustomEvent SelectSuit = new CustomEvent();
internal UnlockableSuit Suit;
internal bool HideFromTerminal = false;
internal bool IsOnRack = false;
internal string Name = "placeholder";
internal int UniqueID = -1;
internal bool IsFav = false;
internal bool currentSuit = false;
internal void Reset()
{
HideFromTerminal = false;
IsOnRack = false;
currentSuit = false;
IsFav = false;
}
internal SuitAttributes(UnlockableSuit item, List<UnlockableItem> UnlockableItems, ref Dictionary<int, string> suitNameToID)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Expected O, but got Unknown
Suit = item;
Name = GetName(item, UnlockableItems, ref suitNameToID);
UniqueID = item.syncedSuitID.Value;
AllSuits.suitListing.NameList.Add(Name);
HideFromTerminal = ShouldHideTerm();
menuItem = new SuitMenuItem(Name, SelectSuit);
menuItem.AddToBetterMenu();
IsFav = IsFavorite();
if (!HideFromTerminal)
{
((MenuItem)menuItem).OnPageLoad = GetSuffix;
((MenuItem)menuItem).SetParentMenu((MenuItem)(object)AdvancedMenu.SuitsList);
if (IsFav)
{
((MenuItem)menuItem).AddNestedItem((MenuItem)(object)AdvancedMenu.FavoritesList);
}
SelectSuit.AddListener(new Event(WearSuit));
Plugin.X("SuitAttributes created for " + Name);
}
}
internal void WearSuit()
{
CommandHandler.BetterSuitPick(this);
}
internal void UpdateSuit(UnlockableSuit item, List<UnlockableItem> UnlockableItems, ref Dictionary<int, string> suitNameToID)
{
Suit = item;
Name = GetName(item, UnlockableItems, ref suitNameToID);
UniqueID = item.syncedSuitID.Value;
AllSuits.suitListing.NameList.Add(Name);
HideFromTerminal = ShouldHideTerm();
IsFav = IsFavorite();
menuItem.AddToBetterMenu();
((MenuItem)menuItem).Name = Name;
if (!((MenuItem)AdvancedMenu.SuitsList).NestedMenus.Contains((MenuItem)(object)menuItem))
{
if (!HideFromTerminal)
{
((MenuItem)menuItem).SetParentMenu((MenuItem)(object)AdvancedMenu.SuitsList);
if (IsFav)
{
((MenuItem)menuItem).AddNestedItem((MenuItem)(object)AdvancedMenu.FavoritesList);
}
}
}
else if (HideFromTerminal)
{
((MenuItem)menuItem).Parent = null;
((MenuItem)AdvancedMenu.SuitsList).NestedMenus.Remove((MenuItem)(object)menuItem);
if (((MenuItem)AdvancedMenu.FavoritesList).NestedMenus.Contains((MenuItem)(object)menuItem))
{
((MenuItem)AdvancedMenu.FavoritesList).NestedMenus.Remove((MenuItem)(object)menuItem);
}
}
Plugin.X("SuitAttributes updated for " + Name);
}
internal bool IsFavorite()
{
if (AllSuits.favsList.Count == 0)
{
return false;
}
if (AllSuits.favsList.Any((string x) => x.ToLower() == Name.ToLower()))
{
Plugin.X(Name + " is detected in favorites list");
if (!AllSuits.suitListing.FavList.Contains(Name))
{
AllSuits.suitListing.FavList.Add(Name);
}
return true;
}
if (AllSuits.suitListing.FavList.Contains(Name))
{
AllSuits.suitListing.FavList.Remove(Name);
}
Plugin.X(Name + " is *NOT* a favorite");
return false;
}
internal void RemoveFromFavs()
{
IsFav = false;
if (AllSuits.suitListing.FavList.Contains(Name))
{
AllSuits.suitListing.FavList.Remove(Name);
((MenuItem)AdvancedMenu.FavoritesList).NestedMenus.Remove((MenuItem)(object)menuItem);
}
}
internal void AddToFavs()
{
if (SConfig.AdvancedTerminalMenu.Value && menuItem == null)
{
Plugin.WARNING("menuItem is null for " + Name);
return;
}
IsFav = true;
if (!AllSuits.suitListing.FavList.Contains(Name))
{
AllSuits.suitListing.FavList.Add(Name);
if (!((MenuItem)AdvancedMenu.FavoritesList).NestedMenus.Contains((MenuItem)(object)menuItem))
{
((MenuItem)AdvancedMenu.FavoritesList).NestedMenus.Add((MenuItem)(object)menuItem);
}
Plugin.X("AddToFavs has added " + Name + "!");
}
}
internal bool ShouldHideTerm()
{
List<string> listToLower = CommonStringStuff.GetListToLower(CommonStringStuff.GetKeywordsPerConfigItem(SConfig.DontAddToTerminal.Value, ','));
if (listToLower.Any((string x) => x.ToLower() == Name.ToLower()))
{
return true;
}
return false;
}
internal void GetSuffix()
{
((MenuItem)menuItem).Suffix = string.Empty;
if (IsFav)
{
SuitMenuItem suitMenuItem = menuItem;
((MenuItem)suitMenuItem).Suffix = ((MenuItem)suitMenuItem).Suffix + " (*)";
}
if (currentSuit)
{
SuitMenuItem suitMenuItem2 = menuItem;
((MenuItem)suitMenuItem2).Suffix = ((MenuItem)suitMenuItem2).Suffix + " [EQUIPPED]";
}
}
internal static string GetName(UnlockableSuit item, List<UnlockableItem> UnlockableItems, ref Dictionary<int, string> suitNameToID)
{
string SuitName = UnlockableItems[item.syncedSuitID.Value].unlockableName;
if (AllSuits.suitListing.NameList.Any((string s) => s.ToLower() == SuitName.ToLower()) && SConfig.AdvancedTerminalMenu.Value)
{
SuitName += $"({item.syncedSuitID.Value})";
}
if (!SConfig.AdvancedTerminalMenu.Value)
{
SuitName = StringStuff.TerminalFriendlyString(SuitName);
}
if (!suitNameToID.ContainsKey(item.syncedSuitID.Value))
{
suitNameToID.Add(item.syncedSuitID.Value, SuitName);
}
else
{
Plugin.WARNING($"WARNING: duplicate suitID detected: {item.syncedSuitID.Value}\n{SuitName} will not be added to listing");
}
return SuitName;
}
}
}
namespace suitsTerminal.EventSub
{
internal class Subscribers
{
[CompilerGenerated]
private static class <>O
{
public static ParameterEvent<Terminal> <0>__OnTerminalAwake;
public static Event <1>__OnTerminalDisable;
public static Event <2>__OnTerminalDelayStart;
public static ParameterEvent<TerminalNode> <3>__OnLoadAffordable;
public static Event <4>__OnGameStart;
public static Event <5>__OnPlayerSpawn;
public static Event <6>__OnShipReset;
}
internal static void Subscribe()
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Expected O, but got Unknown
//IL_00ae: 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)
//IL_00b9: Expected O, but got Unknown
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Expected O, but got Unknown
//IL_00fa: 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_0105: Expected O, but got Unknown
EventManager.TerminalAwake.AddListener((ParameterEvent<Terminal>)OnTerminalAwake);
CustomEvent terminalDisable = EventManager.TerminalDisable;
object obj = <>O.<1>__OnTerminalDisable;
if (obj == null)
{
Event val = OnTerminalDisable;
<>O.<1>__OnTerminalDisable = val;
obj = (object)val;
}
terminalDisable.AddListener((Event)obj);
CustomEvent terminalDelayStart = EventManager.TerminalDelayStart;
object obj2 = <>O.<2>__OnTerminalDelayStart;
if (obj2 == null)
{
Event val2 = OnTerminalDelayStart;
<>O.<2>__OnTerminalDelayStart = val2;
obj2 = (object)val2;
}
terminalDelayStart.AddListener((Event)obj2);
EventManager.TerminalLoadIfAffordable.AddListener((ParameterEvent<TerminalNode>)TerminalGeneral.OnLoadAffordable);
CustomEvent gameNetworkManagerStart = EventManager.GameNetworkManagerStart;
object obj3 = <>O.<4>__OnGameStart;
if (obj3 == null)
{
Event val3 = OnGameStart;
<>O.<4>__OnGameStart = val3;
obj3 = (object)val3;
}
gameNetworkManagerStart.AddListener((Event)obj3);
CustomEvent playerSpawn = EventManager.PlayerSpawn;
object obj4 = <>O.<5>__OnPlayerSpawn;
if (obj4 == null)
{
Event val4 = OnPlayerSpawn;
<>O.<5>__OnPlayerSpawn = val4;
obj4 = (object)val4;
}
playerSpawn.AddListener((Event)obj4);
CustomEvent shipReset = EventManager.ShipReset;
object obj5 = <>O.<6>__OnShipReset;
if (obj5 == null)
{
Event val5 = OnShipReset;
<>O.<6>__OnShipReset = val5;
obj5 = (object)val5;
}
shipReset.AddListener((Event)obj5);
TerminalUpdatePatch.usePatch = true;
}
internal static void OnTerminalDelayStart()
{
DefaultSuit();
}
internal static void OnTerminalAwake(Terminal instance)
{
Plugin.Terminal = instance;
Plugin.X("Setting suitsTerminal.Terminal");
}
internal static void OnShipReset()
{
((MonoBehaviour)StartOfRound.Instance).StartCoroutine(Enums.DelayFixRack());
}
internal static void OnTerminalDisable()
{
Misc.suitsOnRack = 0;
Misc.hasLaunched = false;
Misc.hintOnce = false;
Misc.rackSituated = false;
PictureInPicture.PiPCreated = false;
AdvancedMenu.specialMenusActive = false;
Plugin.X("set initial variables");
ResetSuitPlacementVars(unlocksReset: true);
}
internal static void ResetSuitPlacementVars(bool unlocksReset)
{
if (AllSuits.suitListing.SuitsList.Count == 0)
{
return;
}
if (unlocksReset)
{
AllSuits.suitListing.ClearAll();
Plugin.X("suitlisting cleared!");
return;
}
AllSuits.suitListing.SuitsList.ForEach(delegate(SuitAttributes s)
{
s.IsOnRack = false;
});
Misc.rackSituated = false;
}
internal static void OnGameStart()
{
CompatibilityCheck();
}
private static void CompatibilityCheck()
{
Plugin.X("Compatibility Check!");
if (StartGame.SoftCompatibility("Hexnet.lethalcompany.suitsaver", ref Plugin.SuitSaver))
{
Plugin.X("Suitsaver compatibility enabled!\nDefaultSuit will not be loaded");
}
if (StartGame.SoftCompatibility("TooManySuits", ref Plugin.TooManySuits))
{
Plugin.X("TooManySuits Compatibility enabled!\nRack will be left untouched!");
}
}
internal static void DefaultSuit()
{
if (SConfig.DefaultSuit.Value.Length < 1 || SConfig.DefaultSuit.Value.ToLower() == "default")
{
return;
}
if (Plugin.SuitSaver)
{
Plugin.WARNING("Suitsaver detected, default suit will not be loaded.");
}
else if (AllSuits.suitListing.SuitsList.Any((SuitAttributes x) => x.Name.ToLower() == SConfig.DefaultSuit.Value.ToLower()))
{
SuitAttributes suit = AllSuits.suitListing.SuitsList.Find((SuitAttributes x) => x.Name.ToLower() == SConfig.DefaultSuit.Value.ToLower());
CommandHandler.BetterSuitPick(suit);
}
else
{
Plugin.WARNING("Could not set default suit to " + SConfig.DefaultSuit.Value);
}
}
internal static void OnPlayerSpawn()
{
if (!Misc.rackSituated)
{
Plugin.X("player loaded & rackSituated is false, fixing suits rack");
PiPStuff();
AdvancedMenu.InitBetterMenu();
InitThisPlugin.InitSuitsTerm();
PictureInPicture.InitPiP();
Misc.hasLaunched = true;
}
}
private static void PiPStuff()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
PictureInPicture.shadowDefault = ((Renderer)StartOfRound.Instance.localPlayerController.thisPlayerModel).shadowCastingMode;
PictureInPicture.modelLayerDefault = ((Component)StartOfRound.Instance.localPlayerController.thisPlayerModel).gameObject.layer;
}
}
internal class TerminalGeneral
{
internal static void OnLoadAffordable(TerminalNode node)
{
if (node.shipUnlockableID >= 0 && node.shipUnlockableID <= StartOfRound.Instance.unlockablesList.unlockables.Count && StartOfRound.Instance.unlockablesList.unlockables[node.shipUnlockableID].unlockableType == 0)
{
Plugin.X("suit purchase detected, refreshing suitsTerminal");
InitThisPlugin.InitSuitsTerm();
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
[CompilerGenerated]
internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
int ICollection.Count => _items.Length;
bool ICollection.IsSynchronized => false;
object ICollection.SyncRoot => this;
object IList.this[int index]
{
get
{
return _items[index];
}
set
{
throw new NotSupportedException();
}
}
bool IList.IsFixedSize => true;
bool IList.IsReadOnly => true;
int IReadOnlyCollection<T>.Count => _items.Length;
T IReadOnlyList<T>.this[int index] => _items[index];
int ICollection<T>.Count => _items.Length;
bool ICollection<T>.IsReadOnly => true;
T IList<T>.this[int index]
{
get
{
return _items[index];
}
set
{
throw new NotSupportedException();
}
}
public <>z__ReadOnlyArray(T[] items)
{
_items = items;
}
IEnumerator IEnumerable.GetEnumerator()
{
return ((IEnumerable)_items).GetEnumerator();
}
void ICollection.CopyTo(Array array, int index)
{
((ICollection)_items).CopyTo(array, index);
}
int IList.Add(object value)
{
throw new NotSupportedException();
}
void IList.Clear()
{
throw new NotSupportedException();
}
bool IList.Contains(object value)
{
return ((IList)_items).Contains(value);
}
int IList.IndexOf(object value)
{
return ((IList)_items).IndexOf(value);
}
void IList.Insert(int index, object value)
{
throw new NotSupportedException();
}
void IList.Remove(object value)
{
throw new NotSupportedException();
}
void IList.RemoveAt(int index)
{
throw new NotSupportedException();
}
IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
return ((IEnumerable<T>)_items).GetEnumerator();
}
void ICollection<T>.Add(T item)
{
throw new NotSupportedException();
}
void ICollection<T>.Clear()
{
throw new NotSupportedException();
}
bool ICollection<T>.Contains(T item)
{
return ((ICollection<T>)_items).Contains(item);
}
void ICollection<T>.CopyTo(T[] array, int arrayIndex)
{
((ICollection<T>)_items).CopyTo(array, arrayIndex);
}
bool ICollection<T>.Remove(T item)
{
throw new NotSupportedException();
}
int IList<T>.IndexOf(T item)
{
return ((IList<T>)_items).IndexOf(item);
}
void IList<T>.Insert(int index, T item)
{
throw new NotSupportedException();
}
void IList<T>.RemoveAt(int index)
{
throw new NotSupportedException();
}
}