From 8db3a2e11c6cc58adb2b62fbce1c1f63426b674c Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 9 Mar 2017 09:48:45 -0500 Subject: Server-side scripts now get ran. --- ShiftOS_TheReturn/Scripting.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'ShiftOS_TheReturn/Scripting.cs') diff --git a/ShiftOS_TheReturn/Scripting.cs b/ShiftOS_TheReturn/Scripting.cs index 3ecf9d9..940e998 100644 --- a/ShiftOS_TheReturn/Scripting.cs +++ b/ShiftOS_TheReturn/Scripting.cs @@ -63,6 +63,19 @@ namespace ShiftOS.Engine.Scripting public dynamic Lua = new DynamicLua.DynamicLua(); public bool Running = true; + static LuaInterpreter() + { + ServerManager.MessageReceived += (msg) => + { + if(msg.Name == "run") + { + var cntnts = JsonConvert.DeserializeObject(msg.Contents); + var interp = new LuaInterpreter(); + interp.Execute(cntnts.script.ToString()); + } + }; + } + public static string CreateSft(string lua) { byte[] bytes = Encoding.UTF8.GetBytes(lua); -- cgit v1.2.3 From 02fd7a883b4592a2200c4f3e912e56bdc09bfdbc Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 9 Mar 2017 09:53:00 -0500 Subject: callback action can be fired when user closes infobox --- ShiftOS.WinForms/Applications/Dialog.cs | 6 +++++- ShiftOS_TheReturn/Infobox.cs | 6 +++--- ShiftOS_TheReturn/Scripting.cs | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) (limited to 'ShiftOS_TheReturn/Scripting.cs') diff --git a/ShiftOS.WinForms/Applications/Dialog.cs b/ShiftOS.WinForms/Applications/Dialog.cs index 26e3040..11fbf1e 100644 --- a/ShiftOS.WinForms/Applications/Dialog.cs +++ b/ShiftOS.WinForms/Applications/Dialog.cs @@ -76,12 +76,16 @@ namespace ShiftOS.WinForms.Applications btnok.Click += (o, a) => { AppearanceManager.Close(this); + OpenCallback?.Invoke(); }; } - public void Open(string title, string msg) + private Action OpenCallback = null; + + public void Open(string title, string msg, Action c = null) { + OpenCallback = c; new Dialog().OpenInternal(title, msg); } diff --git a/ShiftOS_TheReturn/Infobox.cs b/ShiftOS_TheReturn/Infobox.cs index 3e8fa30..e3308dc 100644 --- a/ShiftOS_TheReturn/Infobox.cs +++ b/ShiftOS_TheReturn/Infobox.cs @@ -55,11 +55,11 @@ namespace ShiftOS.Engine /// /// Infobox title /// Infobox message - public static void Show(string title, string message) + public static void Show(string title, string message, Action callback = null) { title = Localization.Parse(title); message = Localization.Parse(message); - _infobox.Open(title, message); + _infobox.Open(title, message, callback); } public static void PromptText(string title, string message, Action callback) @@ -89,7 +89,7 @@ namespace ShiftOS.Engine // Infobox Interface public interface IInfobox { - void Open(string title, string msg); + void Open(string title, string msg, Action callback = null); void PromptText(string title, string message, Action callback); void PromptYesNo(string title, string message, Action callback); } diff --git a/ShiftOS_TheReturn/Scripting.cs b/ShiftOS_TheReturn/Scripting.cs index 940e998..b3e5208 100644 --- a/ShiftOS_TheReturn/Scripting.cs +++ b/ShiftOS_TheReturn/Scripting.cs @@ -357,9 +357,9 @@ end"); [Exposed("infobox")] public class InfoboxFunctions { - public void show(string title, string message) + public void show(string title, string message, Action callback = null) { - Infobox.Show(title, message); + Infobox.Show(title, message, callback); } public void question(string title, string message, Action callback) -- cgit v1.2.3 From ea430ac9df46cf01c8c4f8502097057a8da42600 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 9 Mar 2017 10:33:44 -0500 Subject: mud diagnostics and user info --- ShiftOS_TheReturn/Scripting.cs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'ShiftOS_TheReturn/Scripting.cs') diff --git a/ShiftOS_TheReturn/Scripting.cs b/ShiftOS_TheReturn/Scripting.cs index b3e5208..bb65dc7 100644 --- a/ShiftOS_TheReturn/Scripting.cs +++ b/ShiftOS_TheReturn/Scripting.cs @@ -354,6 +354,35 @@ end"); } } + [Exposed("mud")] + public class MUDFunctions + { + public void sendDiagnostic(string src, string cat, object val) + { + ServerManager.SendMessage("diag_log", $"[{src}] <{cat}>: {val}"); + } + } + + [Exposed("userinfo")] + public class UserInfoFunctions + { + public string getUsername() + { + return SaveSystem.CurrentSave.Username; + } + + public string getSysname() + { + return SaveSystem.CurrentSave.SystemName; + } + + public string getEmail() + { + return getUsername() + "@" + getSysname(); + } + } + + [Exposed("infobox")] public class InfoboxFunctions { -- cgit v1.2.3 From a9754b7df28795b6bb2c5cfe04c1b38b19fb0d05 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 10 Mar 2017 12:29:28 -0500 Subject: Lock certain apps away when system offline. --- ShiftOS.WinForms/Applications/Artpad.cs | 1 + ShiftOS.WinForms/Applications/Chat.cs | 1 + ShiftOS.WinForms/Applications/Downloader.cs | 1 + ShiftOS.WinForms/Applications/FormatEditor.cs | 1 + ShiftOS.WinForms/Applications/GraphicPicker.cs | 1 + ShiftOS.WinForms/Applications/MUDControlCentre.cs | 1 + ShiftOS.WinForms/Applications/NameChanger.cs | 1 + ShiftOS.WinForms/Applications/Pong.cs | 1 + ShiftOS.WinForms/Applications/ShiftLetters.cs | 1 + ShiftOS.WinForms/Applications/ShiftLotto.cs | 1 + ShiftOS.WinForms/Applications/ShiftSweeper.cs | 1 + ShiftOS.WinForms/Applications/Shifter.cs | 1 + ShiftOS.WinForms/Applications/Shiftnet.cs | 1 + .../Applications/ShiftoriumFrontend.cs | 1 + ShiftOS.WinForms/HackerCommands.cs | 10 ++++++ ShiftOS.WinForms/WinformsWindowManager.cs | 18 ++++++++++ ShiftOS_TheReturn/AppLauncherDaemon.cs | 20 +++++++++--- ShiftOS_TheReturn/KernelWatchdog.cs | 38 +++++++++++++++++++++- ShiftOS_TheReturn/Scripting.cs | 7 ++-- 19 files changed, 100 insertions(+), 7 deletions(-) (limited to 'ShiftOS_TheReturn/Scripting.cs') diff --git a/ShiftOS.WinForms/Applications/Artpad.cs b/ShiftOS.WinForms/Applications/Artpad.cs index 6c1bc1c..71f7afb 100644 --- a/ShiftOS.WinForms/Applications/Artpad.cs +++ b/ShiftOS.WinForms/Applications/Artpad.cs @@ -41,6 +41,7 @@ using ShiftOS.Engine; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] [Launcher("Artpad", true, "al_artpad", "Graphics")] [RequiresUpgrade("artpad")] [WinOpen("artpad")] diff --git a/ShiftOS.WinForms/Applications/Chat.cs b/ShiftOS.WinForms/Applications/Chat.cs index 06a7873..caf8cd2 100644 --- a/ShiftOS.WinForms/Applications/Chat.cs +++ b/ShiftOS.WinForms/Applications/Chat.cs @@ -36,6 +36,7 @@ using ShiftOS.Engine; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] public partial class Chat : UserControl, IShiftOSWindow { public Chat(string chatId) diff --git a/ShiftOS.WinForms/Applications/Downloader.cs b/ShiftOS.WinForms/Applications/Downloader.cs index da90c6d..1f240bf 100644 --- a/ShiftOS.WinForms/Applications/Downloader.cs +++ b/ShiftOS.WinForms/Applications/Downloader.cs @@ -41,6 +41,7 @@ using System.IO.Compression; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] [Launcher("Downloader", false, null, "Networking")] [DefaultIcon("iconDownloader")] public partial class Downloader : UserControl, IShiftOSWindow diff --git a/ShiftOS.WinForms/Applications/FormatEditor.cs b/ShiftOS.WinForms/Applications/FormatEditor.cs index ef44b47..56b0253 100644 --- a/ShiftOS.WinForms/Applications/FormatEditor.cs +++ b/ShiftOS.WinForms/Applications/FormatEditor.cs @@ -34,6 +34,7 @@ using System.Windows.Forms; using ShiftOS.Engine; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] [Launcher("FormatEditor", true, "al_format_editor", "Games")] [RequiresUpgrade("format_editor")] [WinOpen("formateditor")] diff --git a/ShiftOS.WinForms/Applications/GraphicPicker.cs b/ShiftOS.WinForms/Applications/GraphicPicker.cs index 2dfe7ec..b3dd8bf 100644 --- a/ShiftOS.WinForms/Applications/GraphicPicker.cs +++ b/ShiftOS.WinForms/Applications/GraphicPicker.cs @@ -37,6 +37,7 @@ using ShiftOS.WinForms.Tools; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] [DefaultTitle("Choose graphic")] [DefaultIcon("icongraphicpicker")] public partial class GraphicPicker : UserControl, IShiftOSWindow { diff --git a/ShiftOS.WinForms/Applications/MUDControlCentre.cs b/ShiftOS.WinForms/Applications/MUDControlCentre.cs index 02fe868..e2668bd 100644 --- a/ShiftOS.WinForms/Applications/MUDControlCentre.cs +++ b/ShiftOS.WinForms/Applications/MUDControlCentre.cs @@ -38,6 +38,7 @@ using ShiftOS.WinForms.Tools; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] [RequiresUpgrade("mud_fundamentals")] [Launcher("MUD Control Centre", true, "al_mud_control_centre", "Networking")] [WinOpen("mud_control_centre")] diff --git a/ShiftOS.WinForms/Applications/NameChanger.cs b/ShiftOS.WinForms/Applications/NameChanger.cs index ca76e57..d7c99f7 100644 --- a/ShiftOS.WinForms/Applications/NameChanger.cs +++ b/ShiftOS.WinForms/Applications/NameChanger.cs @@ -38,6 +38,7 @@ using ShiftOS.WinForms.Tools; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] [Launcher("Name Changer", true, "al_name_changer", "Customization")] [RequiresUpgrade("name_changer")] [WinOpen("name_changer")] diff --git a/ShiftOS.WinForms/Applications/Pong.cs b/ShiftOS.WinForms/Applications/Pong.cs index af1e156..157ce8c 100644 --- a/ShiftOS.WinForms/Applications/Pong.cs +++ b/ShiftOS.WinForms/Applications/Pong.cs @@ -37,6 +37,7 @@ using ShiftOS.Objects; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] [Launcher("Pong", true, "al_pong", "Games")] [WinOpen("pong")] [DefaultIcon("iconPong")] diff --git a/ShiftOS.WinForms/Applications/ShiftLetters.cs b/ShiftOS.WinForms/Applications/ShiftLetters.cs index 700df7e..b5e9aa4 100644 --- a/ShiftOS.WinForms/Applications/ShiftLetters.cs +++ b/ShiftOS.WinForms/Applications/ShiftLetters.cs @@ -36,6 +36,7 @@ using System.Windows.Forms; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] [Launcher("ShiftLetters", false, null, "Games")] [RequiresUpgrade("shiftletters")] [WinOpen("shiftletters")] diff --git a/ShiftOS.WinForms/Applications/ShiftLotto.cs b/ShiftOS.WinForms/Applications/ShiftLotto.cs index 7acba3e..33f357f 100644 --- a/ShiftOS.WinForms/Applications/ShiftLotto.cs +++ b/ShiftOS.WinForms/Applications/ShiftLotto.cs @@ -35,6 +35,7 @@ using ShiftOS.Engine; namespace ShiftOS.WinForms.Applications { [Launcher("ShiftLotto", true, "al_shiftlotto", "Games")] + [MultiplayerOnly] [DefaultIcon("iconShiftLotto")] [RequiresUpgrade("shiftlotto")] [WinOpen("shiftlotto")] diff --git a/ShiftOS.WinForms/Applications/ShiftSweeper.cs b/ShiftOS.WinForms/Applications/ShiftSweeper.cs index b13880f..cf6d331 100644 --- a/ShiftOS.WinForms/Applications/ShiftSweeper.cs +++ b/ShiftOS.WinForms/Applications/ShiftSweeper.cs @@ -36,6 +36,7 @@ using ShiftOS.Engine; namespace ShiftOS.WinForms.Applications { [Launcher("ShiftSweeper", true, "al_shiftsweeper", "Games")] [RequiresUpgrade("shiftsweeper")] + [MultiplayerOnly] [WinOpen("shiftsweeper")] [DefaultIcon("iconShiftSweeper")] public partial class ShiftSweeper : UserControl, IShiftOSWindow { diff --git a/ShiftOS.WinForms/Applications/Shifter.cs b/ShiftOS.WinForms/Applications/Shifter.cs index 1adc75a..fe2bf20 100644 --- a/ShiftOS.WinForms/Applications/Shifter.cs +++ b/ShiftOS.WinForms/Applications/Shifter.cs @@ -40,6 +40,7 @@ using ShiftOS.WinForms.Tools; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] [Launcher("Shifter", true, "al_shifter", "Customization")] [RequiresUpgrade("shifter")] [WinOpen("shifter")] diff --git a/ShiftOS.WinForms/Applications/Shiftnet.cs b/ShiftOS.WinForms/Applications/Shiftnet.cs index 45f37d4..c1c81d5 100644 --- a/ShiftOS.WinForms/Applications/Shiftnet.cs +++ b/ShiftOS.WinForms/Applications/Shiftnet.cs @@ -38,6 +38,7 @@ using ShiftOS.WinForms.Tools; namespace ShiftOS.WinForms.Applications { [Launcher("Shiftnet", false, null, "Networking")] + [MultiplayerOnly] [DefaultIcon("iconShiftnet")] public partial class Shiftnet : UserControl, IShiftOSWindow { public Shiftnet() { diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs index b3724ae..0580b47 100644 --- a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs +++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs @@ -39,6 +39,7 @@ namespace ShiftOS.WinForms.Applications { [Launcher("Shiftorium", true, "al_shiftorium", "Utilities")] [RequiresUpgrade("shiftorium_gui")] + [MultiplayerOnly] [WinOpen("shiftorium")] [DefaultTitle("Shiftorium")] [DefaultIcon("iconShiftorium")] diff --git a/ShiftOS.WinForms/HackerCommands.cs b/ShiftOS.WinForms/HackerCommands.cs index 52d8568..d9504d3 100644 --- a/ShiftOS.WinForms/HackerCommands.cs +++ b/ShiftOS.WinForms/HackerCommands.cs @@ -668,5 +668,15 @@ namespace ShiftOS.WinForms return true; } + + [Command("experience", description = "Marks a story plot as experienced without triggering the plot.", usage ="{id:}")] + [RequiresArgument("id")] + [RemoteLock] + public static bool Experience(Dictionary args) + { + SaveSystem.CurrentSave.StoriesExperienced.Add(args["id"].ToString()); + SaveSystem.SaveGame(); + return true; + } } } diff --git a/ShiftOS.WinForms/WinformsWindowManager.cs b/ShiftOS.WinForms/WinformsWindowManager.cs index b8f0cae..eeaa6c9 100644 --- a/ShiftOS.WinForms/WinformsWindowManager.cs +++ b/ShiftOS.WinForms/WinformsWindowManager.cs @@ -106,6 +106,24 @@ namespace ShiftOS.WinForms return; } + foreach(var attr in form.GetType().GetCustomAttributes(true)) + { + if(attr is MultiplayerOnlyAttribute) + { + if(KernelWatchdog.MudConnected == false) + { + Infobox.PromptYesNo("Disconnected from MUD", "This application requires a connection to the MUD. Would you like to reconnect?", new Action((answer) => + { + if(answer == true) + { + KernelWatchdog.MudConnected = true; + SetupWindow(form); + } + })); + return; + } + } + } if (!Shiftorium.UpgradeAttributesUnlocked(form.GetType())) { diff --git a/ShiftOS_TheReturn/AppLauncherDaemon.cs b/ShiftOS_TheReturn/AppLauncherDaemon.cs index 7ef34c1..5e3bd72 100644 --- a/ShiftOS_TheReturn/AppLauncherDaemon.cs +++ b/ShiftOS_TheReturn/AppLauncherDaemon.cs @@ -66,12 +66,24 @@ namespace ShiftOS.Engine { foreach (var attr in type.GetCustomAttributes(false)) { - if (attr is LauncherAttribute) + bool isAllowed = true; + if(attr is MultiplayerOnlyAttribute) { - var launch = attr as LauncherAttribute; - if (launch.UpgradeInstalled) + if(KernelWatchdog.MudConnected == false) { - win.Add(new LauncherItem { DisplayData = launch, LaunchType = type }); + isAllowed = false; + + } + } + if (isAllowed == true) + { + if (attr is LauncherAttribute) + { + var launch = attr as LauncherAttribute; + if (launch.UpgradeInstalled) + { + win.Add(new LauncherItem { DisplayData = launch, LaunchType = type }); + } } } } diff --git a/ShiftOS_TheReturn/KernelWatchdog.cs b/ShiftOS_TheReturn/KernelWatchdog.cs index 1b59b25..e69c9ba 100644 --- a/ShiftOS_TheReturn/KernelWatchdog.cs +++ b/ShiftOS_TheReturn/KernelWatchdog.cs @@ -25,8 +25,44 @@ namespace ShiftOS.Engine } } + private static bool _mudConnected = true; + public static bool InKernelMode { get; private set; } - public static bool MudConnected { get; set; } + public static bool MudConnected + { + get + { + return _mudConnected; + } + set + { + if(value == false) + { + foreach(var win in AppearanceManager.OpenForms) + { + foreach(var attr in win.ParentWindow.GetType().GetCustomAttributes(true)) + { + if(attr is MultiplayerOnlyAttribute) + { + ConsoleEx.Bold = true; + ConsoleEx.Underline = false; + ConsoleEx.Italic = true; + ConsoleEx.ForegroundColor = ConsoleColor.Red; + Console.Write("Error:"); + ConsoleEx.Bold = false; + ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow; + Console.WriteLine("Cannot disconnect from multi-user domain because an app that depends on it is open."); + TerminalBackend.PrintPrompt(); + return; + } + } + } + } + + _mudConnected = value; + Desktop.PopulateAppLauncher(); + } + } public static bool IsSafe(Type type) { diff --git a/ShiftOS_TheReturn/Scripting.cs b/ShiftOS_TheReturn/Scripting.cs index bb65dc7..6768efb 100644 --- a/ShiftOS_TheReturn/Scripting.cs +++ b/ShiftOS_TheReturn/Scripting.cs @@ -67,11 +67,14 @@ namespace ShiftOS.Engine.Scripting { ServerManager.MessageReceived += (msg) => { - if(msg.Name == "run") + if (msg.Name == "run") { var cntnts = JsonConvert.DeserializeObject(msg.Contents); var interp = new LuaInterpreter(); - interp.Execute(cntnts.script.ToString()); + Desktop.InvokeOnWorkerThread(() => + { + interp.Execute(cntnts.script.ToString()); + }); } }; } -- cgit v1.2.3 From dad61e325cfcd1ce12ae6f29d3778d1c919c6ab3 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 11 Mar 2017 09:54:44 -0500 Subject: fix the hacker101 story some more --- ShiftOS.WinForms/Applications/TutorialBox.cs | 3 +++ ShiftOS.WinForms/HackerCommands.cs | 24 +++++++++++++++++++++--- ShiftOS_TheReturn/Scripting.cs | 4 ++++ 3 files changed, 28 insertions(+), 3 deletions(-) (limited to 'ShiftOS_TheReturn/Scripting.cs') diff --git a/ShiftOS.WinForms/Applications/TutorialBox.cs b/ShiftOS.WinForms/Applications/TutorialBox.cs index 25921e1..3c74443 100644 --- a/ShiftOS.WinForms/Applications/TutorialBox.cs +++ b/ShiftOS.WinForms/Applications/TutorialBox.cs @@ -21,6 +21,8 @@ namespace ShiftOS.WinForms.Applications InitializeComponent(); IsComplete = false; lbltuttext.Text = ""; + lbltuttext.Padding = new Padding(15); + lbltuttext.Margin = lbltuttext.Padding; } bool stillTyping = false; @@ -47,6 +49,7 @@ namespace ShiftOS.WinForms.Applications })); Thread.Sleep(75); } + Thread.Sleep(5000); stillTyping = false; }).Start(); } diff --git a/ShiftOS.WinForms/HackerCommands.cs b/ShiftOS.WinForms/HackerCommands.cs index f9d3bcc..e2c4d12 100644 --- a/ShiftOS.WinForms/HackerCommands.cs +++ b/ShiftOS.WinForms/HackerCommands.cs @@ -59,10 +59,25 @@ namespace ShiftOS.WinForms { private static void writeSlow(string text) { - Console.Write("[hacker101@undisclosed]: "); - Thread.Sleep(200); + ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow; + ConsoleEx.Bold = false; + ConsoleEx.Italic = false; + Console.Write("["); + ConsoleEx.ForegroundColor = ConsoleColor.Magenta; + ConsoleEx.Bold = true; + Console.Write("hacker101"); + ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow; + ConsoleEx.Italic = true; + Console.Write("@"); + ConsoleEx.ForegroundColor = ConsoleColor.White; + Console.Write("undisclosed"); + ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow; + ConsoleEx.Bold = false; + ConsoleEx.Italic = false; + Console.Write("]: "); + Thread.Sleep(850); Console.WriteLine(text); - Thread.Sleep(1000); + Thread.Sleep(4000); } [Story("hacker101_deadaccts")] @@ -121,9 +136,12 @@ namespace ShiftOS.WinForms TerminalBackend.PrefixEnabled = true; Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); StartHackerTutorial(); + TerminalBackend.PrefixEnabled = true; + TerminalBackend.PrintPrompt(); }); t.IsBackground = true; t.Start(); + TerminalBackend.PrefixEnabled = false; } internal static void StartHackerTutorial() diff --git a/ShiftOS_TheReturn/Scripting.cs b/ShiftOS_TheReturn/Scripting.cs index 6768efb..d96bc98 100644 --- a/ShiftOS_TheReturn/Scripting.cs +++ b/ShiftOS_TheReturn/Scripting.cs @@ -69,12 +69,16 @@ namespace ShiftOS.Engine.Scripting { if (msg.Name == "run") { + TerminalBackend.PrefixEnabled = false; var cntnts = JsonConvert.DeserializeObject(msg.Contents); var interp = new LuaInterpreter(); Desktop.InvokeOnWorkerThread(() => { interp.Execute(cntnts.script.ToString()); + }); + TerminalBackend.PrefixEnabled = true; + TerminalBackend.PrintPrompt(); } }; } -- cgit v1.2.3 From a1fa66f787a9298a67ab824303fd70f2b1bc5f79 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 20 May 2017 08:27:05 -0400 Subject: document scripting --- ShiftOS_TheReturn/Scripting.cs | 251 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 234 insertions(+), 17 deletions(-) (limited to 'ShiftOS_TheReturn/Scripting.cs') diff --git a/ShiftOS_TheReturn/Scripting.cs b/ShiftOS_TheReturn/Scripting.cs index d96bc98..dd5acfd 100644 --- a/ShiftOS_TheReturn/Scripting.cs +++ b/ShiftOS_TheReturn/Scripting.cs @@ -38,31 +38,65 @@ using System.Net; namespace ShiftOS.Engine.Scripting { + /// + /// Brings some C# goodies to the Lua system. + /// [Exposed("strutils")] public class StringUtils { + /// + /// Checks if a string ends with a specified string. + /// + /// The string to operate on + /// The string to check for + /// Whether ends with . public bool endswith(string operand, string value) { return operand.EndsWith(value); } + + /// + /// Checks if a string starts with a specified string. + /// + /// The string to operate on + /// The string to check for + /// Whether starts with . public bool startswith(string operand, string value) { return operand.StartsWith(value); } + /// + /// Checks if a string contains a specified string. + /// + /// The string to operate on + /// The string to check for + /// Whether contains . public bool contains(string operand, string value) { return operand.Contains(value); } } - + /// + /// DynamicLua wrapper for the ShiftOS engine. + /// public class LuaInterpreter { + /// + /// The DynamicLua backend. + /// public dynamic Lua = new DynamicLua.DynamicLua(); + + /// + /// Boolean representing whether the script is running. + /// public bool Running = true; + /// + /// Static constructor for the class. + /// static LuaInterpreter() { ServerManager.MessageReceived += (msg) => @@ -83,12 +117,21 @@ namespace ShiftOS.Engine.Scripting }; } + /// + /// Create a .SFT representation of a Lua script. + /// + /// The Lua code to convert + /// Base64 SFT representation. public static string CreateSft(string lua) { byte[] bytes = Encoding.UTF8.GetBytes(lua); return Convert.ToBase64String(bytes); } + /// + /// Run a compressed .SFT file as a lua script. + /// + /// The .sft file to run. public static void RunSft(string sft) { if (Utils.FileExists(sft)) @@ -108,8 +151,14 @@ namespace ShiftOS.Engine.Scripting } } + /// + /// Get the current working directory of the script. + /// public static string CurrentDirectory { get; private set; } + /// + /// Creates a new instance of the class. + /// public LuaInterpreter() { Lua(@"function totable(clrlist) @@ -128,6 +177,9 @@ end"); }; } + /// + /// Scans the engine, frontend, and all mods for Lua-exposed classes and functions. + /// public void SetupAPIs() { Lua.currentdir = (string.IsNullOrWhiteSpace(CurrentDirectory)) ? "0:" : CurrentDirectory; @@ -233,7 +285,10 @@ end"); }); } - + /// + /// Executes the specified file as an uncompressed Lua script. + /// + /// The file to execute. public void ExecuteFile(string file) { if (Utils.FileExists(file)) @@ -247,6 +302,10 @@ end"); } } + /// + /// Executes the specified string as a Lua script. + /// + /// The Lua code to execute. public void Execute(string lua) { try @@ -279,24 +338,46 @@ end"); } } + /// + /// Lua functions for .sft files. + /// [Exposed("sft")] public class SFTFunctions { + /// + /// Make a .sft file from a lua code string + /// + /// The Lua code + /// The resulting .sft string public string make(string lua) { return LuaInterpreter.CreateSft(lua); } + /// + /// Make a .sft string and save to a specified file. + /// + /// The Lua code to compress + /// The path to save the compressed .sft file to. public void makefile(string lua, string outpath) { Utils.WriteAllText(outpath, make(lua)); } + /// + /// Run a compressed .sft file in the . + /// + /// The .sft file to run. public void run(string inpath) { LuaInterpreter.RunSft(inpath); } + /// + /// Reads the specified .sft file and decompresses to it's Lua form. + /// + /// The .sft file to uncompress + /// The resulting Lua code. public string unmake(string sft) { if (Utils.FileExists(sft)) @@ -310,9 +391,17 @@ end"); } } + /// + /// Network functions for Lua. + /// [Exposed("net")] public class NetFunctions { + /// + /// Submit a GET request to the specified URL. + /// + /// The URL to open + /// The result from the server public string get(string url) { return new WebClient().DownloadString(url); @@ -320,26 +409,48 @@ end"); } + /// + /// Console functions for Lua. + /// [Exposed("console")] public class ConsoleFunctions { + /// + /// Write text to the console. + /// + /// The text to write. public void write(dynamic text) { Console.Write(text.ToString()); } + /// + /// Write text to the console, followed by a new line. + /// + /// The text to write. public void writeLine(dynamic text) { Console.WriteLine(text.ToString()); } } + /// + /// The main ShiftOS API. + /// [Exposed("sos")] public class SystemFunctions { + /// + /// Retrieves the user's Codepoints from the save file. + /// + /// The user's Codepoints. public long getCodepoints() { return SaveSystem.CurrentSave.Codepoints; } - + /// + /// Run a command in the Terminal. + /// + /// The command to run, using regular ShiftOS syntax. + /// Whether the command was found and ran. public bool runCommand(string cmd) { var args = TerminalBackend.GetArgs(ref cmd); @@ -347,6 +458,10 @@ end"); return TerminalBackend.RunClient(cmd, args); } + /// + /// Adds the specified amount of Codepoints to the save flie. + /// + /// The codepoints to add. public void addCodepoints(int cp) { if (cp > 100 || cp <= 0) @@ -361,128 +476,227 @@ end"); } } - [Exposed("mud")] - public class MUDFunctions - { - public void sendDiagnostic(string src, string cat, object val) - { - ServerManager.SendMessage("diag_log", $"[{src}] <{cat}>: {val}"); - } - } - + /// + /// User information API. + /// [Exposed("userinfo")] public class UserInfoFunctions { + /// + /// Gets the user name of the currently logged in user. + /// + /// The user's username. public string getUsername() { - return SaveSystem.CurrentSave.Username; + return SaveSystem.CurrentUser.Username; } + /// + /// Retrieves the user's system name. + /// + /// The user's system name. public string getSysname() { return SaveSystem.CurrentSave.SystemName; } + /// + /// Gets the user's ShiftOS email (username@sysname). + /// + /// The user's email. public string getEmail() { return getUsername() + "@" + getSysname(); } } - + /// + /// Infobox API for Lua. + /// [Exposed("infobox")] public class InfoboxFunctions { + /// + /// Show a message to the user in an Infobox. + /// + /// The title of the Infobox + /// The infobox's message + /// A function to run when the user clicks "OK" public void show(string title, string message, Action callback = null) { Infobox.Show(title, message, callback); } + /// + /// Ask a simple yes/no question to the user using an Infobox. + /// + /// The title of the Infobox + /// The infobox's message + /// A function to run when they choose an option. The boolean argument will be true if the user clicks Yes, and false if they click No. public void question(string title, string message, Action callback) { Infobox.PromptYesNo(title, message, callback); } - public void input(string title, string message, Action callback) + /// + /// Prompt the user for text using an Infobox. + /// + /// The infobox's title + /// The infobox's message + /// A function to run when the user clicks "OK". The string value is the text entered by the user. + /// Whether the text box should hide its characters as if it were a password box. + public void input(string title, string message, Action callback, bool isPassword = false) { - Infobox.PromptText(title, message, callback); + Infobox.PromptText(title, message, callback, isPassword); } } + /// + /// File Skimmer API for Lua. + /// [Exposed("fileskimmer")] public class FileSkimmerFunctions { + /// + /// Opens a File Skimmer "Open File" dialog. + /// + /// Semicolon-separated list of file extensions that the opener should let through the filter. + /// Function to be called when the user chooses a file. The string value is the file's path. public void openFile(string extensions, Action callback) { FileSkimmerBackend.GetFile(extensions.Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries), FileOpenerStyle.Open, callback); } + /// + /// Opens a File Skimmer "Save File" dialog. + /// + /// Semicolon-separated list of file extensions that the opener should let through the filter. + /// Function to be called when the user chooses a file. The string value is the file's path. public void saveFile(string extensions, Action callback) { FileSkimmerBackend.GetFile(extensions.Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries), FileOpenerStyle.Save, callback); } } + /// + /// ShiftFS API for Lua. + /// [Exposed("fs")] public class ShiftFSFunctions { + /// + /// Read all text in a file to a string. + /// + /// The file path to read + /// The string containing the file's contents. public string readAllText(string path) { return Utils.ReadAllText(path); } + /// + /// Copy a file from one place to another. + /// + /// The source file + /// The destination path public void copy(string i, string o) { Utils.WriteAllBytes(o, Utils.ReadAllBytes(i)); } + /// + /// Gets all files in the specified directory. + /// + /// The directory to search + /// A string array containing all file paths in the directory. public string[] getFiles(string dir) { return Utils.GetFiles(dir); } + /// + /// Gets all directories inside a directory. + /// + /// The directory to search + /// A string array containing all directory paths in the directory. public string[] getDirectories(string dir) { return Utils.GetDirectories(dir); } + /// + /// Read the binary contents of a file to a array. + /// + /// The file path to read. + /// The resulting byte array. public byte[] readAllBytes(string path) { return Utils.ReadAllBytes(path); } + /// + /// Writes the specified text to a file. + /// + /// The file path + /// The text to write public void writeAllText(string path, string contents) { Utils.WriteAllText(path, contents); } + /// + /// Writes the specified binary data to a file. + /// + /// The file path. + /// The binary data public void writeAllBytes(string path, byte[] contents) { Utils.WriteAllBytes(path, contents); } + /// + /// Determines whether the specified path exists and is a file. + /// + /// The path to search + /// The result of the search. public bool fileExists(string path) { return Utils.FileExists(path); } + /// + /// Determines whether the specified path exists and is a directory. + /// + /// The path to search + /// The result of the search. public bool directoryExists(string path) { return Utils.DirectoryExists(path); } + /// + /// Deletes the file/directory at the specified path. + /// + /// The path to delete public void delete(string path) { Utils.Delete(path); } + /// + /// Creates a new directory at the specified path. + /// + /// The path to create public void createDirectory(string path) { Utils.CreateDirectory(path); } } - + /// + /// Marks the specified class as a Lua API object. + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] public class ExposedAttribute : Attribute { /// @@ -494,6 +708,9 @@ end"); Name = name; } + /// + /// The API object's name + /// public string Name { get; private set; } } } -- cgit v1.2.3 From c7ba7d733c756d196f98dd4533289a1ef4db715f Mon Sep 17 00:00:00 2001 From: Rylan/wowmom98 Date: Sun, 28 May 2017 14:44:08 -0400 Subject: un obsoleting --- ShiftOS.Server/Core.cs | 3 ++- ShiftOS.WinForms/Applications/MUDControlCentre.cs | 16 ++++++++-------- ShiftOS.WinForms/Applications/Skin Loader.cs | 2 +- ShiftOS.WinForms/HackerCommands.cs | 8 ++++---- ShiftOS.WinForms/Oobe.cs | 2 +- ShiftOS.WinForms/Stories/LegionStory.cs | 2 +- ShiftOS_TheReturn/Commands.cs | 2 +- ShiftOS_TheReturn/Scripting.cs | 2 +- ShiftOS_TheReturn/ServerManager.cs | 4 ++-- ShiftOS_TheReturn/TerminalBackend.cs | 8 ++++---- 10 files changed, 25 insertions(+), 24 deletions(-) (limited to 'ShiftOS_TheReturn/Scripting.cs') diff --git a/ShiftOS.Server/Core.cs b/ShiftOS.Server/Core.cs index 7bb5b1d..a53a5bc 100644 --- a/ShiftOS.Server/Core.cs +++ b/ShiftOS.Server/Core.cs @@ -32,6 +32,7 @@ using NetSockets; using Newtonsoft.Json; using System.IO; using static ShiftOS.Server.Program; +using ShiftOS.Engine namespace ShiftOS.Server @@ -180,7 +181,7 @@ namespace ShiftOS.Server if (sve.EndsWith(".save")) { var save = JsonConvert.DeserializeObject(File.ReadAllText(sve)); - accs.Add($"{save.Username}@{save.SystemName}"); + accs.Add($"{ShiftOS.Engine.SaveSytem.CurrentUser.Username}@{save.SystemName}"); } } diff --git a/ShiftOS.WinForms/Applications/MUDControlCentre.cs b/ShiftOS.WinForms/Applications/MUDControlCentre.cs index ab89ffd..97212e7 100644 --- a/ShiftOS.WinForms/Applications/MUDControlCentre.cs +++ b/ShiftOS.WinForms/Applications/MUDControlCentre.cs @@ -100,7 +100,7 @@ namespace ShiftOS.WinForms.Applications { ServerManager.SendMessage("shop_removeowned", JsonConvert.SerializeObject(new { - username = SaveSystem.CurrentSave.Username + username = SaveSystem.CurrentUser.Username })); ShowCreateShop(); } @@ -290,7 +290,7 @@ namespace ShiftOS.WinForms.Applications creatingShop = true; editingShop.Name = "My shop"; editingShop.Description = "My shop has lots of awesome items. You should buy from my shop."; - editingShop.Owner = SaveSystem.CurrentSave.Username; + editingShop.Owner = SaveSystem.CurrentUser.Username; editingShop.Items = new List(); shop_editor.BringToFront(); PopulateShopEditor(); @@ -402,7 +402,7 @@ namespace ShiftOS.WinForms.Applications lbprice.Text = $"Cost: {item.Cost} CP"; btnbuy.Show(); }; - if(shop.Owner == SaveSystem.CurrentSave.Username) + if(shop.Owner == SaveSystem.CurrentUser.Username) { btneditshop.Show(); } @@ -560,7 +560,7 @@ namespace ShiftOS.WinForms.Applications you_systemstatus.BringToFront(); - lblsysstatus.Text = $@"Username: {SaveSystem.CurrentSave.Username} + lblsysstatus.Text = $@"Username: {SaveSystem.CurrentUser.Username} System name: {SaveSystem.CurrentSave.SystemName} Codepoints: {SaveSystem.CurrentSave.Codepoints} @@ -591,7 +591,7 @@ Current legions: {legionname}"; private void tsMemos_Click(object sender, EventArgs e) { ServerManager.SendMessage("get_memos_for_user", $@"{{ - username: ""{SaveSystem.CurrentSave.Username}"" + username: ""{SaveSystem.CurrentUser.Username}"" }}"); you_memos.BringToFront(); } @@ -812,7 +812,7 @@ Current legions: {legionname}"; { ServerManager.SendMessage("user_shop_check", JsonConvert.SerializeObject(new { - username = SaveSystem.CurrentSave.Username + username = SaveSystem.CurrentUser.Username })); } @@ -895,7 +895,7 @@ Current legions: {legionname}"; private void myShopToolStripMenuItem_Click(object sender, EventArgs e) { - ServerManager.SendMessage("user_get_shop", SaveSystem.CurrentSave.Username); + ServerManager.SendMessage("user_get_shop", SaveSystem.CurrentUser.Username); } private void btneditshop_Click(object sender, EventArgs e) @@ -923,7 +923,7 @@ Current legions: {legionname}"; { ServerManager.SendMessage("delete_save", JsonConvert.SerializeObject(new ClientSave { - Username = SaveSystem.CurrentSave.Username, + Username = SaveSystem.CurrentUser.Username, Password = SaveSystem.CurrentSave.Password })); diff --git a/ShiftOS.WinForms/Applications/Skin Loader.cs b/ShiftOS.WinForms/Applications/Skin Loader.cs index 90b05a1..e4f0597 100644 --- a/ShiftOS.WinForms/Applications/Skin Loader.cs +++ b/ShiftOS.WinForms/Applications/Skin Loader.cs @@ -306,7 +306,7 @@ namespace ShiftOS.WinForms.Applications System.IO.Directory.CreateDirectory(Paths.SharedFolder + "\\skins"); } - string path = Paths.SharedFolder + "\\skins\\" + SaveSystem.CurrentSave.Username + "-" + fname; + string path = Paths.SharedFolder + "\\skins\\" + SaveSystem.CurrentUser.Username + "-" + fname; System.IO.File.WriteAllText(path, JsonConvert.SerializeObject(LoadedSkin)); }))); diff --git a/ShiftOS.WinForms/HackerCommands.cs b/ShiftOS.WinForms/HackerCommands.cs index 86981f4..47b486d 100644 --- a/ShiftOS.WinForms/HackerCommands.cs +++ b/ShiftOS.WinForms/HackerCommands.cs @@ -107,7 +107,7 @@ namespace ShiftOS.WinForms Thread.Sleep(2000); writeSlow($"Hello there, fellow multi-user domain user."); writeSlow("My name, as you can tell, is hacker101."); - writeSlow("And yours must be... don't say it... it's " + SaveSystem.CurrentSave.Username + "@" + SaveSystem.CurrentSave.SystemName + ", right?"); + writeSlow("And yours must be... don't say it... it's " + SaveSystem.CurrentUser.Username + "@" + SaveSystem.CurrentSave.SystemName + ", right?"); writeSlow("Of course it is."); writeSlow("And I bet you 10,000 Codepoints that you have... " + SaveSystem.CurrentSave.Codepoints.ToString() + " Codepoints."); writeSlow("Oh, and how much upgrades have you installed since you first started using ShiftOS?"); @@ -135,7 +135,7 @@ namespace ShiftOS.WinForms Console.Write(" ..done"); TerminalBackend.InStory = false; TerminalBackend.PrefixEnabled = true; - Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); + Console.Write($"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); StartHackerTutorial(); TerminalBackend.PrefixEnabled = true; TerminalBackend.PrintPrompt(); @@ -454,7 +454,7 @@ namespace ShiftOS.WinForms var sve = JsonConvert.DeserializeObject(msg.Contents); if(sve.Password == pass) { - Console.WriteLine("Username: " + sve.Username); + Console.WriteLine("Username: " + SaveSystem.CurrentUser.Username); Console.WriteLine("Password: " + sve.Password); Console.WriteLine("System name: " + sve.SystemName); Console.WriteLine(); @@ -531,7 +531,7 @@ namespace ShiftOS.WinForms } sve.Codepoints -= amount; - SaveSystem.TransferCodepointsFrom(sve.Username, amount); + SaveSystem.TransferCodepointsFrom(SaveSystem.CurrentUser.Username, amount); ServerManager.SendMessage("mud_save_allow_dead", JsonConvert.SerializeObject(sve)); SaveSystem.SaveGame(); } diff --git a/ShiftOS.WinForms/Oobe.cs b/ShiftOS.WinForms/Oobe.cs index 9182b4b..90395a7 100644 --- a/ShiftOS.WinForms/Oobe.cs +++ b/ShiftOS.WinForms/Oobe.cs @@ -302,7 +302,7 @@ namespace ShiftOS.WinForms var client = new UniteClient("http://getshiftos.ml", token); var sve = new Save(); - sve.Username = client.GetEmail(); + SaveSystem.CurrentUser.Username = client.GetEmail(); sve.Password = Guid.NewGuid().ToString(); sve.SystemName = client.GetSysName(); sve.UniteAuthToken = token; diff --git a/ShiftOS.WinForms/Stories/LegionStory.cs b/ShiftOS.WinForms/Stories/LegionStory.cs index 53d55fb..433ad2d 100644 --- a/ShiftOS.WinForms/Stories/LegionStory.cs +++ b/ShiftOS.WinForms/Stories/LegionStory.cs @@ -142,7 +142,7 @@ namespace ShiftOS.WinForms.Stories { WriteLine("DevX@mud - user connecting to your system.", false); Thread.Sleep(2000); - WriteLine($"Hello, {SaveSystem.CurrentSave.Username}. It's been a while."); + WriteLine($"Hello, {SaveSystem.CurrentUser.Username}. It's been a while."); WriteLine("My intelligence suggests you've installed all GUI-based Shiftorium upgrades."); WriteLine("Bet you're liking ShiftOS now that the terminal isn't the only way you can control it."); WriteLine("Well, now it's time to introduce your next task."); diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs index 96e5af5..b97cd1d 100644 --- a/ShiftOS_TheReturn/Commands.cs +++ b/ShiftOS_TheReturn/Commands.cs @@ -95,7 +95,7 @@ namespace ShiftOS.Engine { TerminalBackend.IsForwardingConsoleWrites = forwarding; TerminalBackend.ForwardGUID = (forwarding == true) ? fGuid : null; - Console.WriteLine($"{SaveSystem.CurrentSave.Username} says \"{result}\"."); + Console.WriteLine($"{SaveSystem.CurrentUser.Username} says \"{result}\"."); TerminalBackend.IsForwardingConsoleWrites = false; }; Desktop.InvokeOnWorkerThread(new Action(() => diff --git a/ShiftOS_TheReturn/Scripting.cs b/ShiftOS_TheReturn/Scripting.cs index dd5acfd..61c6676 100644 --- a/ShiftOS_TheReturn/Scripting.cs +++ b/ShiftOS_TheReturn/Scripting.cs @@ -312,7 +312,7 @@ end"); { Console.WriteLine(""); Lua(lua); - Console.WriteLine($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); + Console.WriteLine($"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); } catch (Exception e) { diff --git a/ShiftOS_TheReturn/ServerManager.cs b/ShiftOS_TheReturn/ServerManager.cs index f0acaa2..abb674d 100644 --- a/ShiftOS_TheReturn/ServerManager.cs +++ b/ShiftOS_TheReturn/ServerManager.cs @@ -148,7 +148,7 @@ Ping: {ServerManager.DigitalSocietyPing} ms switch(msg.Name) { case "getguid_fromserver": - if(SaveSystem.CurrentSave.Username == msg.Contents) + if(SaveSystem.CurrentUser.Username == msg.Contents) { client.Send(new NetObject("yes_i_am", new ServerMessage { @@ -244,7 +244,7 @@ Ping: {ServerManager.DigitalSocietyPing} ms else if(msg.Name == "update_your_cp") { var args = JsonConvert.DeserializeObject>(msg.Contents); - if(args["username"] as string == SaveSystem.CurrentSave.Username) + if(args["username"] as string == SaveSystem.CurrentUser.Username) { SaveSystem.CurrentSave.Codepoints += (long)args["amount"]; Desktop.InvokeOnWorkerThread(new Action(() => diff --git a/ShiftOS_TheReturn/TerminalBackend.cs b/ShiftOS_TheReturn/TerminalBackend.cs index 1c024eb..6104927 100644 --- a/ShiftOS_TheReturn/TerminalBackend.cs +++ b/ShiftOS_TheReturn/TerminalBackend.cs @@ -581,7 +581,7 @@ namespace ShiftOS.Engine if (TerminalBackend.PrefixEnabled) { - text3 = text4.Remove(0, $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ".Length); + text3 = text4.Remove(0, $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ".Length); } IsForwardingConsoleWrites = true; if (TerminalBackend.InStory == false) @@ -590,7 +590,7 @@ namespace ShiftOS.Engine } if (TerminalBackend.PrefixEnabled) { - Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); + Console.Write($"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); } IsForwardingConsoleWrites = false; } @@ -605,7 +605,7 @@ namespace ShiftOS.Engine string pass = a["password"] as string; string sys = a["sysname"] as string; string guid = msg.GUID; - if (SaveSystem.CurrentSave.Username == uName && SaveSystem.CurrentSave.Password == pass && CurrentSave.SystemName == sys) + if (SaveSystem.CurrentUser.Username == uName && SaveSystem.CurrentSave.Password == pass && CurrentSave.SystemName == sys) { ForwardGUID = guid; ServerManager.SendMessage("trm_handshake_accept", $@"{{ @@ -615,7 +615,7 @@ namespace ShiftOS.Engine IsForwardingConsoleWrites = true; InvokeCommand("sos.status"); - Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); + Console.Write($"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); IsForwardingConsoleWrites = false; } } -- cgit v1.2.3