From 2932b3e2301e872dc079dcd8a66dd6def17ab737 Mon Sep 17 00:00:00 2001 From: william341 Date: Sat, 23 Jul 2016 14:06:31 -0700 Subject: WOO --- source/WindowsFormsApplication1/Apps/Terminal.cs | 2828 ++++++++++---------- .../WindowsFormsApplication1/Engine/SaveSystem.cs | 2 + 2 files changed, 1458 insertions(+), 1372 deletions(-) diff --git a/source/WindowsFormsApplication1/Apps/Terminal.cs b/source/WindowsFormsApplication1/Apps/Terminal.cs index 60fa066..93f6a13 100644 --- a/source/WindowsFormsApplication1/Apps/Terminal.cs +++ b/source/WindowsFormsApplication1/Apps/Terminal.cs @@ -37,64 +37,6 @@ namespace ShiftOS current_dir = Paths.SaveRoot; } - public void StartOtherPlayerStory() - { - var t = new ShiftUI.Timer(); - t.Interval = 4000; - int i = 0; - t.Tick += (object s, EventArgs a) => - { - switch(i) - { - case 0: - WriteLine("IP Address is connecting as '???'..."); - break; - case 1: - WriteLine("Connection established."); - break; - case 2: - WriteLine("???: Hi, ShiftOS user. I have something to tell you."); - break; - case 3: - WriteLine("???: I'm not a hacker. I'm not a programmer. I am just like you."); - break; - case 4: - WriteLine("???: I am... the Other Player."); - break; - case 5: - WriteLine("???: I too have heard DevX's story about ShiftOS being an experimental operating system."); - break; - case 6: - WriteLine("???: I have also met another user. We'll call him... I don't know... Robert."); - break; - case 7: - WriteLine("???: And this Robert guy, well, he knows a lot about ShiftOS, and DevX."); - break; - case 8: - WriteLine("???: Robert is a fake name I'm calling him. You might know him as Hacker101."); - break; - case 9: - WriteLine("???: Anyways, He told me about you, so I figured I would help you get out of this mess."); - break; - case 10: - WriteLine("???: He said he'll help me get my hard drive back, and get ShiftOS off my system. Once he does, I'll tell you."); - break; - case 11: - WriteLine("???: In the meantime, I have one word for you. Survive. Do NOT let DevX get to you. Do not fall for his tricks. Just play along until I contact you."); - break; - case 12: - WriteLine("???: I'll talk to you about this soon."); - break; - case 13: - t.Stop(); - this.Close(); - API.Upgrades["otherplayerstory1"] = true; - break; - } - i += 1; - }; - t.Start(); - } public bool ModLogger = false; @@ -102,14 +44,15 @@ namespace ShiftOS { objToWriteTo = this.txtterm; SaveSystem.Utilities.LoadedSave.newgame = false; - if(API.Upgrades["windowedterminal"] == true) + if (API.Upgrades["windowedterminal"] == true) { this.WindowState = FormWindowState.Normal; - } else + } + else { this.WindowState = FormWindowState.Maximized; } - + txtterm.KeyDown += new KeyEventHandler(txtterm_KeyPress); txtterm.Click += new EventHandler(txtterm_Click); tmrfirstrun.Tick += new EventHandler(tmrfirstrun_Tick); @@ -144,7 +87,8 @@ namespace ShiftOS if (a.Delta > 0) { ZoomMultiplier += 1; - } else + } + else { ZoomMultiplier -= 1; } @@ -159,16 +103,16 @@ namespace ShiftOS ResetTerminalFont(); StartLogCheck(); tmrsetfont.Start(); - + } - + private void StartLogCheck() { - if(ModLogger == true) + if (ModLogger == true) { - var tmrlog = new ShiftUI.Timer(); + var tmrlog = new System.Windows.Forms.Timer(); tmrlog.Interval = 500; tmrlog.Tick += (object s, EventArgs a) => { @@ -214,13 +158,13 @@ namespace ShiftOS WriteLine("User <65.48.121.24> connecting as 'Dana'"); API.PlaySound(Properties.Resources.dial_up_modem_02); WriteLine("Dana: Hey! That was quite the battle, huh?"); - BeepSleep(1000); + //BeepSleep(1000); WriteLine("Dana: Well - since you beat me, let me let you in on a little secret."); - BeepSleep(3000); + //BeepSleep(3000); WriteLine("Dana: ShiftOS's desktop may seem pretty complicated and customizable for you right now, but trust me. It gets better."); - BeepSleep(2500); + //BeepSleep(2500); WriteLine("Dana: I'm gonna patch your Shiftorium so you can get some neat upgrades!"); - BeepSleep(3000); + //BeepSleep(3000); WriteLine("Dana: Also, if you feel like doing more hacker battles, why not check out Tier 2 in the Network Browser?"); BeepSleep(2750); WriteLine("Dana: I've also added my network modules to your network - you'll just have to wait for them to regenerate."); @@ -249,11 +193,13 @@ namespace ShiftOS txtterm.Select(txtterm.TextLength, 0); } + // ERROR: Handles clauses are not supported in C# // ERROR: Handles clauses are not supported in C# private void txtterm_KeyPress(object sender, ShiftUI.KeyEventArgs e) { - if(e.Widget) { - if(API.Upgrades["zoomableterminal"] == true) + if (e.Widget) + { + if (API.Upgrades["zoomableterminal"] == true) { Zooming = true; } @@ -322,13 +268,14 @@ namespace ShiftOS e.SuppressKeyPress = true; trackpos = trackpos - 1; } - else { + else + { trackpos = trackpos - 2; } } else { - switch(SelectedMode) + switch (SelectedMode) { case 1: if (SelectedCharacter > 0) @@ -358,7 +305,8 @@ namespace ShiftOS trackpos += API.LastRanCommand.Length; txtterm.Select(txtterm.TextLength, 0); } - else { + else + { trackpos = trackpos - 1; } break; @@ -419,7 +367,7 @@ namespace ShiftOS } else { - switch(SelectedMode) + switch (SelectedMode) { case 1: ShiftOS.Hacking.StartHack(SelectedCharacter, UpgradeToHack); @@ -427,7 +375,7 @@ namespace ShiftOS break; case 2: var c = ShiftOS.Hacking.Characters[SelectedCharacter].Cost; - if(API.Codepoints >= c) + if (API.Codepoints >= c) { API.RemoveCodepoints(c); ShiftOS.Hacking.StartHackWithCharacter(SelectedCharacter, UpgradeToHack); @@ -445,10 +393,11 @@ namespace ShiftOS { trackpos = 0; var lua = txtterm.Lines[txtterm.Lines.Length - 1]; - try { + try + { Interpreter.mod(lua); } - catch(Exception ex) + catch (Exception ex) { WriteLine(ex.Message); } @@ -459,14 +408,17 @@ namespace ShiftOS txtterm.Select(txtterm.TextLength, 0); } } - else { + else + { if (e.KeyCode == Keys.Back) { } - else { - if (Viruses.InfectedWith("keyboardfucker")) { + else + { + if (Viruses.InfectedWith("keyboardfucker")) + { var rnd = new Random(); - if(rnd.Next(0, 20) == 10) + if (rnd.Next(0, 20) == 10) { e.Handled = true; txtterm.Text += Viruses.KeyboardInceptor.Intercept(); @@ -477,7 +429,8 @@ namespace ShiftOS trackpos += 1; } } - else { + else + { trackpos = trackpos + 1; } } @@ -489,12 +442,14 @@ namespace ShiftOS { e.SuppressKeyPress = true; } - else { + else + { if (txtterm.SelectedText.Length < 1) { trackpos = trackpos - 1; } - else { + else + { e.SuppressKeyPress = true; } } @@ -508,930 +463,534 @@ namespace ShiftOS } - internal void StartShellShock() + public void SetPrefix(string _prefix) + { + prefix = _prefix; + } + + + /// + /// Call after creating a Terminal to let Maureen Fenn talk + /// to the player about the Shiftnet and the Appscape Package Manager. + /// + public void StartShiftnetStory() { + System.Windows.Forms.Timer tmrstory = new System.Windows.Forms.Timer(); + tmrstory.Interval = 10000; + WriteLine("IP connecting as 'Maureen Fenn'..."); + API.PlaySound(Properties.Resources.dial_up_modem_02); var t = new Thread(new ThreadStart(new Action(() => { - Thread.Sleep(300); - WriteLine("Sending false packet to shiftnet://devx/tracker..."); - Thread.Sleep(100); - WriteLine("Awaiting reply from server..."); - Thread.Sleep(5000); - WriteLine("Got reply with header \"SOS_TRK_GET\"."); - Thread.Sleep(50); - WriteLine("[kernel] Sending usage log to server..."); - WriteLine("Intercepting outgoing request..."); - Thread.Sleep(200); - WriteLine("Got packet contents..."); - Thread.Sleep(25); - WriteLine("Sifting..."); - Thread.Sleep(500); - WriteLine("Found connection data for shiftnet://devx/tracker."); - Thread.Sleep(100); - WriteLine(@"Username: devx -Password: z7fjsd3"); - Thread.Sleep(100); - WriteLine("Authenticating with SSH server on shiftnet://devx/tracker running Arch Linux x86_64..."); - Thread.Sleep(1000); - WriteLine("[SSH] Access granted."); - Thread.Sleep(100); - WriteLine($"[Message] ???: We're in. In about 75 seconds DevX's server will go down. It'll be quite cool actually, Don't know if you've ever seen a forkbomb in action, but because you're in an SSH session with DevX's server and I'm also controlling the same session you're gonna see one. Oh, yeah, this server's the only one of his that doesn't actually run ShiftOS."); - Thread.Sleep(25000); - this.Invoke(new Action(() => - { - txtterm.Text = ""; - })); - int i = 60; - while(i >= 1) - { - Thread.Sleep(1000); - WriteLine($"Beginning attack on server in {i} seconds."); - i -= 1; - } - WriteLine("[devx@tracker ~]$ "); - string cmd = ":`(`)`{` `:`|`:` `&` `}`;`:"; //yep. I'm pretending to use a forkbomb on DevX's server. This'll be FUN to code. - foreach(string c in cmd.Split('`')) - { - Thread.Sleep(100); - this.Invoke(new Action(() => - { - txtterm.Text += c; - })); - } - WriteLine("[devx@tracker ~]$ "); - WriteLine("[Message] ???: Alright. I entered the command for you. Looks like it did nothing. DevX wouldn't even know what's happening... but keep your terminal open for 30 seconds."); - Thread.Sleep(30000); + WriteLine("Maureen Fenn: Hey there, user! I have something to show you."); + BeepSleep(4000); + WriteLine("Maureen Fenn: So, there's this thing called the 'Shiftnet'"); + BeepSleep(3750); + WriteLine("Maureen Fenn: Turns out, that DevX wants to keep it a secret, as such he only installed it on his and my systems."); + BeepSleep(4250); + WriteLine("Maureen Fenn: But what's the point of listening to DevX when we have people like you who like to experiment?"); + BeepSleep(4000); + WriteLine("Maureen Fenn: Well, to be fair - he can destroy whatever he wants. Just like he did my company, Minimatch."); + BeepSleep(3000); + WriteLine("Maureen Fenn: But who cares! I'm going to install a few things on your system."); + API.Upgrades["shiftnet"] = true; this.Invoke(new Action(() => { - FinalMission.EndGameHandler.GoToNextObjective(); + this.command = "spkg install shiftnet"; + this.DoCommand(); })); - int progress = 0; - while(progress <= 10000) - { - int r = new Random().Next(0, 1); - switch(r) - { - case 0: - WriteLine("-bash: fork: Resource temporarily unavailable"); - break; - case 1: - WriteLine("-bash: fork: retry: Resource temporarily unavailable"); - break; - } - Thread.Sleep(progress / 10); - progress++; - } - WriteLine("[SSH] Connection to server dropped."); + WriteLine("Shiftnet installed on system..."); + Thread.Sleep(4000); + WriteLine("Maureen Fenn: All done! Oh - just before I leave... go ahead and explore the Shiftnet!"); + BeepSleep(3000); + WriteLine("Maureen Fenn: But, be careful. Don't venture off the main server. You never know what's elsewhere..."); + BeepSleep(1000); + WriteLine("Maureen Fenn: Well, bye!"); this.Invoke(new Action(() => { - FinalMission.EndGameHandler.GoToNextObjective(); + API.CurrentSession.SetupDesktop(); + this.Close(); })); - this.Invoke(new Action(() => { this.Close(); })); }))); t.Start(); } - public void SetPrefix(string _prefix) + /// + /// *BEEP* ZZZZZZZZzzzzzzzzzzz....... + /// + /// Time to sleep. + private void BeepSleep(int time) { - prefix = _prefix; + API.PlaySound(Properties.Resources.writesound); + //Thread.Sleep(time); } - internal void StartBridgeToMidGame() + private LuaInterpreter Interpreter = null; + private bool blockctrlt = false; + + private List GetFonts() { - var t2 = new ShiftUI.Timer(); - t2.Interval = 4000; - int i2 = 0; - t2.Tick += (object s, EventArgs e) => + var lst = new List(); + // Get the installed fonts collection. + InstalledFontCollection allFonts = new InstalledFontCollection(); + + // Get an array of the system's font familiies. + FontFamily[] fontFamilies = allFonts.Families; + + // Display the font families. + foreach (FontFamily myFont in fontFamilies) { - switch (i2) - { - case 0: - if(API.Upgrades["hacker101"] == true) - { - WriteLine("Hacker101: Hello. We meet again. The Other Player told me about your situation."); - } - else - { - API.Upgrades["hacker101"] = true; - WriteLine("Hacker101: The Other Player told me about your situation."); - } - break; - case 1: - WriteLine("Hacker101: Lemme guess. DevX found out about you having the Shiftnet, didn't he..."); - break; - case 2: - WriteLine("Hacker101: Well I guess we'll have to fight fire with fire. You remember that person who told you about Hacker Battles?"); - break; - case 3: - WriteLine("Hacker101: It's time you know who he is. He is, in fact, me, and to continue on about Hacker Battles..."); - break; - case 4: - WriteLine("Hacker101: I can help you take down DevX, but we'll need to take down his defenses and get into his network."); - break; - case 5: - WriteLine("Hacker101: DevX's network of servers is larger than any datacenter on Earth, and it'll take time to plan the perfect attack."); - break; - case 6: - WriteLine("Hacker101: Think of it this way. DevX has a network of networks, each with their own leader."); - break; - case 7: - WriteLine("Hacker101: I can help you find these networks, but it's up to you to take 'em down."); - break; - case 8: - WriteLine("Hacker101: Of course, it's hard to hack a network if you don't know how to start a battle."); - break; - case 9: - WriteLine("Hacker101: Introducing the Battle Preparation Screen."); - break; - case 10: - WriteLine("Hacker101: It'll show you any network I've found, and it'll tell you some useful info about it."); - break; - case 11: - WriteLine("Hacker101: However the spkg package for this thing is HUGE, and will require lots of tweaks to the ShiftOS desktop. spkg will hopefully administer the tweaks for you, but here's a rundown of what'll happen."); - break; - case 12: - WriteLine("Hacker101: For one, you'll be able to have multiple desktop panels to fit more widgets on them."); - break; - case 13: - WriteLine("Hacker101: And if you have the App Launcher, it will get sorted so it doesn't take up the entire screen when you get so many applications installed."); - break; - case 14: - WriteLine("Hacker101: And the rest is a surprise. I'll initiate the install sequence."); - break; - case 15: - InstallMidGameDesktop(); - break; - } - i2 += 1; - }; - - var t = new ShiftUI.Timer(); - t.Interval = 4000; - int i = 0; - - t.Tick += (object s, EventArgs a) => - { - - - switch (i) - { - case 0: - WriteLine("IP connecting as Hacker101..."); - break; - case 1: - WriteLine("Hacker101: Hello, ShiftOS user. I am a hacker."); - break; - case 2: - if (API.BitnoteAddress != null) - { - WriteLine($"Hacker101: I can prove it. You have {API.Codepoints} Codepoints, your Bitnote Address is {API.BitnoteAddress.Address}, and you have {API.BitnoteAddress.Bitnotes}. That's your private address, by the way."); - } - else - { - WriteLine($"Hacker101: I can prove it. You have {API.Codepoints} Codepoints, and you do not have a Bitnote Address."); - } - break; - case 3: - WriteLine("Hacker101: Enough fun in games. Listen. There are two things you need to know."); - break; - case 4: - WriteLine("Hacker101: Thing #1. DevX isn't real."); - break; - case 5: - WriteLine("Hacker101: I've decompiled parts of ShiftOS. And you know what I found?"); - break; - case 6: - WriteLine("Hacker101: Everything DevX says. Everything he does. Everything he THINKS. It's all hardcoded directly into ShiftOS's core."); - break; - case 7: - WriteLine("Hacker101: Want proof? Here. I'll run a quick Lua script for you."); - string DecompiledCode = Properties.Resources.DecompiledCode; - var l = new LuaInterpreter(); - Form win = l.mod.create_window("Decompiled Code", null, 720, 480); - TextBox txt = new TextBox(); - txt.Multiline = true; - txt.Text = Properties.Resources.DecompiledCode; - txt.BorderStyle = BorderStyle.None; - txt.BackColor = Color.Black; - txt.ForeColor = Color.White; - txt.Font = new Font(OSInfo.GetMonospaceFont(), 9); - l.mod.set_dock(txt, "fill"); - l.mod.add_widget_to_window(win, txt); - break; - case 8: - WriteLine("Hacker101: Not only is that some nice, smokin' fresh C# code directly from ShiftOS, but that's a nice steaming pile of bird poop on DevX's doorstep."); - break; - case 9: - WriteLine("Hacker101: Thing #2. The Shiftnet holds some secrets."); - break; - case 10: - WriteLine("Hacker101: What kind of secrets, I hear you ask through your microphone (jesus, do you seriously talk to us with your voice? Are you that bored?)"); - break; - case 11: - WriteLine("Hacker101: Well. I'm talking, pieces of a Lua script that could help stop DevX dead in his digital tracks."); - break; - case 12: - WriteLine("Hacker101: All you gotta do is use my decryption utilities to find the pieces of this encrypted script, download them, decrypt them, and the utility will automatically piece them together for you."); - break; - case 13: - WriteLine("Hacker101: Shiftnet pages ending with .enc are your best bet."); - break; - case 14: - WriteLine("Hacker101: You can install the utilities using spkg install secret."); - break; - case 15: - WriteLine("Hacker101: Then, when the application installs, run it, and use the password 'binary_hell' to install the REAL utilities."); - break; - case 16: - WriteLine("Hacker101: Anyways, that wraps that up. But hang on. One more thing..."); - t.Stop(); - ShiftOS.Hacking.AddCharacter(new Character("Hacker101", "Let's get the job done.", 75, 45, 5)); - t2.Start(); - break; - } - i += 1; - }; - if(API.Upgrades["hacker101"] == true) - { - t2.Start(); - } - else - { - t.Start(); + lst.Add(myFont.Name.ToLower()); } + //font_family - + return lst; } - private void InstallMidGameDesktop() + public List GetColorList() { - //throw new NotImplementedException(); + var lst = new List(); + if (API.Upgrades["red"] == true) + lst.Add("red"); + if (API.Upgrades["green"] == true) + lst.Add("green"); + if (API.Upgrades["blue"] == true) + lst.Add("blue"); + if (API.Upgrades["brown"] == true) + lst.Add("brown"); + if (API.Upgrades["purple"] == true) + lst.Add("purple"); + if (API.Upgrades["yellow"] == true) + lst.Add("yellow"); + if (API.Upgrades["orange"] == true) + lst.Add("orange"); + if (API.Upgrades["pink"] == true) + lst.Add("pink"); + if (API.Upgrades["gray"] == true) + lst.Add("gray"); + lst.Add("black"); + lst.Add("white"); + return lst; } - int SelectedMode = 0; - int SelectedCharacter = 0; + public Color SetColor(string name) + { + Color col = Color.White; + switch (name) + { + case "black": + col = Color.Black; + break; + case "white": + col = Color.White; + break; + case "gray": + col = Color.Gray; + break; + case "red": + col = Color.Red; + break; + case "green": + col = Color.Green; + break; + case "blue": + col = Color.Blue; + break; + case "brown": + col = Color.Brown; + break; + case "purple": + col = Color.Purple; + break; + case "yellow": + col = Color.Yellow; + break; + case "orange": + col = Color.Orange; + break; + } + return col; + } - public void ShowChar() + private bool LuaMode = false; + + public string GetPath(string path) { - txtterm.Text = ""; - var h = ShiftOS.Hacking.Characters[SelectedCharacter]; - WriteLine(" == Partner Select =="); - WriteLine($"Partner: {SelectedCharacter + 1}/{ShiftOS.Hacking.Characters.Count}"); - WriteLine($"Name: {h.Name}"); - WriteLine($"Skill: {h.Skill}/100"); - WriteLine($"Speed: {h.Speed}/100"); - WriteLine($"Cost: {h.Cost}"); - WriteLine($"Bio: {h.Bio}"); - WriteLine(Environment.NewLine + "LEFT: Previous Partner, RIGHT: Next Partner, ENTER: Confirm"); + return path.Replace(Paths.SaveRoot, "").Replace(OSInfo.DirectorySeparator, "/"); } - public void ShowTools() + public string GetParent(string path) { - txtterm.Text = ""; - try + if (new DirectoryInfo(path).Parent.FullName.Contains("ShiftOS")) { - var h = ShiftOS.Hacking.Tools[SelectedCharacter]; - WriteLine(" == Attack Select =="); - WriteLine($"Attack: {SelectedCharacter + 1}/{ShiftOS.Hacking.Tools.Count}"); - WriteLine($"Name: {h.Name}"); - WriteLine($"Effectiveness: {h.Effectiveness}"); - WriteLine($"Description: {h.Description}"); - WriteLine(Environment.NewLine + "LEFT: Previous Attack, RIGHT: Next Attack, ENTER: Confirm"); + var d = new DirectoryInfo(path); + return d.Parent.FullName; } - catch + else { - WriteLine("There are no entries to display in this list."); + return path; } } - private void Hack_ShowCharacters() + public void DoCommand() { - switch(SelectedMode) + //Grab the type of this class using Reflection. + var terminal = this.GetType(); + string[] cmdargs = command.Split(' '); + var method_info = terminal.GetMethod("cmd_" + cmdargs[0].ToLower()); + if (method_info != null) { - case 1: - ShiftOS.Hacking.GetCharacters(); - SelectedCharacter = 0; - ShowTools(); - break; - case 2: - ShiftOS.Hacking.GetCharacters(); - SelectedCharacter = 0; - ShowChar(); - break; + method_info.Invoke(this, new object[] { cmdargs }); + } + else + { + terminal.GetMethod("cmd_default").Invoke(this, new object[] { cmdargs }); } } - internal void StartAidenNirhStory() + #region Terminal command methods + + /* + * Adding terminal commands has been changed. + * + * It's now done in a way that doesn't require hardcoding. + * + * Simply add a new method here with a prefix 'cmd_', for example 'cmd_05tray', and + * one argument of type 'string[]'. Then, put all the stuff you want your command to + * do in that method, and try running your command (without the 'cmd_' prefix) in the + * Terminal and it should work just fine. + * + * Thanks to @carverh for inspiring this by making all commands their own function. + */ + + public void cmd_dir(String[] args) { - var t = new ShiftUI.Timer(); - t.Interval = 4000; - int i = 0; - t.Tick += (object s, EventArgs a) => + if (API.Upgrades["fileskimmer"]) { - switch(i) + foreach (var d in Directory.GetDirectories(current_dir)) { - case 0: - WriteLine("User 151.43.85.33 connecting as \"Aiden\"..."); - break; - case 2: - WriteLine($"Aiden: Hey there, {API.Username}1 I'm Aiden Nirh."); - break; - case 3: - WriteLine("Aiden: Have you seen Appscape?"); - break; - case 4: - WriteLine("Aiden: It's my package manager for ShiftOS. It's pretty neat."); - break; - case 5: - WriteLine("Aiden: You should check it out, it's on the Shiftnet at shiftnet://main/appscape!"); - break; - case 6: - WriteLine("Aiden: But remember, when browsing the Shiftnet try not to venture from the main server!"); - break; - case 7: - API.Upgrades["aidennirh"] = true; - t.Stop(); - this.Close(); - break; + WriteLine($"[DIR] {new DirectoryInfo(d).Name}"); } - i += 1; - }; - t.Start(); + foreach (var d in Directory.GetFiles(current_dir)) + { + WriteLine($"{new FileInfo(d).Name}"); + } + } + else + { + wrongcommand(); + } } - internal void StartHacker101Story() + public void cmd_cd(String[] args) { - var t = new ShiftUI.Timer(); - t.Interval = 4000; - int i = 0; - - t.Tick += (object s, EventArgs a) => + try { - switch(i) + if (API.Upgrades["fileskimmer"]) { - case 0: - WriteLine("IP connecting as Hacker101..."); - break; - case 1: - WriteLine("Hacker101: Hello, ShiftOS user. I am a hacker."); - break; - case 2: - if (API.BitnoteAddress != null) + if (args[1] == "..") + { + if (GetPath(current_dir) != "/") { - WriteLine($"Hacker101: I can prove it. You have {API.Codepoints} Codepoints, your Bitnote Address is {API.BitnoteAddress.Address}, and you have {API.BitnoteAddress.Bitnotes}. That's your private address, by the way."); + current_dir = GetParent(current_dir); + SetPrefix($"{API.Username}@{API.OSName} in {GetPath(current_dir)} $> "); } else { - WriteLine($"Hacker101: I can prove it. You have {API.Codepoints} Codepoints, and you do not have a Bitnote Address."); + WriteLine("cd: Can't go up past the root."); } - break; - case 3: - WriteLine("Hacker101: Enough fun in games. Listen. There are two things you need to know."); - break; - case 4: - WriteLine("Hacker101: Thing #1. DevX isn't real."); - break; - case 5: - WriteLine("Hacker101: I've decompiled parts of ShiftOS. And you know what I found?"); - break; - case 6: - WriteLine("Hacker101: Everything DevX says. Everything he does. Everything he THINKS. It's all hardcoded directly into ShiftOS's core."); - break; - case 7: - WriteLine("Hacker101: Want proof? Here. I'll run a quick Lua script for you."); - string DecompiledCode = Properties.Resources.DecompiledCode; - var l = new LuaInterpreter(); - Form win = l.mod.create_window("Decompiled Code", null, 720, 480); - TextBox txt = new TextBox(); - txt.Multiline = true; - txt.Text = Properties.Resources.DecompiledCode; - txt.BorderStyle = BorderStyle.None; - txt.BackColor = Color.Black; - txt.ForeColor = Color.White; - txt.Font = new Font(OSInfo.GetMonospaceFont(), 9); - l.mod.set_dock(txt, "fill"); - l.mod.add_widget_to_window(win, txt); - break; - case 8: - WriteLine("Hacker101: Not only is that some nice, smokin' fresh C# code directly from ShiftOS, but that's a nice steaming pile of bird poop on DevX's doorstep."); - break; - case 9: - WriteLine("Hacker101: Thing #2. The Shiftnet holds some secrets."); - break; - case 10: - WriteLine("Hacker101: What kind of secrets, I hear you ask through your microphone (jesus, do you seriously talk to us with your voice? Are you that bored?)"); - break; - case 11: - WriteLine("Hacker101: Well. I'm talking, pieces of a Lua script that could help stop DevX dead in his digital tracks."); - break; - case 12: - WriteLine("Hacker101: All you gotta do is use my decryption utilities to find the pieces of this encrypted script, download them, decrypt them, and the utility will automatically piece them together for you."); - break; - case 13: - WriteLine("Hacker101: Shiftnet pages ending with .enc are your best bet."); - break; - case 14: - WriteLine("Hacker101: You can install the utilities using spkg install secret."); - break; - case 15: - WriteLine("Hacker101: Then, when the application installs, run it, and use the password 'binary_hell' to install the REAL utilities."); - break; - case 16: - WriteLine("Hacker101: Now go. We need that script. I know a friend who will help you get your hard drive back from DevX if you can do this."); - t.Stop(); - ShiftOS.Hacking.AddCharacter(new Character("Hacker101", "Let's get the job done.", 75, 45, 5)); - API.Upgrades["hacker101"] = true; - this.Close(); - break; + } + else + { + string newdir = current_dir + OSInfo.DirectorySeparator; + foreach (var dir in Directory.GetDirectories(current_dir)) + { + if (new DirectoryInfo(dir).Name.ToLower() == args[1]) + newdir = dir; + } + current_dir = newdir; + SetPrefix($"{API.Username}@{API.OSName} in {GetPath(current_dir)} $> "); + } } - i += 1; - }; - t.Start(); + } + catch (Exception e) + { + WriteLine("cd: " + e); + } } - internal void StartOtherPlayerSysFix() + + public void cmd_upg(String[] args) { - var t = new ShiftUI.Timer(); - t.Interval = 4000; - int i = 0; - t.Tick += (object s, EventArgs a) => + if (API.DeveloperMode) { - switch(i) + try { - case 0: - WriteLine("User connected as ???."); - break; - case 1: - if(API.Upgrades["otherplayerstory"] == true) + switch (args[1]) + { + case "get": + WriteLine(API.Upgrades[args[2]].ToString()); + break; + } + } + catch + { + + } + } + else + { + wrongcommand(); + } + } + + public void cmd_endgame_test(String[] args) + { + if (API.DeveloperMode) + { + try + { + switch (args[1]) + { + case "choice_screen": + var cscreen = new ShiftOS.FinalMission.ChooseYourApproach(); + cscreen.WindowState = FormWindowState.Maximized; + //cscreen.TopMost = true; + cscreen.Show(); + break; + case "limitedmode": + API.LimitedMode = !API.LimitedMode; + WriteLine($"Limited mode set to {API.LimitedMode}."); + break; + } + } + catch + { + WriteLine("Invalid arguments."); + } + } + else + { + wrongcommand(); + } + } + + public void cmd_htutorial(String[] args) + { + ShiftOS.Hacking.StartBattleTutorial(); + } + + public void cmd_fake_buy(String[] args) + { + if (API.DeveloperMode) + { + try + { + if (API.Upgrades.ContainsKey(args[1])) + { + API.Upgrades[args[1]] = true; + WriteLine($"Bought upgrade {args[1]}."); + API.CurrentSession.SetupAppLauncher(); + API.UpdateWindows(); + SaveSystem.Utilities.saveGame(); + } + else + { + WriteLine("Upgrade not found."); + } + } + catch + { + WriteLine("fake_buy: Bad arguments."); + } + } + else + { + wrongcommand(); + } + } + + public void cmd_connections(String[] args) + { + try + { + switch (args[1]) + { + case "list": + foreach (var client in Package_Grabber.clients) { - WriteLine($"???: {API.Username}! Did he find out? Oh God, I hope he can see this..."); + WriteLine($"Hostname: {client.Key}, Port: {client.Value.RemotePort}, Online: {client.Value.IsConnected}"); } - else + break; + case "gui": + API.CreateForm(new ConnectionManager(), "Connections", API.GetIcon("Connections")); + break; + case "drop": + foreach (var client in Package_Grabber.clients) { - WriteLine("???: Hello? Uhhhh, is this stupid thing working?"); + Package_Grabber.Disconnect(client.Key); } break; - case 2: - if(API.Upgrades["otherplayerstory"] == true) + case "add": + string host = args[2]; + int port = 0; + int.TryParse(args[3], out port); + if (!Package_Grabber.clients.ContainsKey(host)) { - WriteLine("???: Ahh. Good. You can read this. It's me, the other player."); + Package_Grabber.ConnectToServer(host, port); + WriteLine("Connection to host established successfully."); } else { - WriteLine("???: Thank heaven. You can hear me. Don't ask who I am."); - } - break; - case 3: - WriteLine("???: Looks like DevX hit you hard. Guess he found out you had the Shiftnet."); - break; - case 4: - WriteLine("???: Relax. It's not your fault."); - break; - case 5: - WriteLine("???: Actually, the Shiftnet regularly sends data about it's usage, unencrypted, directly to DevX."); - break; - case 6: - WriteLine("???: This code seems to be embedded into all .saa files. It's actually how I found out about you."); - break; - case 7: - WriteLine("???: It seems weird, I know, but everytime you run a .saa file, an uplink is made to DevX's servers"); - break; - case 8: - if (API.Upgrades["otherplayerstory"] == true) - { - WriteLine("???: And, well, I think we could use this. I'll see if Hacker101 can track this uplink. If he can, you will know it the next time you run a .saa."); - } - else - { - WriteLine("???: And, well, I think we could use this. I have a friend who's good with his hacking skills. I'll see if he can help you stop DevX dead. If he can, he will contact you next time you run a .saa."); - } - break; - case 9: - WriteLine("???: Anyways, connected to your system, I can see your desktop. Looks pretty messed up, huh?"); - break; - case 10: - WriteLine("???: You're lucky you don't have the Windows Everywhere virus."); - break; - case 11: - Viruses.InfectFile(Paths.Drivers + "Keyboard.dri", Viruses.VirusID.WindowsEverywhere); - Viruses.CheckForInfected(); - WriteLine("???: Crap! I spoke too soon."); - break; - case 12: - WriteLine("???: Alright. I'll see if I can hijack your Shiftorium Registry, install a virus scanner, and get rid of the viruses."); - break; - case 13: - API.Upgrades["virusscanner"] = true; - var trm = new Terminal(); - API.CreateForm(trm, API.LoadedNames.TerminalName, Properties.Resources.iconTerminal); - trm.command = "vscan"; - trm.DoCommand(); - break; - case 14: - WriteLine("???: All better. I hope. As for those random files on your desktop, well, it seems DevX dropped some sort of secret message onto your system."); - break; - case 15: - WriteLine("???: Go ahead and try to decrypt it. The Shiftnet Lua API is very useful."); - break; - case 16: - if(API.Upgrades["otherplayerstory"] == true) - { - WriteLine("???: Anyways, I'm gonna go work with Hacker101, discuss those .saa uplinks, and see if we can come up with a suitable attack plan."); - } - else - { - WriteLine("???: Well, your system is all better. You don't have to thank me. Just, when you open a .saa file, I'll try to contact you if I'm not busy."); + var c = Package_Grabber.clients[host]; + if (c.IsConnected == false) + { + c.Connect(host, port); + WriteLine("Re-established connection with host."); + } + else + { + WriteLine("This host has been connected to already."); + } } break; - case 17: - WriteLine("???: Talk to you soon. And, remember. ShiftOS is like a forest. DevX is the predator, you are the prey. Watch your back."); - break; - case 18: - t.Stop(); - this.Close(); - API.Upgrades["otherplayerrescue"] = true; - break; } - i += 1; - }; - t.Start(); + } + catch + { + WriteLine("connections: Missing arguments."); + } } - internal void StartHackerBattleIntro() + public void cmd_story(String[] args) { - var t = new ShiftUI.Timer(); - t.Interval = 4000; - int i = 0; - t.Tick += (object s, EventArgs a) => + if (API.DeveloperMode == true && API.Upgrades["shiftnet"]) { - switch(i) + try { - case 0: - API.Upgrades["hackerbattles"] = true; - API.Upgrades["hackcommand"] = true; - WriteLine("IP address connecting with no identity..."); - break; - case 1: - WriteLine("Hey there. So I see you're into hacking."); - break; - case 2: - WriteLine("Oh, how rude of me. You don't know if I'm DevX or not."); - break; - case 3: - WriteLine("Well now you do. I will not show my identity, but I am not DevX."); - break; - case 4: - WriteLine("Anyways. There are two things you must know about hacking within ShiftOS."); - break; - case 5: - WriteLine("1. You can hack more than just the Shiftorium. Look around the user interface for any 'Hack it' buttons."); - break; - case 6: - WriteLine("Also, running 'hack' in the Terminal will let you do even more damage to DevX's security systems as well as give you some advantages."); - break; - case 7: - WriteLine("Ever wanted to make the Shiftorium have a bit of a sale, or even better, make all applications pay out more Codepoints than DevX intends?"); - break; - case 8: - WriteLine("Well that 'hack' command is useful then. Go ahead. Try it in another Terminal window. But good God do not close this one."); - break; - case 9: - WriteLine("Because there's one more thing you need to know."); - break; - case 10: - WriteLine("You are not the only person DevX has contacted with ShiftOS."); - break; - case 11: - WriteLine("There are others. Some of them, friendly. Some of them, knowledgable enough to help you."); - break; - case 12: - WriteLine("ShiftOS is like a private community. Anyone can contact anyone provided they have the skill to get in."); - break; - case 13: - WriteLine("Meaning, you may meet some very cool people."); - break; - case 14: - WriteLine("But some of us are... how do you say it... hostile."); - break; - case 15: - WriteLine("Enter the era of Hacker Battles."); - break; - case 16: - WriteLine("It's a network-vs-network every-man-for-himself affair. You'll meet criminals, hackers, agencies and much more."); - break; - case 17: - WriteLine("All offering a little surprise if you can take their network down."); - break; - case 18: - WriteLine("And it's best you get trained, for at any time, anyone could challenge you to one."); - break; - case 19: - WriteLine("And the amount of networks devastated due to untrained users picking a fight with the wrong person is alarmingly huge."); - break; - case 20: - WriteLine("I'll launch a practice program which will teach you the Hacker Battle interface and the fundamentals."); - break; - case 21: - WriteLine("And if you can complete the entire training session, you will be able to defend against anyone who dare battle you."); - break; - case 22: - WriteLine("Starting training session #53D8G in 5 seconds...."); - break; - case 23: - WriteLine("Don't worry. It shouldn't be too difficult for you."); - t.Stop(); - ShiftOS.Hacking.StartBattleTutorial(); - break; + switch (args[1]) + { + case "aidennirh": + StartAidenNirhStory(); + break; + case "devxfurious": + StartDevXFuriousStory(); + break; + case "battletut": + StartHackerBattleIntro(); + break; + case "otherplayer": + StartDevXFuriousStory(); + break; + case "hacker101": + StartHacker101Story(); + break; + } } - i += 1; - }; - t.Start(); + catch + { + WriteLine("Missing arguments."); + } + } + else { wrongcommand(); } } - internal void StartDevXFuriousStory() + public void cmd_make(String[] args) { - var t = new ShiftUI.Timer(); - t.Interval = 4000; - int i = 0; - t.Tick += (object s, EventArgs a) => + try { - switch (i) + string path = command.Replace("make ", ""); + string realpath = $"{Paths.SaveRoot}{path.Replace("/", OSInfo.DirectorySeparator)}"; + if (File.Exists(realpath + OSInfo.DirectorySeparator + "main.lua")) { - case 0: - WriteLine("IP 199.108.232.1 Connecting..."); - break; - case 1: - WriteLine("DevX: WHAT HAVE YOU DONE?"); - break; - case 2: - WriteLine("DevX: How the HELL did you get the Shiftnet?"); - break; - case 3: - WriteLine("DevX: What sites have you seen? TALK TO ME."); - break; - case 4: - WriteLine("DevX: Alright, got nothing to say? Fine. You will pay for this..."); - break; - case 5: - WriteLine("DevX: I don't know what I'll do... I don't know when I'll do it... but you will wish you never touched a computer in your life..."); - break; - case 6: - t.Stop(); - Viruses.DropDevXPayload(); - this.Close(); - var trm = new Terminal(); - API.CreateForm(trm, API.LoadedNames.TerminalName, API.GetIcon("Terminal")); - trm.StartDevXFuriousStory2(); - break; + WriteLine("Compiling to " + path + ".saa"); + ZipFile.CreateFromDirectory(realpath, realpath + ".saa"); } - i += 1; - }; - t.Start(); + else + { + WriteLine($"make: *** No rule to make target \"{realpath}\". Stop."); + } + } + catch + { + WriteLine("make: Invalid arguments."); + } } - private void StartDevXFuriousStory2() + public void cmd_devupg(String[] args) { - var t = new Thread(new ThreadStart(new Action(() => + if (API.DeveloperMode) { - WriteLine("User '???' connecting..."); - API.PlaySound(Properties.Resources.dial_up_modem_02); - WriteLine("???: Hello? Ummm... this is awkward..."); - BeepSleep(3000); - WriteLine("???: Listen - I'm a hacker. Well, not really. I'm friends with one."); - BeepSleep(3000); - WriteLine("???: Seems like DevX completely obliterated your system with one of his viruses."); - BeepSleep(2500); - WriteLine("???: I'll fix that for you."); - API.Upgrades["virusscanner"] = true; - this.Invoke(new Action(() => - { - this.command = "vscan"; - this.DoCommand(); - })); - BeepSleep(1000); - WriteLine("???: Better? Cool. Now, I need your help."); - BeepSleep(1250); - WriteLine("???: I can't reveal my identity yet - but I co-own this chat-room..."); - BeepSleep(1175); - WriteLine("???: It's called the 'Hacker Alliance'."); - BeepSleep(1000); - WriteLine("???: I'm going to install something called 'HoloChat' on your system. It'll be quick."); - BeepSleep(2000); - WriteLine("Installing HoloChat..."); - API.Upgrades["holochat"] = true; - Thread.Sleep(100); - WriteLine("Done. Resetting desktop..."); - this.Invoke(new Action(() => { API.CurrentSession.SetupDesktop(); })); - WriteLine("Done."); - Thread.Sleep(3000); - WriteLine("???: Alright - I'll talk to you soon. Just join that chat room when you're ready."); - BeepSleep(1000); - this.Invoke(new Action(() => - { - this.Close(); - })); - }))); - t.Start(); - } - - private LuaInterpreter Interpreter = null; - private bool blockctrlt = false; - - /// - /// Call after creating a Terminal to let Maureen Fenn talk - /// to the player about the Shiftnet and the Appscape Package Manager. - /// - public void StartShiftnetStory() - { - ShiftUI.Timer tmrstory = new ShiftUI.Timer(); - tmrstory.Interval = 10000; - WriteLine("IP connecting as 'Maureen Fenn'..."); - API.PlaySound(Properties.Resources.dial_up_modem_02); - var t = new Thread(new ThreadStart(new Action(() => - { - WriteLine("Maureen Fenn: Hey there, user! I have something to show you."); - BeepSleep(4000); - WriteLine("Maureen Fenn: So, there's this thing called the 'Shiftnet'"); - BeepSleep(3750); - WriteLine("Maureen Fenn: Turns out, that DevX wants to keep it a secret, as such he only installed it on his and my systems."); - BeepSleep(4250); - WriteLine("Maureen Fenn: But what's the point of listening to DevX when we have people like you who like to experiment?"); - BeepSleep(4000); - WriteLine("Maureen Fenn: Well, to be fair - he can destroy whatever he wants. Just like he did my company, Minimatch."); - BeepSleep(3000); - WriteLine("Maureen Fenn: But who cares! I'm going to install a few things on your system."); - API.Upgrades["shiftnet"] = true; - this.Invoke(new Action(() => - { - this.command = "spkg install shiftnet"; - this.DoCommand(); - })); - WriteLine("Shiftnet installed on system..."); - Thread.Sleep(4000); - WriteLine("Maureen Fenn: All done! Oh - just before I leave... go ahead and explore the Shiftnet!"); - BeepSleep(3000); - WriteLine("Maureen Fenn: But, be careful. Don't venture off the main server. You never know what's elsewhere..."); - BeepSleep(1000); - WriteLine("Maureen Fenn: Well, bye!"); - this.Invoke(new Action(() => + WriteLine("Upgrading your system..."); + foreach (var upg in Shiftorium.Utilities.GetAvailable()) { - API.CurrentSession.SetupDesktop(); - this.Close(); - })); - }))); - t.Start(); - } - - /// - /// *BEEP* ZZZZZZZZzzzzzzzzzzz....... - /// - /// Time to sleep. - private void BeepSleep(int time) - { - //API.PlaySound(Properties.Resources.writesound); - Thread.Sleep(time); - } - - private List GetFonts() - { - var lst = new List(); - // Get the installed fonts collection. - InstalledFontCollection allFonts = new InstalledFontCollection(); - - // Get an array of the system's font familiies. - FontFamily[] fontFamilies = allFonts.Families; - - // Display the font families. - foreach (FontFamily myFont in fontFamilies) - { - lst.Add(myFont.Name.ToLower()); + API.Upgrades[upg.id] = true; + WriteLine("Installed upgrade \"" + upg.Name + "\"..."); + } + API.UpdateWindows(); + API.CurrentSession.SetupDesktop(); } - //font_family - - return lst; - } - - public List GetColorList() - { - var lst = new List(); - if(API.Upgrades["red"] == true) - lst.Add("red"); - if (API.Upgrades["green"] == true) - lst.Add("green"); - if (API.Upgrades["blue"] == true) - lst.Add("blue"); - if (API.Upgrades["brown"] == true) - lst.Add("brown"); - if (API.Upgrades["purple"] == true) - lst.Add("purple"); - if (API.Upgrades["yellow"] == true) - lst.Add("yellow"); - if (API.Upgrades["orange"] == true) - lst.Add("orange"); - if (API.Upgrades["pink"] == true) - lst.Add("pink"); - if (API.Upgrades["gray"] == true) - lst.Add("gray"); - lst.Add("black"); - lst.Add("white"); - return lst; - } - - public Color SetColor(string name) - { - Color col = Color.White; - switch(name) + else { - case "black": - col = Color.Black; - break; - case "white": - col = Color.White; - break; - case "gray": - col = Color.Gray; - break; - case "red": - col = Color.Red; - break; - case "green": - col = Color.Green; - break; - case "blue": - col = Color.Blue; - break; - case "brown": - col = Color.Brown; - break; - case "purple": - col = Color.Purple; - break; - case "yellow": - col = Color.Yellow; - break; - case "orange": - col = Color.Orange; - break; + wrongcommand(); } - return col; - } - - private bool LuaMode = false; - - public string GetPath(string path) - { - return path.Replace(Paths.SaveRoot, "").Replace(OSInfo.DirectorySeparator, "/"); } - public string GetParent(string path) + public void cmd_netgen(String[] args) { - var d = new DirectoryInfo(path); - return d.Parent.FullName; + WriteLine("Starting netgen..."); + API.CreateForm(new NetGen(), "Network Generator", API.GetIcon("Terminal")); } - public void DoCommand() + public void cmd_lua(String[] args) { - //Grab the type of this class using Reflection. - var terminal = this.GetType(); - string[] cmdargs = command.Split(' '); - var method_info = terminal.GetMethod("cmd_" + cmdargs[0].ToLower()); - if(method_info != null) + if (API.DeveloperMode == true) { - method_info.Invoke(this, new object[] { cmdargs }); + try + { + string f = args[1]; + WriteLine(f); + f = command.Remove(0, 4); + WriteLine(f); + string real = $"{Paths.SaveRoot}{f.Replace("/", OSInfo.DirectorySeparator)}"; + WriteLine(real); + if (File.Exists(real)) + { + WriteLine("Running Lua script at " + f + "."); + var l = new LuaInterpreter(real); + } + else + { + WriteLine("Lua script file not found."); + } + } + catch + { + this.LuaMode = true; + this.Interpreter = new LuaInterpreter(); + this.Interpreter.mod.print = new Action((text) => WriteLine(text)); + this.Interpreter.mod.exit = new Action(() => + { + this.LuaMode = false; + this.Interpreter = null; + WriteLine($"{API.CurrentSave.username}@{API.CurrentSave.osname} $> "); + }); + WriteLine("ShiftOS Lua Interpreter - v1.0"); + WriteLine("Created by Michael VanOverbeek"); + WriteLine(Environment.NewLine + "How to use: Simply type some Lua code and watch it come to life. Code can be executed on one line, and unlike most interpreters, you can access code from one line in another."); + WriteLine(Environment.NewLine + "When you're done, simply press the Enter key to execute the code." + Environment.NewLine); + } } else { - terminal.GetMethod("cmd_default").Invoke(this, new object[] { cmdargs }); + wrongcommand(); } } - #region Terminal command methods - - /* - * Adding terminal commands has been changed. - * - * It's now done in a way that doesn't require hardcoding. - * - * Simply add a new method here with a prefix 'cmd_', for example 'cmd_05tray', and - * one argument of type 'string[]'. Then, put all the stuff you want your command to - * do in that method, and try running your command (without the 'cmd_' prefix) in the - * Terminal and it should work just fine. - * - * Thanks to @carverh for inspiring this by making all commands their own function. - */ - - public void cmd_dir(String[] args) + public void cmd_hack(String[] args) { - if (API.Upgrades["fileskimmer"]) + if (API.Upgrades["hacking"] == true) { - foreach (var d in Directory.GetDirectories(current_dir)) - { - WriteLine($"[DIR] {new DirectoryInfo(d).Name}"); - } - foreach (var d in Directory.GetFiles(current_dir)) - { - WriteLine($"{new FileInfo(d).Name}"); - } + StartHackingSession("random"); } else { @@ -1439,91 +998,64 @@ Password: z7fjsd3"); } } - public void cmd_cd(String[] args) + public void cmd_vscan(String[] args) { - try + if (API.Upgrades["virusscanner"] == true) { - if (API.Upgrades["fileskimmer"]) + WriteLine("Scanning for infected files..."); + var goodList = new Dictionary(); + foreach (KeyValuePair kv in Viruses.Infections) { - if (args[1] == "..") + if (kv.Value.Contains(";")) { - if (GetPath(current_dir) != "/") - { - current_dir = GetParent(current_dir); - SetPrefix($"{API.Username}@{API.OSName} in {GetPath(current_dir)} $> "); - } - else + foreach (string file in kv.Value.Split(';')) { - WriteLine("cd: Can't go up past the root."); + if (goodList.ContainsKey(file)) + { + goodList[file] += ", " + kv.Key; + } + else + { + goodList.Add(file, kv.Key); + } } } else { - string newdir = current_dir + OSInfo.DirectorySeparator; - foreach (var dir in Directory.GetDirectories(current_dir)) + if (goodList.ContainsKey(kv.Value)) { - if (new DirectoryInfo(dir).Name.ToLower() == args[1]) - newdir = dir; + goodList[kv.Value] += ", " + kv.Key; + } + else + { + goodList.Add(kv.Value, kv.Key); } - current_dir = newdir; - SetPrefix($"{API.Username}@{API.OSName} in {GetPath(current_dir)} $> "); } } - } - catch (Exception e) - { - WriteLine("cd: " + e); - } - } - - - public void cmd_upg(String[] args) - { - if (API.DeveloperMode) - { - try + WriteLine("Scan complete."); + if (goodList.Count > 0) { - switch (args[1]) + foreach (KeyValuePair kv in goodList) { - case "get": - WriteLine(API.Upgrades[args[2]].ToString()); - break; + WriteLine("File " + kv.Key + " is infected with " + kv.Value + ". Disinfecting..."); + Viruses.DisInfect(kv.Key); } + WriteLine("Disinfection complete."); } - catch + else { - + WriteLine("No infections found. You are safe."); } } - else - { - wrongcommand(); - } } - public void cmd_endgame_test(String[] args) + public void cmd_infections(String[] args) { - if (API.DeveloperMode) + if (API.DeveloperMode == true) { - try - { - switch (args[1]) - { - case "choice_screen": - var cscreen = new ShiftOS.FinalMission.ChooseYourApproach(); - cscreen.WindowState = FormWindowState.Maximized; - //cscreen.TopMost = true; - cscreen.Show(); - break; - case "limitedmode": - API.LimitedMode = !API.LimitedMode; - WriteLine($"Limited mode set to {API.LimitedMode}."); - break; - } - } - catch + foreach (KeyValuePair kv in Viruses.Infections) { - WriteLine("Invalid arguments."); + WriteLine(kv.Key + " @ " + kv.Value); } } else @@ -1532,160 +1064,82 @@ Password: z7fjsd3"); } } - public void cmd_htutorial(String[] args) - { - ShiftOS.Hacking.StartBattleTutorial(); - } - - public void cmd_fake_buy(String[] args) + public void cmd_binarywater(String[] args) { if (API.DeveloperMode) { - try - { - if (API.Upgrades.ContainsKey(args[1])) - { - API.Upgrades[args[1]] = true; - WriteLine($"Bought upgrade {args[1]}."); - API.CurrentSession.SetupAppLauncher(); - API.UpdateWindows(); - SaveSystem.Utilities.saveGame(); - } - else - { - WriteLine("Upgrade not found."); - } - } - catch - { - WriteLine("fake_buy: Bad arguments."); - } + ShiftOS.Hacking.AddCharacter(new Character("Philip Adams", "Hello, and welcome to another episode of OSFirstTimer.", 100, 100, 0)); + WriteLine("Philip Adams is now in the list of hirable hackers."); + WriteLine("\" I Don't Think This is Canon \" -Carver"); } else { - wrongcommand(); + WriteLine("I see you went in the ShiftOS source code... ummm yeah... this isn't a developer mode release so I can't just give you a full-skilled hacker even if you beg."); } } - public void cmd_connections(String[] args) + public void cmd_color(String[] args) { try { - switch (args[1]) + if (API.Upgrades["setterminalcolors"] == true) { - case "list": - foreach (var client in Package_Grabber.clients) - { - WriteLine($"Hostname: {client.Key}, Port: {client.Value.RemotePort}, Online: {client.Value.IsConnected}"); - } - break; - case "gui": - API.CreateForm(new ConnectionManager(), "Connections", API.GetIcon("Connections")); - break; - case "drop": - foreach (var client in Package_Grabber.clients) - { - Package_Grabber.Disconnect(client.Key); - } - break; - case "add": - string host = args[2]; - int port = 0; - int.TryParse(args[3], out port); - if (!Package_Grabber.clients.ContainsKey(host)) - { - Package_Grabber.ConnectToServer(host, port); - WriteLine("Connection to host established successfully."); - } - else - { - var c = Package_Grabber.clients[host]; - if (c.IsConnected == false) - { - c.Connect(host, port); - WriteLine("Re-established connection with host."); - } - else - { - WriteLine("This host has been connected to already."); - } - } - break; + + Color bcol = SetColor(args[1]); + Color tcol = SetColor(args[2]); + API.CurrentSkin.TerminalTextColor = tcol; + API.CurrentSkin.TerminalBackColor = bcol; + } } - catch + catch (Exception) { - WriteLine("connections: Missing arguments."); + WriteLine("color: Missing arguments."); } } - public void cmd_story(String[] args) + public void cmd_encrypt(String[] args) { - if (API.DeveloperMode == true && API.Upgrades["shiftnet"]) + if (API.DeveloperMode == true) { - try - { - switch (args[1]) - { - case "aidennirh": - StartAidenNirhStory(); - break; - case "devxfurious": - StartDevXFuriousStory(); - break; - case "battletut": - StartHackerBattleIntro(); - break; - case "otherplayer": - StartDevXFuriousStory(); - break; - case "hacker101": - StartHacker101Story(); - break; - } - } - catch - { - WriteLine("Missing arguments."); - } + string messageToEncrypt = command.Replace("encrypt ", ""); + string encryptedMessage = API.Encryption.Encrypt(messageToEncrypt); + WriteLine("Encrypted Message: " + encryptedMessage); + } + else + { + wrongcommand(); } - else { wrongcommand(); } } - public void cmd_make(String[] args) + public void cmd_font(String[] args) { - try + if (API.Upgrades["setterminalfont"] == true) { - string path = command.Replace("make ", ""); - string realpath = $"{Paths.SaveRoot}{path.Replace("/", OSInfo.DirectorySeparator)}"; - if (File.Exists(realpath + OSInfo.DirectorySeparator + "main.lua")) + var fname = command.Replace("font ", ""); + if (GetFonts().Contains(fname)) { - WriteLine("Compiling to " + path + ".saa"); - ZipFile.CreateFromDirectory(realpath, realpath + ".saa"); + API.CurrentSkin.TerminalFontStyle = fname; } else { - WriteLine($"make: *** No rule to make target \"{realpath}\". Stop."); + WriteLine("font: Unrecognized font name \"" + fname + "\". Note: Font names are case sensitive."); } } - catch + else { - WriteLine("make: Invalid arguments."); + wrongcommand(); } } - public void cmd_devupg(String[] args) + public void cmd_colorlist(String[] args) { - if (API.DeveloperMode) + if (API.Upgrades["setterminalcolors"] == true) { - WriteLine("Upgrading your system..."); - foreach (var upg in Shiftorium.Utilities.GetAvailable()) + foreach (string itm in GetColorList()) { - API.Upgrades[upg.id] = true; - WriteLine("Installed upgrade \"" + upg.Name + "\"..."); + WriteLine(itm); } - API.UpdateWindows(); - API.CurrentSession.SetupDesktop(); } else { @@ -1693,223 +1147,11 @@ Password: z7fjsd3"); } } - public void cmd_netgen(String[] args) - { - WriteLine("Starting netgen..."); - API.CreateForm(new NetGen(), "Network Generator", API.GetIcon("Terminal")); - } - - public void cmd_lua(String[] args) + public void cmd_spkg(String[] args) { - if (API.DeveloperMode == true) + if (!API.LimitedMode) { - try - { - string f = args[1]; - WriteLine(f); - f = command.Remove(0, 4); - WriteLine(f); - string real = $"{Paths.SaveRoot}{f.Replace("/", OSInfo.DirectorySeparator)}"; - WriteLine(real); - if (File.Exists(real)) - { - WriteLine("Running Lua script at " + f + "."); - var l = new LuaInterpreter(real); - } - else - { - WriteLine("Lua script file not found."); - } - } - catch - { - this.LuaMode = true; - this.Interpreter = new LuaInterpreter(); - this.Interpreter.mod.print = new Action((text) => WriteLine(text)); - this.Interpreter.mod.exit = new Action(() => - { - this.LuaMode = false; - this.Interpreter = null; - WriteLine($"{API.CurrentSave.username}@{API.CurrentSave.osname} $> "); - }); - WriteLine("ShiftOS Lua Interpreter - v1.0"); - WriteLine("Created by Michael VanOverbeek"); - WriteLine(Environment.NewLine + "How to use: Simply type some Lua code and watch it come to life. Code can be executed on one line, and unlike most interpreters, you can access code from one line in another."); - WriteLine(Environment.NewLine + "When you're done, simply press the Enter key to execute the code." + Environment.NewLine); - } - } - else - { - wrongcommand(); - } - } - - public void cmd_hack(String[] args) - { - if (API.Upgrades["hacking"] == true) - { - StartHackingSession("random"); - } - else - { - wrongcommand(); - } - } - - public void cmd_vscan(String[] args) - { - if (API.Upgrades["virusscanner"] == true) - { - WriteLine("Scanning for infected files..."); - var goodList = new Dictionary(); - foreach (KeyValuePair kv in Viruses.Infections) - { - if (kv.Value.Contains(";")) - { - foreach (string file in kv.Value.Split(';')) - { - if (goodList.ContainsKey(file)) - { - goodList[file] += ", " + kv.Key; - } - else - { - goodList.Add(file, kv.Key); - } - } - } - else - { - if (goodList.ContainsKey(kv.Value)) - { - goodList[kv.Value] += ", " + kv.Key; - } - else - { - goodList.Add(kv.Value, kv.Key); - } - } - } - WriteLine("Scan complete."); - if (goodList.Count > 0) - { - foreach (KeyValuePair kv in goodList) - { - WriteLine("File " + kv.Key + " is infected with " + kv.Value + ". Disinfecting..."); - Viruses.DisInfect(kv.Key); - } - WriteLine("Disinfection complete."); - } - else - { - WriteLine("No infections found. You are safe."); - } - } - } - - public void cmd_infections(String[] args) - { - if (API.DeveloperMode == true) - { - foreach (KeyValuePair kv in Viruses.Infections) - { - WriteLine(kv.Key + " @ " + kv.Value); - } - } - else - { - wrongcommand(); - } - } - - public void cmd_binarywater(String[] args) - { - if (API.DeveloperMode) - { - ShiftOS.Hacking.AddCharacter(new Character("Philip Adams", "Hello, and welcome to another episode of OSFirstTimer.", 100, 100, 0)); - WriteLine("Philip Adams is now in the list of hirable hackers."); - WriteLine("\" I Don't Think This is Canon \" -Carver"); - } - else - { - WriteLine("I see you went in the ShiftOS source code... ummm yeah... this isn't a developer mode release so I can't just give you a full-skilled hacker even if you beg."); - } - } - - public void cmd_color(String[] args) - { - try - { - if (API.Upgrades["setterminalcolors"] == true) - { - - Color bcol = SetColor(args[1]); - Color tcol = SetColor(args[2]); - API.CurrentSkin.TerminalTextColor = tcol; - API.CurrentSkin.TerminalBackColor = bcol; - - } - } - catch (Exception) - { - WriteLine("color: Missing arguments."); - } - } - - public void cmd_encrypt(String[] args) - { - if (API.DeveloperMode == true) - { - string messageToEncrypt = command.Replace("encrypt ", ""); - string encryptedMessage = API.Encryption.Encrypt(messageToEncrypt); - WriteLine("Encrypted Message: " + encryptedMessage); - } - else - { - wrongcommand(); - } - } - - public void cmd_font(String[] args) - { - if (API.Upgrades["setterminalfont"] == true) - { - var fname = command.Replace("font ", ""); - if (GetFonts().Contains(fname)) - { - API.CurrentSkin.TerminalFontStyle = fname; - } - else - { - WriteLine("font: Unrecognized font name \"" + fname + "\". Note: Font names are case sensitive."); - } - } - else - { - wrongcommand(); - } - } - - public void cmd_colorlist(String[] args) - { - if (API.Upgrades["setterminalcolors"] == true) - { - foreach (string itm in GetColorList()) - { - WriteLine(itm); - } - } - else - { - wrongcommand(); - } - } - - public void cmd_spkg(String[] args) - { - if (!API.LimitedMode) - { - if (API.Upgrades["shiftnet"] == true) + if (API.Upgrades["shiftnet"] == true) { try { @@ -2381,7 +1623,16 @@ HIJACKER is a utility that allows you to hijack any system and install ShiftOS o } if (done == false) { - wrongcommand(); + // This runs EXE Applications like Core Utils + // Created By Carver Harrison (@carverh) + if (File.Exists("C:\\ShiftOS\\bin\\" + args[0] + ".exe")) + { + runExe(args); + } + else + { + wrongcommand(); + } } } } @@ -2394,7 +1645,7 @@ HIJACKER is a utility that allows you to hijack any system and install ShiftOS o /// String[] args public void cmd_about(String[] args) { - API.CreateInfoboxSession("About ShiftOS", "ShiftOS Version " + ProductVersion + "\n Copyright 2014-2016 ShiftOS Dev Team \n Type 'credits' in Terminal to Show Credits", infobox.InfoboxMode.Info); + API.CreateInfoboxSession("About ShiftOS", "ShiftOS v" + ProductVersion + "\n Copyright 2014-2016 ShiftOS Developers. \n Type 'credits' in terminal to show credits.", infobox.InfoboxMode.Info); } // HISTACOM REFERENCES, DO NOT REMOVE, CRUCIAL FOR SECRET STORY ARC @@ -2405,19 +1656,65 @@ HIJACKER is a utility that allows you to hijack any system and install ShiftOS o public void cmd_histacom_timedistorter(String[] args) { - WriteLine("Install 'timedistorter' by going to shiftnet://12padams"); + WriteLine("Package 'timedistorter' not installed"); } #endregion + #region RunEXE By Carver Harrison + /// + /// RunExe 1.1 + /// This will run .exe files inside of /bin + /// Created By Carver Harrison (@carverh) + /// + /// string[] args + public void runExe(string[] args) + { + if (API.Upgrades["commandlinexes"]) + { + bool isFirstArg = true; + string exeArgs = ""; + foreach (string arg in args) + { + if (!isFirstArg) + { + exeArgs = exeArgs + " " + arg; + } + else + { + isFirstArg = false; + } + } + string lp = "C:\\ShiftOS\\bin\\" + args[0] + ".exe"; + Process p = new Process(); + p.StartInfo.Arguments = exeArgs; + p.StartInfo.UseShellExecute = false; + p.StartInfo.RedirectStandardOutput = true; + p.StartInfo.RedirectStandardInput = true; + p.StartInfo.FileName = lp; + p.StartInfo.CreateNoWindow = true; + p.StartInfo.ErrorDialog = false; + p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; + p.StartInfo.WorkingDirectory = current_dir; + p.Start(); + WriteLine(p.StandardOutput.ReadToEnd()); + p.WaitForExit(); + } + else + { + wrongcommand(); + } + } + #endregion + private void StartChoice1EndStory() { - var t = new ShiftUI.Timer(); + var t = new System.Windows.Forms.Timer(); int i = 0; t.Interval = 4000; t.Tick += (object s, EventArgs a) => { - switch(i) + switch (i) { case 0: WriteLine("User '' connected as '???'"); @@ -2445,6 +1742,7 @@ HIJACKER is a utility that allows you to hijack any system and install ShiftOS o break; case 8: WriteLine("???: You want proof? - holochat_cmd: ERROR: Remote host closed connection."); + WriteLine("But if he is an AI, who created him?"); break; case 9: WriteLine("spkg: Rebooting system in 8 seconds."); @@ -2462,14 +1760,14 @@ HIJACKER is a utility that allows you to hijack any system and install ShiftOS o }; t.Start(); } - + public void StartReboot() { txtterm.Text = ""; var t1 = new Thread(new ThreadStart(new Action(() => { Thread.Sleep(500); - WriteLine("ShiftOS: Kernel deactivated."); + WriteLine("shift-init: Disconnecting From System Bus..."); Thread.Sleep(1000); this.Invoke(new Action(() => { @@ -2486,9 +1784,9 @@ HIJACKER is a utility that allows you to hijack any system and install ShiftOS o WriteLine($"You have {API.Codepoints} Codepoints."); WriteLine("Loading modules..."); Thread.Sleep(750); - foreach(var upg in API.Upgrades) + foreach (var upg in API.Upgrades) { - if(upg.Value == true) + if (upg.Value == true) { WriteLine($"Loaded module {upg.Key}..."); } @@ -2518,12 +1816,12 @@ HIJACKER is a utility that allows you to hijack any system and install ShiftOS o WriteLine(Environment.NewLine); WriteLine("PANIC_ID: 750_15_4W3S0M3"); WriteLine("PANIC_DESC: System became too unstable to function properly. In 5 seconds, your session will be resumed."); - var t = new ShiftUI.Timer(); + var t = new System.Windows.Forms.Timer(); t.Interval = 1000; int p = 0; t.Tick += (object s, EventArgs a) => { - if(p == 4) + if (p == 4) { t.Stop(); this.Close(); @@ -2557,7 +1855,7 @@ HIJACKER is a utility that allows you to hijack any system and install ShiftOS o WriteLine(" "); WriteLine("Press the key that corresponds to "); WriteLine("the option you want. "); - + } public void showhackinghelp() @@ -2577,7 +1875,7 @@ HIJACKER is a utility that allows you to hijack any system and install ShiftOS o public void showhelp(string topic) { - switch(topic) + switch (topic) { case "hacking": showhackinghelp(); @@ -2628,7 +1926,7 @@ HIJACKER is a utility that allows you to hijack any system and install ShiftOS o WriteLine(" - shutdown: Shuts down your PC."); WriteLine(" - codepoints: Shows how many codepoints you have."); WriteLine(" - help: Shows this screen."); - if(API.Upgrades["secondssincemidnight"] == true) + if (API.Upgrades["secondssincemidnight"] == true) { WriteLine(" - time: Shows the current time."); } @@ -2639,7 +1937,7 @@ HIJACKER is a utility that allows you to hijack any system and install ShiftOS o WriteLine(" - username : Changes your username."); WriteLine(" - osname : Changes the operating system name."); } - if(API.Upgrades["shiftnet"] == true) + if (API.Upgrades["shiftnet"] == true) { WriteLine(" - saa: Runs a specified .saa file."); WriteLine(" - spkg: Shiftnet Package Manager (more info at shiftnet://main/spkg"); @@ -2651,10 +1949,11 @@ HIJACKER is a utility that allows you to hijack any system and install ShiftOS o WriteLine(SaveSystem.Utilities.LoadedSave.osname + " - Version " + SaveSystem.Utilities.LoadedSave.ingameversion); WriteLine("==========================" + Environment.NewLine); WriteLine(" == Info == " + Environment.NewLine); - if(API.Upgrades["applaunchermenu"] == true) + if (API.Upgrades["applaunchermenu"] == true) { WriteLine(" - Apps can be run using the App Launcher on the desktop."); - } else + } + else { WriteLine(" - Apps can be run by typing their name in the Terminal."); } @@ -2666,55 +1965,55 @@ HIJACKER is a utility that allows you to hijack any system and install ShiftOS o { WriteLine(" - The Terminal runs fullscreen at all times."); } - if(API.Upgrades["titlebar"] == true) + if (API.Upgrades["titlebar"] == true) { WriteLine(" - Applications have a titlebar to help distinguish between other apps."); } - if(API.Upgrades["windowborders"] == true) + if (API.Upgrades["windowborders"] == true) { WriteLine(" - Applications have a window border to help distinguish between other apps."); } - if(API.Upgrades["multitasking"] == true) + if (API.Upgrades["multitasking"] == true) { WriteLine(" - Multiple apps can be run at the same time, and you can even run more than one of the same app!"); } - if(API.Upgrades["movablewindows"] == true) + if (API.Upgrades["movablewindows"] == true) { WriteLine(" - Applications can be moved using CTRL+W,A,S,D."); } - if(API.Upgrades["draggablewindows"] == true) + if (API.Upgrades["draggablewindows"] == true) { WriteLine(" - You can drag apps around the screen by dragging their titlebars."); } - if(API.Upgrades["resizablewindows"] == true) + if (API.Upgrades["resizablewindows"] == true) { WriteLine(" - You can resize windows by dragging their borders."); } - if(API.Upgrades["panelbuttons"] == true) + if (API.Upgrades["panelbuttons"] == true) { WriteLine($" - A list of open apps is shown at the {API.CurrentSkin.desktoppanelposition.ToLower()} of the screen."); } - if(API.Upgrades["usefulpanelbuttons"] == true) + if (API.Upgrades["usefulpanelbuttons"] == true) { WriteLine(" - You can minimize and restore apps using the panel buttons."); } - if(API.Upgrades["titletext"] == true) + if (API.Upgrades["titletext"] == true) { WriteLine(" - Apps display their names on the titlebar."); } - if(API.Upgrades["appicons"] == true) + if (API.Upgrades["appicons"] == true) { WriteLine(" - Apps display their icons, and they are displayed in their titlebars."); } - if(API.Upgrades["autoscrollterminal"] == true) + if (API.Upgrades["autoscrollterminal"] == true) { WriteLine(" - The Terminal will automatically scroll to the bottom."); } - if(API.Upgrades["terminalscrollbar"] == true) + if (API.Upgrades["terminalscrollbar"] == true) { WriteLine(" - You can scroll up and down the Terminal's buffer."); } - if(API.Upgrades["zoomableterminal"] == true) + if (API.Upgrades["zoomableterminal"] == true) { WriteLine(" - You can zoom the Terminal in and out by holding CTRL and scrolling up or down."); } @@ -2732,7 +2031,7 @@ HIJACKER is a utility that allows you to hijack any system and install ShiftOS o break; case 2: txtterm.Text = txtterm.Text + "IP 199.108.232.1 Connecting..." + Environment.NewLine + "User@" + SaveSystem.Utilities.LoadedSave.osname + " $> "; - API.PlaySound(Properties.Resources.dial_up_modem_02); + //API.PlaySound(Properties.Resources.dial_up_modem_02); break; case 12: txtterm.Text = txtterm.Text + "IP 199.108.232.1 Connected!" + Environment.NewLine + "User@" + SaveSystem.Utilities.LoadedSave.osname + " $> "; @@ -2764,7 +2063,7 @@ HIJACKER is a utility that allows you to hijack any system and install ShiftOS o break; case 59: txtterm.Text = txtterm.Text + "DevX: I'll close the terminal now and send you to the blank ShiftOS desktop" + Environment.NewLine + "User@ShiftOS $> "; - //API.PlaySound(Properties.Resources.writesound); + ///API.PlaySound(Properties.Resources.writesound); break; case 65: txtterm.Text = txtterm.Text + "DevX: You can open and close the terminal at any time by pressing CTRL + T" + Environment.NewLine + "User@ShiftOS $> "; @@ -2797,10 +2096,10 @@ HIJACKER is a utility that allows you to hijack any system and install ShiftOS o public void runterminalfile(string path) { - if(File.Exists(path)) + if (File.Exists(path)) { string[] cmds = File.ReadAllLines(path); - foreach(string cmd in cmds) + foreach (string cmd in cmds) { command = cmd; DoCommand(); @@ -2826,71 +2125,856 @@ HIJACKER is a utility that allows you to hijack any system and install ShiftOS o { txtterm.Text += text; } - txtterm.Select(txtterm.TextLength, 0); - txtterm.ScrollToCaret(); - })); + txtterm.Select(txtterm.TextLength, 0); + txtterm.ScrollToCaret(); + })); + } + private bool Zooming = false; + + private void ScrollDeactivate(object sender, KeyEventArgs e) + { + if (Zooming == true) + { + Zooming = false; + } + } + + private int ZoomMultiplier = 1; + + private void ResetTerminalFont() + { + string fname = "Font"; + if (API.Upgrades["setterminalfont"] == true) + { + fname = API.CurrentSkin.TerminalFontStyle; + } + else + { + fname = OSInfo.GetMonospaceFont(); + } + int fsize = 9 * ZoomMultiplier; + try + { + txtterm.Font = new Font(fname, fsize); + } + catch + { + txtterm.Font = new Font(fname, 9); + } + } + + private void Zoom(object sender, ScrollEventArgs e) + { + + } + + private void ScrollTerm(object sender, MouseEventArgs e) + { + if (Zooming == true) + { + + } + else + { + if (API.Upgrades["terminalscrollbar"] == true) + { + txtterm.ScrollBars = ScrollBars.Vertical; + } + } + } + + private void tmrsetfont_Tick(object sender, EventArgs e) + { + ResetTerminalFont(); + if (API.Upgrades["setterminalcolors"] == true) + { + txtterm.BackColor = API.CurrentSkin.TerminalBackColor; + txtterm.ForeColor = API.CurrentSkin.TerminalTextColor; + } + } + + public void ShowTools() + { + txtterm.Text = ""; + try + { + var h = ShiftOS.Hacking.Tools[SelectedCharacter]; + WriteLine(" == Attack Select =="); + WriteLine($"Attack: {SelectedCharacter + 1}/{ShiftOS.Hacking.Tools.Count}"); + WriteLine($"Name: {h.Name}"); + WriteLine($"Effectiveness: {h.Effectiveness}"); + WriteLine($"Description: {h.Description}"); + WriteLine(Environment.NewLine + "LEFT: Previous Attack, RIGHT: Next Attack, ENTER: Confirm"); + } + catch + { + WriteLine("There are no entries to display in this list."); + } + } + + private void Hack_ShowCharacters() + { + switch (SelectedMode) + { + case 1: + ShiftOS.Hacking.GetCharacters(); + SelectedCharacter = 0; + ShowTools(); + break; + case 2: + ShiftOS.Hacking.GetCharacters(); + SelectedCharacter = 0; + ShowChar(); + break; + } + } + + private void InstallMidGameDesktop() + { + //throw new NotImplementedException(); + } + + int SelectedMode = 0; + int SelectedCharacter = 0; + + public void ShowChar() + { + txtterm.Text = ""; + var h = ShiftOS.Hacking.Characters[SelectedCharacter]; + WriteLine(" == Partner Select =="); + WriteLine($"Partner: {SelectedCharacter + 1}/{ShiftOS.Hacking.Characters.Count}"); + WriteLine($"Name: {h.Name}"); + WriteLine($"Skill: {h.Skill}/100"); + WriteLine($"Speed: {h.Speed}/100"); + WriteLine($"Cost: {h.Cost}"); + WriteLine($"Bio: {h.Bio}"); + WriteLine(Environment.NewLine + "LEFT: Previous Partner, RIGHT: Next Partner, ENTER: Confirm"); + } + + public void StartShellShock() + { + var t = new Thread(new ThreadStart(new Action(() => + { + Thread.Sleep(300); + WriteLine("Sending false packet to shiftnet://devx/tracker..."); + Thread.Sleep(100); + WriteLine("Awaiting reply from server..."); + Thread.Sleep(5000); + WriteLine("Got reply with header \"SOS_TRK_GET\"."); + Thread.Sleep(50); + WriteLine("[kernel] Sending usage log to server..."); + WriteLine("Intercepting outgoing request..."); + Thread.Sleep(200); + WriteLine("Got packet contents..."); + Thread.Sleep(25); + WriteLine("Sifting..."); + Thread.Sleep(500); + WriteLine("Found connection data for shiftnet://devx/tracker."); + Thread.Sleep(100); + WriteLine(@"Username: devx +Password: z7fjsd3"); + Thread.Sleep(100); + WriteLine("Authenticating with SSH server on shiftnet://devx/tracker running Ubuntu 666..."); + Thread.Sleep(1000); + WriteLine("[SSH] Access granted."); + Thread.Sleep(100); + WriteLine($"[Message] ???: We're in. In about 75 seconds DevX's server will go down. It'll be quite cool actually, Don't know if you've ever seen a forkbomb in action, but because you're in an SSH session with DevX's server and I'm also controlling the same session you're gonna see one. Oh, yeah, this server's the only one of his that doesn't actually run ShiftOS."); + Thread.Sleep(25000); + this.Invoke(new Action(() => + { + txtterm.Text = ""; + })); + int i = 60; + while (i >= 1) + { + Thread.Sleep(1000); + WriteLine($"Beginning attack on server in {i} seconds."); + i -= 1; + } + WriteLine("[devx@tracker ~]$ "); + string cmd = ":`(`)`{` `:`|`:` `&` `}`;`:"; // yep. I'm pretending to use a forkbomb on DevX's server. This'll be FUN to code. + foreach (string c in cmd.Split('`')) + { + Thread.Sleep(100); + this.Invoke(new Action(() => + { + txtterm.Text += c; + })); + } + WriteLine("[devx@tracker ~]$ "); + WriteLine("[Message] ???: Alright. I entered the command for you. Looks like it did nothing. DevX wouldn't even know what's happening... but keep your terminal open for 30 seconds."); + Thread.Sleep(30000); + this.Invoke(new Action(() => + { + FinalMission.EndGameHandler.GoToNextObjective(); + })); + int progress = 0; + while (progress <= 10000) + { + int r = new Random().Next(0, 1); + switch (r) + { + case 0: + WriteLine("-bash: fork: Resource temporarily unavailable"); + break; + case 1: + WriteLine("-bash: fork: retry: Resource temporarily unavailable"); + break; + } + Thread.Sleep(progress / 10); + progress++; + } + WriteLine("[SSH] Connection to server dropped."); + this.Invoke(new Action(() => + { + FinalMission.EndGameHandler.GoToNextObjective(); + })); + this.Invoke(new Action(() => { this.Close(); })); + }))); + t.Start(); + } + + internal void StartBridgeToMidGame() + { + var t2 = new System.Windows.Forms.Timer(); + t2.Interval = 4000; + int i2 = 0; + t2.Tick += (object s, EventArgs e) => + { + switch (i2) + { + case 0: + if (API.Upgrades["hacker101"] == true) + { + WriteLine("Hacker101: Hello. We meet again. The Other Player told me about your situation."); + } + else + { + API.Upgrades["hacker101"] = true; + WriteLine("Hacker101: The Other Player told me about your situation."); + } + break; + case 1: + WriteLine("Hacker101: Lemme guess. DevX found out about you having the Shiftnet, didn't he..."); + break; + case 2: + WriteLine("Hacker101: Well I guess we'll have to fight fire with fire. You remember that person who told you about Hacker Battles?"); + break; + case 3: + WriteLine("Hacker101: It's time you know who he is. He is, in fact, me, and to continue on about Hacker Battles..."); + break; + case 4: + WriteLine("Hacker101: I can help you take down DevX, but we'll need to take down his defenses and get into his network."); + break; + case 5: + WriteLine("Hacker101: DevX's network of servers is larger than any datacenter on Earth, and it'll take time to plan the perfect attack."); + break; + case 6: + WriteLine("Hacker101: Think of it this way. DevX has a network of networks, each with their own leader."); + break; + case 7: + WriteLine("Hacker101: I can help you find these networks, but it's up to you to take 'em down."); + break; + case 8: + WriteLine("Hacker101: Of course, it's hard to hack a network if you don't know how to start a battle."); + break; + case 9: + WriteLine("Hacker101: Introducing the Battle Preparation Screen."); + break; + case 10: + WriteLine("Hacker101: It'll show you any network I've found, and it'll tell you some useful info about it."); + break; + case 11: + WriteLine("Hacker101: However the spkg package for this thing is HUGE, and will require lots of tweaks to the ShiftOS desktop. spkg will hopefully administer the tweaks for you, but here's a rundown of what'll happen."); + break; + case 12: + WriteLine("Hacker101: For one, you'll be able to have multiple desktop panels to fit more widgets on them."); + break; + case 13: + WriteLine("Hacker101: And if you have the App Launcher, it will get sorted so it doesn't take up the entire screen when you get so many applications installed."); + break; + case 14: + WriteLine("Hacker101: And the rest is a surprise. I'll initiate the install sequence."); + break; + case 15: + InstallMidGameDesktop(); + break; + } + i2 += 1; + }; + + var t = new System.Windows.Forms.Timer(); + t.Interval = 4000; + int i = 0; + + t.Tick += (object s, EventArgs a) => + { + + + switch (i) + { + case 0: + WriteLine("IP connecting as Hacker101..."); + break; + case 1: + WriteLine("Hacker101: Hello, ShiftOS user. I am a hacker."); + break; + case 2: + if (API.BitnoteAddress != null) + { + WriteLine($"Hacker101: I can prove it. You have {API.Codepoints} Codepoints, your Bitnote Address is {API.BitnoteAddress.Address}, and you have {API.BitnoteAddress.Bitnotes}. That's your private address, by the way."); + } + else + { + WriteLine($"Hacker101: I can prove it. You have {API.Codepoints} Codepoints, and you do not have a Bitnote Address."); + } + break; + case 3: + WriteLine("Hacker101: Enough fun in games. Listen. There are two things you need to know."); + break; + case 4: + WriteLine("Hacker101: Thing #1. DevX isn't real."); + break; + case 5: + WriteLine("Hacker101: I've decompiled parts of ShiftOS. And you know what I found?"); + break; + case 6: + WriteLine("Hacker101: Everything DevX says. Everything he does. Everything he THINKS. It's all hardcoded directly into ShiftOS's core."); + break; + case 7: + WriteLine("Hacker101: Want proof? Here. I'll run a quick Lua script for you."); + string DecompiledCode = Properties.Resources.DecompiledCode; + var l = new LuaInterpreter(); + Form win = l.mod.create_window("Decompiled Code", null, 720, 480); + TextBox txt = new TextBox(); + txt.Multiline = true; + txt.Text = Properties.Resources.DecompiledCode; + txt.BorderStyle = BorderStyle.None; + txt.BackColor = Color.Black; + txt.ForeColor = Color.White; + txt.Font = new Font(OSInfo.GetMonospaceFont(), 9); + l.mod.set_dock(txt, "fill"); + l.mod.add_widget_to_window(win, txt); + break; + case 8: + WriteLine("Hacker101: Not only is that some nice, smokin' fresh C# code directly from ShiftOS, but that's a nice steaming pile of bird poop on DevX's doorstep."); + break; + case 9: + WriteLine("Hacker101: Thing #2. The Shiftnet holds some secrets."); + break; + case 10: + WriteLine("Hacker101: What kind of secrets, I hear you ask through your microphone (jesus, do you seriously talk to us with your voice? Are you that bored?)"); + break; + case 11: + WriteLine("Hacker101: Well. I'm talking, pieces of a Lua script that could help stop DevX dead in his digital tracks."); + break; + case 12: + WriteLine("Hacker101: All you gotta do is use my decryption utilities to find the pieces of this encrypted script, download them, decrypt them, and the utility will automatically piece them together for you."); + break; + case 13: + WriteLine("Hacker101: Shiftnet pages ending with .enc are your best bet."); + break; + case 14: + WriteLine("Hacker101: You can install the utilities using spkg install secret."); + break; + case 15: + WriteLine("Hacker101: Then, when the application installs, run it, and use the password 'binary_hell' to install the REAL utilities."); + break; + case 16: + WriteLine("Hacker101: Anyways, that wraps that up. But hang on. One more thing..."); + t.Stop(); + ShiftOS.Hacking.AddCharacter(new Character("Hacker101", "Let's get the job done.", 75, 45, 5)); + t2.Start(); + break; + } + i += 1; + }; + if (API.Upgrades["hacker101"] == true) + { + t2.Start(); + } + else + { + t.Start(); + } + + + } + + internal void StartAidenNirhStory() + { + var t = new System.Windows.Forms.Timer(); + t.Interval = 4000; + int i = 0; + t.Tick += (object s, EventArgs a) => + { + switch (i) + { + case 0: + WriteLine("User 151.43.85.33 connecting as \"Aiden\"..."); + break; + case 2: + WriteLine($"Aiden: Hey there, {API.Username}1 I'm Aiden Nirh."); + break; + case 3: + WriteLine("Aiden: Have you seen Appscape?"); + break; + case 4: + WriteLine("Aiden: It's my package manager for ShiftOS. It's pretty neat."); + break; + case 5: + WriteLine("Aiden: You should check it out, it's on the Shiftnet at shiftnet://main/appscape!"); + break; + case 6: + WriteLine("Aiden: But remember, when browsing the Shiftnet try not to venture from the main server!"); + break; + case 7: + API.Upgrades["aidennirh"] = true; + t.Stop(); + this.Close(); + break; + } + i += 1; + }; + t.Start(); + } + + internal void StartHacker101Story() + { + var t = new System.Windows.Forms.Timer(); + t.Interval = 4000; + int i = 0; + + t.Tick += (object s, EventArgs a) => + { + switch (i) + { + case 0: + WriteLine("IP connecting as Hacker101..."); + break; + case 1: + WriteLine("Hacker101: Hello, ShiftOS user. I am a hacker."); + break; + case 2: + if (API.BitnoteAddress != null) + { + WriteLine($"Hacker101: I can prove it. You have {API.Codepoints} Codepoints, your Bitnote Address is {API.BitnoteAddress.Address}, and you have {API.BitnoteAddress.Bitnotes}. That's your private address, by the way."); + } + else + { + WriteLine($"Hacker101: I can prove it. You have {API.Codepoints} Codepoints, and you do not have a Bitnote Address."); + } + break; + case 3: + WriteLine("Hacker101: Enough fun in games. Listen. There are two things you need to know."); + break; + case 4: + WriteLine("Hacker101: Thing #1. DevX isn't real."); + break; + case 5: + WriteLine("Hacker101: I've decompiled parts of ShiftOS. And you know what I found?"); + break; + case 6: + WriteLine("Hacker101: Everything DevX says. Everything he does. Everything he THINKS. It's all hardcoded directly into ShiftOS's core."); + break; + case 7: + WriteLine("Hacker101: Want proof? Here. I'll run a quick Lua script for you."); + string DecompiledCode = Properties.Resources.DecompiledCode; + var l = new LuaInterpreter(); + Form win = l.mod.create_window("Decompiled Code", null, 720, 480); + TextBox txt = new TextBox(); + txt.Multiline = true; + txt.Text = Properties.Resources.DecompiledCode; + txt.BorderStyle = BorderStyle.None; + txt.BackColor = Color.Black; + txt.ForeColor = Color.White; + txt.Font = new Font(OSInfo.GetMonospaceFont(), 9); + l.mod.set_dock(txt, "fill"); + l.mod.add_widget_to_window(win, txt); + break; + case 8: + WriteLine("Hacker101: Not only is that some nice, smokin' fresh C# code directly from ShiftOS, but that's a nice steaming pile of bird poop on DevX's doorstep."); + break; + case 9: + WriteLine("Hacker101: Thing #2. The Shiftnet holds some secrets."); + break; + case 10: + WriteLine("Hacker101: What kind of secrets, I hear you ask through your microphone (jesus, do you seriously talk to us with your voice? Are you that bored?)"); + break; + case 11: + WriteLine("Hacker101: Well. I'm talking, pieces of a Lua script that could help stop DevX dead in his digital tracks."); + break; + case 12: + WriteLine("Hacker101: All you gotta do is use my decryption utilities to find the pieces of this encrypted script, download them, decrypt them, and the utility will automatically piece them together for you."); + break; + case 13: + WriteLine("Hacker101: Shiftnet pages ending with .enc are your best bet."); + break; + case 14: + WriteLine("Hacker101: You can install the utilities using spkg install secret."); + break; + case 15: + WriteLine("Hacker101: Then, when the application installs, run it, and use the password 'binary_hell' to install the REAL utilities."); + break; + case 16: + WriteLine("Hacker101: Now go. We need that script. I know a friend who will help you get your hard drive back from DevX if you can do this."); + t.Stop(); + ShiftOS.Hacking.AddCharacter(new Character("Hacker101", "Let's get the job done.", 75, 45, 5)); + API.Upgrades["hacker101"] = true; + this.Close(); + break; + } + i += 1; + }; + t.Start(); + } + + internal void StartOtherPlayerSysFix() + { + var t = new System.Windows.Forms.Timer(); + t.Interval = 4000; + int i = 0; + t.Tick += (object s, EventArgs a) => + { + switch (i) + { + case 0: + WriteLine("User connected as ???."); + break; + case 1: + if (API.Upgrades["otherplayerstory"] == true) + { + WriteLine($"???: {API.Username}! Did he find out? Oh God, I hope he can see this..."); + } + else + { + WriteLine("???: Hello? Uhhhh, is this stupid thing working?"); + } + break; + case 2: + if (API.Upgrades["otherplayerstory"] == true) + { + WriteLine("???: Ahh. Good. You can read this. It's me, the other player."); + } + else + { + WriteLine("???: Thank heaven. You can hear me. Don't ask who I am."); + } + break; + case 3: + WriteLine("???: Looks like DevX hit you hard. Guess he found out you had the Shiftnet."); + break; + case 4: + WriteLine("???: Relax. It's not your fault."); + break; + case 5: + WriteLine("???: Actually, the Shiftnet regularly sends data about it's usage, unencrypted, directly to DevX."); + break; + case 6: + WriteLine("???: This code seems to be embedded into all .saa files. It's actually how I found out about you."); + break; + case 7: + WriteLine("???: It seems weird, I know, but everytime you run a .saa file, an uplink is made to DevX's servers"); + break; + case 8: + if (API.Upgrades["otherplayerstory"] == true) + { + WriteLine("???: And, well, I think we could use this. I'll see if Hacker101 can track this uplink. If he can, you will know it the next time you run a .saa."); + } + else + { + WriteLine("???: And, well, I think we could use this. I have a friend who's good with his hacking skills. I'll see if he can help you stop DevX dead. If he can, he will contact you next time you run a .saa."); + } + break; + case 9: + WriteLine("???: Anyways, connected to your system, I can see your desktop. Looks pretty messed up, huh?"); + break; + case 10: + WriteLine("???: You're lucky you don't have the Windows Everywhere virus."); + break; + case 11: + Viruses.InfectFile(Paths.Drivers + "Keyboard.dri", Viruses.VirusID.WindowsEverywhere); + Viruses.CheckForInfected(); + WriteLine("???: Crap! I spoke too soon."); + break; + case 12: + WriteLine("???: Alright. I'll see if I can hijack your Shiftorium Registry, install a virus scanner, and get rid of the viruses."); + break; + case 13: + API.Upgrades["virusscanner"] = true; + var trm = new Terminal(); + API.CreateForm(trm, API.LoadedNames.TerminalName, Properties.Resources.iconTerminal); + trm.command = "vscan"; + trm.DoCommand(); + break; + case 14: + WriteLine("???: All better. I hope. As for those random files on your desktop, well, it seems DevX dropped some sort of secret message onto your system."); + break; + case 15: + WriteLine("???: Go ahead and try to decrypt it. The Shiftnet Lua API is very useful."); + break; + case 16: + if (API.Upgrades["otherplayerstory"] == true) + { + WriteLine("???: Anyways, I'm gonna go work with Hacker101, discuss those .saa uplinks, and see if we can come up with a suitable attack plan."); + } + else + { + WriteLine("???: Well, your system is all better. You don't have to thank me. Just, when you open a .saa file, I'll try to contact you if I'm not busy."); + } + break; + case 17: + WriteLine("???: Talk to you soon. And, remember. ShiftOS is like a forest. DevX is the predator, you are the prey. Watch your back."); + break; + case 18: + t.Stop(); + this.Close(); + API.Upgrades["otherplayerrescue"] = true; + break; + } + i += 1; + }; + t.Start(); } - private bool Zooming = false; - private void ScrollDeactivate(object sender, KeyEventArgs e) + internal void StartHackerBattleIntro() { - if(Zooming == true) + var t = new System.Windows.Forms.Timer(); + t.Interval = 4000; + int i = 0; + t.Tick += (object s, EventArgs a) => { - Zooming = false; - } + switch (i) + { + case 0: + API.Upgrades["hackerbattles"] = true; + API.Upgrades["hackcommand"] = true; + WriteLine("IP address connecting with no identity..."); + break; + case 1: + WriteLine("Hey there. So I see you're into hacking."); + break; + case 2: + WriteLine("Oh, how rude of me. You don't know if I'm DevX or not."); + break; + case 3: + WriteLine("Well now you do. I will not show my identity, but I am not DevX."); + break; + case 4: + WriteLine("Anyways. There are two things you must know about hacking within ShiftOS."); + break; + case 5: + WriteLine("1. You can hack more than just the Shiftorium. Look around the user interface for any 'Hack it' buttons."); + break; + case 6: + WriteLine("Also, running 'hack' in the Terminal will let you do even more damage to DevX's security systems as well as give you some advantages."); + break; + case 7: + WriteLine("Ever wanted to make the Shiftorium have a bit of a sale, or even better, make all applications pay out more Codepoints than DevX intends?"); + break; + case 8: + WriteLine("Well that 'hack' command is useful then. Go ahead. Try it in another Terminal window. But good God do not close this one."); + break; + case 9: + WriteLine("Because there's one more thing you need to know."); + break; + case 10: + WriteLine("You are not the only person DevX has contacted with ShiftOS."); + break; + case 11: + WriteLine("There are others. Some of them, friendly. Some of them, knowledgable enough to help you."); + break; + case 12: + WriteLine("ShiftOS is like a private community. Anyone can contact anyone provided they have the skill to get in."); + break; + case 13: + WriteLine("Meaning, you may meet some very cool people."); + break; + case 14: + WriteLine("But some of us are... how do you say it... hostile."); + break; + case 15: + WriteLine("Enter the era of Hacker Battles."); + break; + case 16: + WriteLine("It's a network-vs-network every-man-for-himself affair. You'll meet criminals, hackers, agencies and much more."); + break; + case 17: + WriteLine("All offering a little surprise if you can take their network down."); + break; + case 18: + WriteLine("And it's best you get trained, for at any time, anyone could challenge you to one."); + break; + case 19: + WriteLine("And the amount of networks devastated due to untrained users picking a fight with the wrong person is alarmingly huge."); + break; + case 20: + WriteLine("I'll launch a practice program which will teach you the Hacker Battle interface and the fundamentals."); + break; + case 21: + WriteLine("And if you can complete the entire training session, you will be able to defend against anyone who dare battle you."); + break; + case 22: + WriteLine("Starting training session #53D8G in 5 seconds...."); + break; + case 23: + WriteLine("Don't worry. It shouldn't be too difficult for you."); + t.Stop(); + ShiftOS.Hacking.StartBattleTutorial(); + break; + } + i += 1; + }; + t.Start(); } - private int ZoomMultiplier = 1; - - private void ResetTerminalFont() + internal void StartDevXFuriousStory() { - string fname = "Font"; - if(API.Upgrades["setterminalfont"] == true) - { - fname = API.CurrentSkin.TerminalFontStyle; - } - else - { - fname = OSInfo.GetMonospaceFont(); - } - int fsize = 9 * ZoomMultiplier; - try { - txtterm.Font = new Font(fname, fsize); - } - catch + var t = new System.Windows.Forms.Timer(); + t.Interval = 4000; + int i = 0; + t.Tick += (object s, EventArgs a) => { - txtterm.Font = new Font(fname, 9); - } + switch (i) + { + case 0: + WriteLine("IP 199.108.232.1 Connecting..."); + break; + case 1: + WriteLine("DevX: WHAT HAVE YOU DONE?"); + break; + case 2: + WriteLine("DevX: How the HELL did you get the Shiftnet?"); + break; + case 3: + WriteLine("DevX: What sites have you seen? TALK TO ME."); + break; + case 4: + WriteLine("DevX: Alright, got nothing to say? Fine. You will pay for this..."); + break; + case 5: + WriteLine("DevX: I don't know what I'll do... I don't know when I'll do it... but you will wish you never touched a computer in your life..."); + break; + case 6: + t.Stop(); + Viruses.DropDevXPayload(); + this.Close(); + var trm = new Terminal(); + API.CreateForm(trm, API.LoadedNames.TerminalName, API.GetIcon("Terminal")); + trm.StartDevXFuriousStory2(); + break; + } + i += 1; + }; + t.Start(); } - private void Zoom(object sender, ScrollEventArgs e) + private void StartDevXFuriousStory2() { - + var t = new Thread(new ThreadStart(new Action(() => + { + WriteLine("User '???' connecting..."); + API.PlaySound(Properties.Resources.dial_up_modem_02); + WriteLine("???: Hello? Ummm... this is awkward..."); + BeepSleep(3000); + WriteLine("???: Listen - I'm a hacker. Well, not really. I'm friends with one."); + BeepSleep(3000); + WriteLine("???: Seems like DevX completely obliterated your system with one of his viruses."); + BeepSleep(2500); + WriteLine("???: I'll fix that for you."); + API.Upgrades["virusscanner"] = true; + this.Invoke(new Action(() => + { + this.command = "vscan"; + this.DoCommand(); + })); + BeepSleep(1000); + WriteLine("???: Better? Cool. Now, I need your help."); + BeepSleep(1250); + WriteLine("???: I can't reveal my identity yet - but I co-own this chat-room..."); + BeepSleep(1175); + WriteLine("???: It's called the 'Hacker Alliance'."); + BeepSleep(1000); + WriteLine("???: I'm going to install something called 'HoloChat' on your system. It'll be quick."); + BeepSleep(2000); + WriteLine("Installing HoloChat..."); + API.Upgrades["holochat"] = true; + Thread.Sleep(100); + WriteLine("Done. Resetting desktop..."); + this.Invoke(new Action(() => { API.CurrentSession.SetupDesktop(); })); + WriteLine("Done."); + Thread.Sleep(3000); + WriteLine("???: Alright - I'll talk to you soon. Just join that chat room when you're ready."); + BeepSleep(1000); + this.Invoke(new Action(() => + { + this.Close(); + })); + }))); + t.Start(); } - - private void ScrollTerm(object sender, MouseEventArgs e) + public void StartOtherPlayerStory() { - if(Zooming == true) - { - - } else + var t = new System.Windows.Forms.Timer(); + t.Interval = 4000; + int i = 0; + t.Tick += (object s, EventArgs a) => { - if(API.Upgrades["terminalscrollbar"] == true) + switch (i) { - txtterm.ScrollBars = ScrollBars.Vertical; + case 0: + WriteLine("IP Address is connecting as '???'..."); + break; + case 1: + WriteLine("Connection established."); + break; + case 2: + WriteLine("???: Hi, ShiftOS user. I have something to tell you."); + break; + case 3: + WriteLine("???: I'm not a hacker. I'm not a programmer. I am just like you."); + break; + case 4: + WriteLine("???: I am... the Other Player."); + break; + case 5: + WriteLine("???: I too have heard DevX's story about ShiftOS being an experimental operating system."); + break; + case 6: + WriteLine("???: I have also met another user. We'll call him... I don't know... Robert."); + break; + case 7: + WriteLine("???: And this Robert guy, well, he knows a lot about ShiftOS, and DevX."); + break; + case 8: + WriteLine("???: Robert is a fake name I'm calling him. You might know him as Hacker101."); + break; + case 9: + WriteLine("???: Anyways, He told me about you, so I figured I would help you get out of this mess."); + break; + case 10: + WriteLine("???: He said he'll help me get my hard drive back, and get ShiftOS off my system. Once he does, I'll tell you."); + break; + case 11: + WriteLine("???: In the meantime, I have one word for you. Survive. Do NOT let DevX get to you. Do not fall for his tricks. Just play along until I contact you."); + break; + case 12: + WriteLine("???: I'll talk to you about this soon."); + break; + case 13: + t.Stop(); + this.Close(); + API.Upgrades["otherplayerstory1"] = true; + break; } - } + i += 1; + }; + t.Start(); } - private void tmrsetfont_Tick(object sender, EventArgs e) + private void txtterm_TextChanged(object sender, EventArgs e) { - ResetTerminalFont(); - if(API.Upgrades["setterminalcolors"] == true) - { - txtterm.BackColor = API.CurrentSkin.TerminalBackColor; - txtterm.ForeColor = API.CurrentSkin.TerminalTextColor; - } + } } - -} +} \ No newline at end of file diff --git a/source/WindowsFormsApplication1/Engine/SaveSystem.cs b/source/WindowsFormsApplication1/Engine/SaveSystem.cs index ac8a8c9..96c506c 100644 --- a/source/WindowsFormsApplication1/Engine/SaveSystem.cs +++ b/source/WindowsFormsApplication1/Engine/SaveSystem.cs @@ -460,6 +460,8 @@ namespace SaveSystem DefaultUpgrades.Add(new Shiftorium.Upgrade("nb_tier_medium - 0 CP", null, null, "nodisplay", "fundamental")); DefaultUpgrades.Add(new Shiftorium.Upgrade("nb_tier_hard - 0 CP", null, null, "nodisplay", "fundamental")); + //william341 + DefaultUpgrades.Add(new Shiftorium.Upgrade("Command Line EXES - 50 CP", null, "With this upgrade we can make the operating system compatible with command line tools from Windows!", null, "useful")); } /// -- cgit v1.2.3