From 0ea74f3088d2b302ab796ae02fffb5dfd4bc8a4f Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 7 Mar 2017 09:18:40 -0500 Subject: [PATCH] story stuff --- ShiftOS.WinForms/HackerCommands.cs | 137 +++++++++++++++++++++++ ShiftOS.WinForms/ShiftOS.WinForms.csproj | 1 + ShiftOS_TheReturn/SaveSystem.cs | 2 +- ShiftOS_TheReturn/Shiftorium.cs | 12 +- 4 files changed, 148 insertions(+), 4 deletions(-) create mode 100644 ShiftOS.WinForms/HackerCommands.cs diff --git a/ShiftOS.WinForms/HackerCommands.cs b/ShiftOS.WinForms/HackerCommands.cs new file mode 100644 index 0000000..ebe25a2 --- /dev/null +++ b/ShiftOS.WinForms/HackerCommands.cs @@ -0,0 +1,137 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using ShiftOS.Engine; +using ShiftOS.WinForms.Applications; + +namespace ShiftOS.WinForms +{ + [Namespace("l337")] + [RequiresUpgrade("hacker101_deadaccts")] + public static class HackerCommands + { + private static void writeSlow(string text) + { + Console.Write("[hacker101@undisclosed]: "); + foreach(var c in text.ToCharArray()) + { + Console.Write(c); + Thread.Sleep(125); + } + Console.WriteLine(); + Thread.Sleep(1000); + } + + [Story("hacker101_deadaccts")] + public static void DeadAccountsStory() + { + if (!terminalIsOpen()) + { + AppearanceManager.SetupWindow(new Terminal()); + } + + var t = new Thread(() => + { + Console.WriteLine("[sys@mud]: Warning: User connecting to system..."); + Thread.Sleep(75); + Console.WriteLine("[sys@mud]: UBROADCAST: Username: hacker101 - Sysname: undisclosed"); + Thread.Sleep(50); + Console.Write("--locking mud connection resources..."); + Thread.Sleep(50); + Console.WriteLine("...done."); + Console.Write("--locking user input... "); + Thread.Sleep(75); + TerminalBackend.PrefixEnabled = false; + TerminalBackend.InStory = true; + Console.WriteLine("...done."); + + 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("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?"); + writeSlow("That would be... uhh... " + SaveSystem.CurrentSave.CountUpgrades().ToString() + "."); + writeSlow("I'm probably freaking you out right now. You are probably thinking that you're unsafe and need to lock yourself down."); + writeSlow("But, don't worry, I mean no harm."); + writeSlow("In fact, I am a multi-user domain safety activist and security professional."); + writeSlow("I need your help with something."); + writeSlow("Inside the multi-user domain, every now and then these 'dead' user accounts pop up."); + writeSlow("They're infesting everything. They're in every legion, they infest chatrooms, and they take up precious hard drive space."); + writeSlow("Eventually there's going to be tons of them just sitting there taking over the MUD. We can't have that."); + writeSlow("It sounds like a conspiracy theory indeed, but it's true, in fact, these dead accounts hold some valuable treasures."); + writeSlow("I'm talking Codepoints, skins, documents, the possibilities are endless."); + writeSlow("I'm going to execute a quick sys-script that will show you how you can help get rid of these accounts, and also gain some valuable resources to help you on your digital frontier."); + writeSlow("This script will also show you the fundamentals of security exploitation and theft of resources - which if you want to survive in the multi-user domain is paramount."); + writeSlow("Good luck."); + Thread.Sleep(1000); + Console.WriteLine("--user disconnected"); + Thread.Sleep(75); + Console.WriteLine("--commands unlocked - check sos.help."); + Thread.Sleep(45); + SaveSystem.SaveGame(); + Console.Write("--unlocking user input..."); + Thread.Sleep(75); + Console.Write(" ..done"); + TerminalBackend.InStory = false; + TerminalBackend.PrefixEnabled = true; + Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); + StartHackerTutorial(); + }); + t.IsBackground = true; + t.Start(); + } + + internal static void StartHackerTutorial() + { + //nyi + } + + private static bool terminalIsOpen() + { + foreach(var win in AppearanceManager.OpenForms) + { + if (win.ParentWindow is Terminal) + return true; + } + return false; + } + } + + [Namespace("storydev")] + public static class StoryDevCommands + { + [Command("start", description = "Starts a story plot.", usage ="id:string")] + [RequiresArgument("id")] + [RemoteLock] + public static bool StartStory(Dictionary args) + { + Story.Start(args["id"].ToString()); + return true; + } + + [Command("unexperience", description = "Marks a story plot as not-experienced yet.", usage ="id:string")] + [RemoteLock] + [RequiresArgument("id")] + public static bool Unexperience(Dictionary args) + { + string id = args["id"].ToString(); + if (SaveSystem.CurrentSave.StoriesExperienced.Contains(id)) + { + Console.WriteLine("Unexperiencing " + id + "."); + SaveSystem.CurrentSave.StoriesExperienced.Remove(id); + SaveSystem.SaveGame(); + } + else + { + Console.WriteLine("Story ID not found."); + } + + return true; + } + } +} diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 7d4f0d3..4bc79a0 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -238,6 +238,7 @@ FakeSetupScreen.cs + Form diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index 9ae18a9..9f0b9b7 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -110,7 +110,7 @@ namespace ShiftOS.Engine ServerManager.GUIDReceived += (str) => { guidReceived = true; - Console.WriteLine("{CONNECTION_SUCCESSFUL}"); + Console.WriteLine("Connection successful."); }; try diff --git a/ShiftOS_TheReturn/Shiftorium.cs b/ShiftOS_TheReturn/Shiftorium.cs index 24fa123..198dcc7 100644 --- a/ShiftOS_TheReturn/Shiftorium.cs +++ b/ShiftOS_TheReturn/Shiftorium.cs @@ -204,10 +204,16 @@ namespace ShiftOS.Engine } try { - if (SaveSystem.CurrentSave.StoriesExperienced.Contains(id)) - return true; + if (SaveSystem.CurrentSave == null) + return false; - return SaveSystem.CurrentSave.Upgrades[id]; + if (SaveSystem.CurrentSave.StoriesExperienced == null) + SaveSystem.CurrentSave.StoriesExperienced = new List(); + + if (!SaveSystem.CurrentSave.StoriesExperienced.Contains(id)) + return SaveSystem.CurrentSave.Upgrades[id]; + + return true; } catch {