diff --git a/source/WindowsFormsApplication1/Apps/Shiftnet.Designer.cs b/source/WindowsFormsApplication1/Apps/Shiftnet.Designer.cs
index 5d20f14..cafae5f 100644
--- a/source/WindowsFormsApplication1/Apps/Shiftnet.Designer.cs
+++ b/source/WindowsFormsApplication1/Apps/Shiftnet.Designer.cs
@@ -90,6 +90,7 @@ private void InitializeComponent()
this.txtaddress.Size = new System.Drawing.Size(640, 20);
this.txtaddress.TabIndex = 0;
this.txtaddress.Text = "shiftnet://main";
+ this.txtaddress.TextChanged += new System.EventHandler(this.txtaddress_TextChanged);
//
// wbshiftnet
//
diff --git a/source/WindowsFormsApplication1/Apps/Shiftnet.cs b/source/WindowsFormsApplication1/Apps/Shiftnet.cs
index cbcab1b..017377c 100644
--- a/source/WindowsFormsApplication1/Apps/Shiftnet.cs
+++ b/source/WindowsFormsApplication1/Apps/Shiftnet.cs
@@ -60,11 +60,17 @@ private void btnhome_Click(object sender, EventArgs e)
wbshiftnet.DocumentText = WebLayer.VisitSite("shiftnet://main");
txtaddress.Text = WebLayer.LastUrl;
}
+
+ private void txtaddress_TextChanged(object sender, EventArgs e)
+ {
+
+ }
}
public class WebLayer
{
- private static string HtmlTemplate = "
Shiftnet Page#BODY#";
+ public static String serverurl = "http://playshiftos.ml";
+ private static string HtmlTemplate = "Shiftnet Page#BODY#";
public static string LastUrl = null;
public static string VisitSite(string url)
@@ -74,7 +80,7 @@ public static string VisitSite(string url)
{
try
{
- string content = wc.DownloadString(url.Replace("shiftnet://", "http://www.playshiftos.ml/shiftnet/www/"));
+ string content = wc.DownloadString(url.Replace("shiftnet://", serverurl + "/shiftnet/www/"));
if (content.StartsWith(""))
{
LastUrl = url;
diff --git a/source/WindowsFormsApplication1/Apps/Terminal.cs b/source/WindowsFormsApplication1/Apps/Terminal.cs
index 1d39f70..6e9828b 100644
--- a/source/WindowsFormsApplication1/Apps/Terminal.cs
+++ b/source/WindowsFormsApplication1/Apps/Terminal.cs
@@ -36,64 +36,6 @@ public Terminal(bool modlog)
current_dir = Paths.SaveRoot;
}
- public void StartOtherPlayerStory()
- {
- 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 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;
@@ -101,14 +43,15 @@ private void Terminal_Load(object sender, EventArgs e)
{
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);
@@ -137,7 +80,8 @@ private void Terminal_Load(object sender, EventArgs e)
if (a.Delta > 0)
{
ZoomMultiplier += 1;
- } else
+ }
+ else
{
ZoomMultiplier -= 1;
}
@@ -152,14 +96,14 @@ private void Terminal_Load(object sender, EventArgs e)
ResetTerminalFont();
StartLogCheck();
tmrsetfont.Start();
-
+
}
-
+
private void StartLogCheck()
{
- if(ModLogger == true)
+ if (ModLogger == true)
{
var tmrlog = new System.Windows.Forms.Timer();
tmrlog.Interval = 500;
@@ -245,8 +189,9 @@ public void SelectBottom()
// ERROR: Handles clauses are not supported in C#
private void txtterm_KeyPress(object sender, System.Windows.Forms.KeyEventArgs e)
{
- if(e.Control) {
- if(API.Upgrades["zoomableterminal"] == true)
+ if (e.Control)
+ {
+ if (API.Upgrades["zoomableterminal"] == true)
{
Zooming = true;
}
@@ -315,13 +260,14 @@ private void txtterm_KeyPress(object sender, System.Windows.Forms.KeyEventArgs e
e.SuppressKeyPress = true;
trackpos = trackpos - 1;
}
- else {
+ else
+ {
trackpos = trackpos - 2;
}
}
else
{
- switch(SelectedMode)
+ switch (SelectedMode)
{
case 1:
if (SelectedCharacter > 0)
@@ -351,7 +297,8 @@ private void txtterm_KeyPress(object sender, System.Windows.Forms.KeyEventArgs e
trackpos += API.LastRanCommand.Length;
txtterm.Select(txtterm.TextLength, 0);
}
- else {
+ else
+ {
trackpos = trackpos - 1;
}
break;
@@ -412,7 +359,7 @@ private void txtterm_KeyPress(object sender, System.Windows.Forms.KeyEventArgs e
}
else
{
- switch(SelectedMode)
+ switch (SelectedMode)
{
case 1:
ShiftOS.Hacking.StartHack(SelectedCharacter, UpgradeToHack);
@@ -420,7 +367,7 @@ private void txtterm_KeyPress(object sender, System.Windows.Forms.KeyEventArgs e
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);
@@ -438,10 +385,11 @@ private void txtterm_KeyPress(object sender, System.Windows.Forms.KeyEventArgs e
{
trackpos = 0;
var lua = txtterm.Lines[txtterm.Lines.Length - 1];
- try {
+ try
+ {
Interpreter.mod(lua);
}
- catch(Exception ex)
+ catch (Exception ex)
{
WriteLine(ex.Message);
}
@@ -452,14 +400,17 @@ private void txtterm_KeyPress(object sender, System.Windows.Forms.KeyEventArgs e
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();
@@ -470,7 +421,8 @@ private void txtterm_KeyPress(object sender, System.Windows.Forms.KeyEventArgs e
trackpos += 1;
}
}
- else {
+ else
+ {
trackpos = trackpos + 1;
}
}
@@ -482,12 +434,14 @@ private void txtterm_KeyPress(object sender, System.Windows.Forms.KeyEventArgs e
{
e.SuppressKeyPress = true;
}
- else {
+ else
+ {
if (txtterm.SelectedText.Length < 1)
{
trackpos = trackpos - 1;
}
- else {
+ else
+ {
e.SuppressKeyPress = true;
}
}
@@ -501,7 +455,1636 @@ private void txtterm_KeyPress(object sender, System.Windows.Forms.KeyEventArgs e
}
- 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(() =>
+ {
+ 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(() =>
+ {
+ 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 LuaInterpreter Interpreter = null;
+ private bool blockctrlt = false;
+
+ 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());
+ }
+ //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)
+ {
+ 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;
+ }
+
+ private bool LuaMode = false;
+
+ public string GetPath(string path)
+ {
+ return path.Replace(Paths.SaveRoot, "").Replace(OSInfo.DirectorySeparator, "/");
+ }
+
+ public string GetParent(string path)
+ {
+ if (new DirectoryInfo(path).Parent.FullName.Contains("ShiftOS"))
+ {
+ var d = new DirectoryInfo(path);
+ return d.Parent.FullName;
+ }
+ else
+ {
+ return path;
+ }
+ }
+
+ public void DoCommand()
+ {
+ API.LastRanCommand = command;
+ string[] args = command.ToLower().Split(' ');
+ switch (args[0])
+ {
+ case "ls":
+ case "dir":
+ if (API.Upgrades["fileskimmer"])
+ {
+ 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}");
+ }
+ }
+ else
+ {
+ wrongcommand();
+ }
+ break;
+ case "cd":
+ if (API.Upgrades["fileskimmer"])
+ {
+ if (args[1] == "..")
+ {
+ if (GetPath(current_dir) != "/")
+ {
+ current_dir = GetParent(current_dir);
+ SetPrefix($"{API.Username}@{API.OSName} in {GetPath(current_dir)} $> ");
+ }
+ else
+ {
+ WriteLine("cd: Can't go up past the root.");
+ }
+ }
+ 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)} $> ");
+ }
+ }
+ break;
+ case "upg":
+ if (API.DeveloperMode)
+ {
+ try
+ {
+ switch (args[1])
+ {
+ case "get":
+ WriteLine(API.Upgrades[args[2]].ToString());
+ break;
+ }
+ }
+ catch
+ {
+
+ }
+ }
+ else
+ {
+ wrongcommand();
+ }
+ break;
+ case "endgame_test":
+ 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();
+ }
+ break;
+ case "htutorial":
+ ShiftOS.Hacking.StartBattleTutorial();
+ break;
+ case "fake_buy":
+ 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();
+ }
+ break;
+ case "connections":
+ try
+ {
+ switch (args[1])
+ {
+ 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;
+ }
+ }
+ catch
+ {
+ WriteLine("connections: Missing arguments.");
+ }
+ break;
+ case "story":
+ if (API.DeveloperMode == true && API.Upgrades["shiftnet"])
+ {
+ 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.");
+ }
+ }
+ else { wrongcommand(); }
+ break;
+ case "make":
+ try
+ {
+ string path = command.Replace("make ", "");
+ string realpath = $"{Paths.SaveRoot}{path.Replace("/", OSInfo.DirectorySeparator)}";
+ if (File.Exists(realpath + OSInfo.DirectorySeparator + "main.lua"))
+ {
+ WriteLine("Compiling to " + path + ".saa");
+ ZipFile.CreateFromDirectory(realpath, realpath + ".saa");
+ }
+ else
+ {
+ WriteLine($"make: *** No rule to make target \"{realpath}\". Stop.");
+ }
+ }
+ catch
+ {
+ WriteLine("make: Invalid arguments.");
+ }
+ break;
+ case "linux":
+ if (API.DeveloperMode)
+ {
+ WriteLine("Upgrading your system...");
+ foreach (var upg in Shiftorium.Utilities.GetAvailable())
+ {
+ API.Upgrades[upg.id] = true;
+ WriteLine("Installed upgrade \"" + upg.Name + "\"...");
+ }
+ API.UpdateWindows();
+ API.CurrentSession.SetupDesktop();
+ }
+ else
+ {
+ wrongcommand();
+ }
+ break;
+ case "cheat":
+ if (API.DeveloperMode)
+ {
+ WriteLine("Opening...");
+
+ //Apps.Cheats chts = new Apps.Cheats();
+ //chts.Show();
+ API.CreateForm(new Apps.Cheats(), "Cheats", API.GetIcon("Terminal"));
+ }
+ else
+ {
+ wrongcommand();
+ }
+ break;
+ case "netgen":
+ WriteLine("Starting netgen...");
+ API.CreateForm(new NetGen(), "Network Generator", API.GetIcon("Terminal"));
+ break;
+ case "lua":
+ if (API.DeveloperMode == true)
+ {
+ 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();
+ }
+ break;
+ case "hack":
+ if (API.Upgrades["hacking"] == true)
+ {
+ StartHackingSession("random");
+ }
+ else
+ {
+ wrongcommand();
+ }
+ break;
+ case "virusscanner":
+ case "vscan":
+ 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.");
+ }
+ }
+ break;
+ case "infections":
+ if (API.DeveloperMode == true)
+ {
+ foreach (KeyValuePair kv in Viruses.Infections)
+ {
+ WriteLine(kv.Key + " @ " + kv.Value);
+ }
+ }
+ else
+ {
+ wrongcommand();
+ }
+ break;
+ case "binarywater":
+ 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.");
+ }
+ 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.");
+ }
+ break;
+ case "color":
+ 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.");
+ }
+ break;
+ case "encrypt":
+ if (API.DeveloperMode == true)
+ {
+ string messageToEncrypt = command.Replace("encrypt ", "");
+ string encryptedMessage = API.Encryption.Encrypt(messageToEncrypt);
+ WriteLine("Encrypted Message: " + encryptedMessage);
+ }
+ else
+ {
+ wrongcommand();
+ }
+ break;
+ case "font":
+ 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();
+ }
+ break;
+ case "colorlist":
+ if (API.Upgrades["setterminalcolors"] == true)
+ {
+ foreach (string itm in GetColorList())
+ {
+ WriteLine(itm);
+ }
+ }
+ else
+ {
+ wrongcommand();
+ }
+ break;
+ case "spkg":
+ if (!API.LimitedMode)
+ {
+ if (API.Upgrades["shiftnet"] == true)
+ {
+ try
+ {
+ switch (args[1].ToLower())
+ {
+ case "install":
+ if (args[2] != null && args[2] != "")
+ {
+ string pkgname = args[2].ToLower().Replace(".pkg", "");
+ if (Package_Grabber.GetPackage(pkgname) == true)
+ {
+ WriteLine("Downloaded package '" + pkgname + "' from shiftnet://main/spkg/ successfully. Installing now.");
+ string r = Package_Grabber.ExtractPackage();
+ if (r == "fail")
+ {
+ WriteLine("[FATAL] Could not install package.");
+ WriteLine("spkg: Killed.");
+ }
+ else
+ {
+ WriteLine("Extracted " + pkgname + " to " + r + "...");
+ var res2 = Package_Grabber.InstallPackage(r + "\\");
+ if (res2 != "success")
+ {
+ WriteLine("[FATAL] Could not install package. " + res2);
+ WriteLine("spkg: Killed.");
+ }
+ else
+ {
+ WriteLine("[DONE] Package installed.");
+ }
+ }
+ }
+ else
+ {
+ WriteLine("spkg: Package '" + args[2] + "' not found.");
+ }
+ }
+ break;
+ default:
+ WriteLine("spkg: Invalid argument: " + args[1]);
+ break;
+ }
+ }
+ catch (Exception ex)
+ {
+ WriteLine("spkg: " + ex.Message);
+ }
+ }
+ else
+ {
+ wrongcommand();
+ }
+ }
+ else
+ {
+ try
+ {
+ if (args[2] == "god_utils")
+ {
+ if (FinalMission.EndGameHandler.GodModeInstallEnabled == true)
+ {
+ var t = new Thread(new ThreadStart(new Action(() =>
+ {
+ WriteLine("Downloading package 'god_utils'... Please wait.");
+ Thread.Sleep(10000);
+ WriteLine("Download complete.");
+ Thread.Sleep(100);
+ WriteLine("Beginning installation.");
+ Thread.Sleep(1000);
+ WriteLine(@" == GOD MODE ==
+
+God Mode gives you FULL control of ShiftOS. You can add/remove Codepoints, buy or unbuy Shiftorium upgrades, and can do whatever you want.
+
+Installing core applications...");
+ Thread.Sleep(250);
+ WriteLine("Installing subpackage 'json_edit'...");
+ Thread.Sleep(250);
+ WriteLine("Installing subpackage 'upgrade_mod'...");
+ Thread.Sleep(100);
+ WriteLine("Installing subpackage 'hijacker'...");
+ Thread.Sleep(500);
+ WriteLine(@" == HIJACKER by DevX ==
+
+HIJACKER is a utility that allows you to hijack any system and install ShiftOS on it during a hacker battle.");
+ Thread.Sleep(100);
+ WriteLine("[hijacker] Injecting HIJACKER code into hbattleui.sft...");
+ Thread.Sleep(150);
+ WriteLine("[hijacker] Done.");
+ this.Invoke(new Action(() =>
+ {
+ StartChoice1EndStory();
+ }));
+ })));
+ t.Start();
+ }
+ else
+ {
+ WriteLine("spkg: Package '" + args[2] + "' not found.");
+ }
+ }
+ else
+ {
+ WriteLine("spkg: Package '" + args[2] + "' not found.");
+ }
+ }
+ catch
+ {
+ WriteLine("spkg: Missing arguments.");
+ }
+ }
+ break;
+ case "alias":
+ try
+ {
+ switch (args[1])
+ {
+ case "-?":
+ case "--help":
+ WriteLine("Aliases Help" + Environment.NewLine);
+ WriteLine("Alias is a command that lets you create aliases for other commands. You could make a command 'upgrade' alias 'shiftorium' if you wanted." + Environment.NewLine);
+ WriteLine("Arguments:");
+ WriteLine(" -h, --help: Displays this screen.");
+ WriteLine("-a, --add : Adds a new alias.");
+ WriteLine("-d, --delete : Deletes an alias.");
+ WriteLine("-l, --list: Shows all available aliases.");
+ break;
+ case "--add":
+ case "-a":
+ if (API.AddAlias(args[2], command.Replace("alias " + args[1] + " " + args[2] + " ", "")))
+ {
+ WriteLine("Alias added successfully.");
+ API.SaveAliases();
+ }
+ else
+ {
+ WriteLine("That alias already exists.");
+ }
+ break;
+ case "--delete":
+ case "-d":
+ if (API.RemoveAlias(args[2]) == true)
+ {
+ WriteLine("Alias \"" + args[2] + "\" removed successfully.");
+ API.SaveAliases();
+ }
+ else
+ {
+ WriteLine("That alias doesn't exist.");
+ }
+ break;
+ case "-l":
+ case "--list":
+ WriteLine("Aliases:");
+ foreach (KeyValuePair kv in API.CommandAliases)
+ {
+ WriteLine(kv.Key + " => " + kv.Value);
+ }
+ break;
+ default:
+ WriteLine("alias: Invalid argument. Try alias --help for help with the Alias command.");
+ break;
+ }
+ }
+ catch
+ {
+ WriteLine("alias: Missing arguments. Try alias --help for help with the Alias command.");
+ }
+ break;
+ case "username":
+ if (API.Upgrades["customusername"] == true)
+ {
+ try
+ {
+ API.CurrentSave.username = args[1];
+ }
+ catch
+ {
+ WriteLine("username: Missing arguments.");
+ }
+ }
+ else
+ {
+ wrongcommand();
+ }
+ break;
+ case "osname":
+ if (API.Upgrades["customusername"] == true)
+ {
+ try
+ {
+ API.CurrentSave.osname = args[1];
+ }
+ catch
+ {
+ WriteLine("osname: Missing arguments.");
+ }
+ }
+ else
+ {
+ wrongcommand();
+ }
+ break;
+
+ case "unity":
+ if (API.Upgrades["unitymode"] == true)
+ {
+ API.CurrentSession.SetUnityMode();
+ API.CurrentSession.SetupDesktop();
+ txtterm.Focus();
+ }
+ else
+ {
+ wrongcommand();
+ }
+ break;
+ case "time":
+ if (API.Upgrades["pmandam"] == false)
+ {
+ if (API.Upgrades["hourssincemidnight"] == false)
+ {
+ if (API.Upgrades["minutessincemidnight"] == false)
+ {
+ if (API.Upgrades["secondssincemidnight"] == true)
+ {
+ WriteLine("Since midnight, " + API.GetTime() + " seconds have passed.");
+ }
+ else
+ {
+ wrongcommand();
+ }
+ }
+ else
+ {
+ WriteLine("Since midnight, " + API.GetTime() + " minutes have passed.");
+ }
+ }
+ else
+ {
+ WriteLine("Since Midnight, " + API.GetTime() + " hours have passed.");
+ }
+ }
+ else
+ {
+ WriteLine("Current time: " + API.GetTime());
+ }
+ break;
+ case "saa":
+ if (API.Upgrades["shiftnet"])
+ {
+ var f = command.Replace("saa ", "");
+ if (f.StartsWith("/"))
+ {
+ var withoutslash = f.Remove(0, 1);
+ var dirsep = OSInfo.DirectorySeparator;
+ var rightdir = $"{Paths.SaveRoot}{dirsep}{f.Replace("/", dirsep)}";
+ if (File.Exists(rightdir))
+ {
+ var finf = new FileInfo(rightdir);
+ if (finf.Extension == ".saa")
+ {
+ API.LaunchMod(finf.FullName);
+ }
+ else
+ {
+ WriteLine("saa: Cannot launch the file '" + finf.FullName + " because it isn't a valid stand-alone app.");
+ }
+ }
+ else
+ {
+ WriteLine("saa: Cannot launch the file '" + f + "' because it doesn't exist.");
+ }
+ }
+ else
+ {
+ WriteLine("saa: Cannot launch the file '" + f + "' because it doesn't exist.");
+ }
+ }
+ else
+ {
+ wrongcommand();
+ }
+ break;
+ case "help":
+ try
+ {
+ showhelp(args[1]);
+ }
+ catch
+ {
+ showhelp();
+ }
+ break;
+ case "codepoints":
+ case "cp":
+ WriteLine("You have " + API.Codepoints.ToString() + " Codepoints.");
+ break;
+ case "shutdown":
+ API.ShutDownShiftOS();
+ break;
+ case "clear":
+ txtterm.Text = "";
+ break;
+ case "close":
+ if (command.Contains("close "))
+ {
+ var pid = command.Replace("close ", "");
+ if (API.CloseProgram(pid) == true)
+ {
+ WriteLine("Closed all running " + pid + "s.");
+ }
+ else
+ {
+ WriteLine("No processes with id '" + pid + "' were found!");
+ }
+ }
+ else
+ {
+ WriteLine("Insufficient arguments.");
+ }
+ break;
+ case "05tray":
+ if (API.DeveloperMode == true)
+ {
+ API.AddCodepoints(500);
+ WriteLine("You've been granted 500 Codepoints.");
+ }
+ else
+ {
+ wrongcommand();
+ }
+
+ break;
+ case "debug":
+ if (API.DeveloperMode == true)
+ {
+ try
+ {
+ switch (args[1].ToLower())
+ {
+ case "shiftnet-story":
+ WriteLine("Debugging Shiftnet Story...");
+ StartShiftnetStory();
+ break;
+ case "devmode":
+ API.DeveloperMode = false;
+ WriteLine("Turned off developer mode. Use the passcode to turn it back on.");
+ break;
+ default:
+ WriteLine("Invalid argument: " + args[1] + ". Debug can only debug the following: 'shiftnet-story'.");
+ break;
+ }
+
+ }
+ catch (Exception ex)
+ {
+ WriteLine("debug: " + ex.Message);
+ }
+ }
+ else
+ {
+ try
+ {
+ switch (args[1].ToLower())
+ {
+ case "developers123":
+ WriteLine("Turned Developer Mode on!");
+ API.DeveloperMode = true;
+ break;
+ default:
+ wrongcommand();
+ break;
+ }
+ }
+ catch
+ {
+ wrongcommand(); //Debug command pretends to be an invalid command if an exception is thrown.
+ }
+ }
+ break;
+ case "echo":
+ if (command.Contains("echo "))
+ {
+ WriteLine(command.Replace("echo ", ""));
+ }
+ else
+ {
+ WriteLine("echo: Insufficient Parameters.");
+ }
+ break;
+ case "syncsave":
+ WriteLine("Command removed.");
+ break;
+
+ default:
+ if (API.OpenProgram(args[0]) == false)
+ {
+ if (API.Upgrades["trmfiles"] == false)
+ {
+ bool done = false;
+ foreach (KeyValuePair kv in API.CommandAliases)
+ {
+ if (kv.Key == command)
+ {
+ command = kv.Value;
+ done = true;
+ DoCommand();
+ }
+
+ }
+ if (done == false)
+ {
+ wrongcommand();
+ }
+ }
+ else
+ {
+ var f = command.Replace("\\", "/");
+ if (f.StartsWith("/"))
+ {
+ var withoutslash = f.Remove(0, 1);
+ var dirsep = OSInfo.DirectorySeparator;
+ var proper = $"{Paths.SaveRoot}{dirsep}{withoutslash.Replace("/", dirsep)}";
+ if (File.Exists(proper))
+ {
+ runterminalfile(proper);
+ }
+ else
+ {
+ wrongcommand();
+ }
+ }
+ else
+ {
+ bool done = false;
+ foreach (KeyValuePair kv in API.CommandAliases)
+ {
+ if (kv.Key == command)
+ {
+ command = kv.Value;
+ done = true;
+ DoCommand();
+ }
+
+ }
+ if (done == false)
+ {
+ wrongcommand();
+ }
+ }
+ }
+ }
+ break;
+ }
+ }
+
+ private void StartChoice1EndStory()
+ {
+ var t = new System.Windows.Forms.Timer();
+ int i = 0;
+ t.Interval = 4000;
+ t.Tick += (object s, EventArgs a) =>
+ {
+ switch (i)
+ {
+ case 0:
+ WriteLine("User '' connected as '???'");
+ break;
+ case 1:
+ WriteLine($"???: {API.Username}! What are you doing!?");
+ break;
+ case 2:
+ WriteLine("???: I went onto the Hacker Alliance room earlier and DevX was on there...");
+ break;
+ case 3:
+ WriteLine("???: And he told me you SIDED WITH HIM.");
+ break;
+ case 4:
+ WriteLine("???: This is a HUGE mistake! Listen!");
+ break;
+ case 5:
+ WriteLine("???: He's lying to you. Listen. DevX is not what you think he is.");
+ break;
+ case 6:
+ WriteLine("???: He isn't a human! He's an AI! We were all played!");
+ break;
+ case 7:
+ WriteLine("???: I'm telling the truth, I swear!");
+ break;
+ case 8:
+ WriteLine("???: You want proof? - holochat_cmd: ERROR: Remote host closed connection.");
+ break;
+ case 9:
+ WriteLine("spkg: Rebooting system in 8 seconds.");
+ break;
+ case 11:
+ API.Upgrades["titlebar"] = false;
+ API.Upgrades["windowedterminal"] = false; //terminals must be fullscreen
+ var trm = new Terminal();
+ this.Close();
+ API.CreateForm(trm, "Terminal", API.GetIcon("Terminal"));
+ trm.StartReboot();
+ break;
+ }
+ i += 1;
+ };
+ t.Start();
+ }
+
+ public void StartReboot()
+ {
+ txtterm.Text = "";
+ var t1 = new Thread(new ThreadStart(new Action(() =>
+ {
+ Thread.Sleep(500);
+ WriteLine("ShiftOS: Kernel deactivated.");
+ Thread.Sleep(1000);
+ this.Invoke(new Action(() =>
+ {
+ txtterm.Text = "";
+ }));
+ Thread.Sleep(1000);
+ WriteLine("Welcome to ShiftOS.");
+ Thread.Sleep(500);
+ WriteLine("Starting core...");
+ API.Upgrades["windowedterminal"] = true;
+ Thread.Sleep(450);
+ WriteLine($"Your username is {API.Username}.");
+ Thread.Sleep(100);
+ WriteLine($"You have {API.Codepoints} Codepoints.");
+ WriteLine("Loading modules...");
+ Thread.Sleep(750);
+ foreach (var upg in API.Upgrades)
+ {
+ if (upg.Value == true)
+ {
+ WriteLine($"Loaded module {upg.Key}...");
+ }
+ Thread.Sleep(100);
+ }
+ WriteLine("Starting desktop.");
+ this.Invoke(new Action(() =>
+ {
+ var s = new ShiftOSDesktop();
+ s.Show();
+ s.EndGame_AttachEvents();
+ }));
+ Thread.Sleep(1000);
+ this.Invoke(new Action(() =>
+ {
+ FinalMission.EndGameHandler.GoToNextObjective();
+ }));
+ API.Upgrades["titlebar"] = true;
+ })));
+ t1.Start();
+ }
+
+ public void Crash()
+ {
+ txtterm.Text = "";
+ WriteLine(" *** SYSTEM PANIC *** ");
+ 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 System.Windows.Forms.Timer();
+ t.Interval = 1000;
+ int p = 0;
+ t.Tick += (object s, EventArgs a) =>
+ {
+ if (p == 4)
+ {
+ t.Stop();
+ this.Close();
+ }
+ p += 1;
+ };
+ t.Start();
+ }
+
+ private void wrongcommand()
+ {
+ txtterm.Text = txtterm.Text + Environment.NewLine + "Command not recognized - Type 'help' for a list of commands!" + Environment.NewLine;
+ }
+
+ bool Hacking = false;
+
+ private Control objToWriteTo = null;
+ private string UpgradeToHack = null;
+
+ public void StartHackingSession(string id)
+ {
+ UpgradeToHack = id;
+ objToWriteTo = txtterm;
+ Hacking = true;
+ txtterm.ReadOnly = true;
+ WriteLine("To continue, choose which way you ");
+ WriteLine("would like to go about this. ");
+ WriteLine(" ");
+ WriteLine("1. Go it alone. ");
+ WriteLine("2. Hire someone. ");
+ WriteLine(" ");
+ WriteLine("Press the key that corresponds to ");
+ WriteLine("the option you want. ");
+
+ }
+
+ public void showhackinghelp()
+ {
+ WriteLine(" - Hacking - ");
+ WriteLine(Environment.NewLine + "Hacking allows you to gain more features and upgrades by unlocking more of the OS's capabilities.");
+ WriteLine(Environment.NewLine + "There are two ways you can execute a hack:");
+ WriteLine(" - On your own: It'll take skill, and time, but if you have the correct tools you can do it on your own.");
+ WriteLine(" - With a more competent partner: You have the option of employing a partner from a list of various hackers. The speed and success of the hack depends on their skill, and how fast they can pull it off. You will need to pay them a fee of Codepoints however. They can also grant you tools to do it on your own.");
+ WriteLine(Environment.NewLine + "Some hacks are capable of:");
+ WriteLine(" - Decreasing or increasing the price of Shiftorium Upgrades");
+ WriteLine(" - Decreasing or increasing the amount of Codepoints earned by doing various tasks.");
+ WriteLine(" - Unlocking more upgrades.");
+ WriteLine(Environment.NewLine + "To start a hack, go to a locked or empty Shiftorium category and click the \"Hack It\" button.");
+ API.Upgrades["hacking"] = true;
+ }
+
+ public void showhelp(string topic)
+ {
+ switch (topic)
+ {
+ case "hacking":
+ showhackinghelp();
+ break;
+ default:
+ WriteLine("No help available for this topic. Try 'help' for general help.");
+ break;
+ }
+ }
+
+ public void showhelp()
+ {
+ listinfo();
+ WriteLine(" ");
+ listcommands();
+ listprograms();
+ }
+
+ private void listprograms()
+ {
+ WriteLine("Programs installed: " + Environment.NewLine);
+ WriteLine(" - terminal: A command-line application that lets you run programs in ShiftOS");
+ WriteLine(" - shiftorium: An application where you can buy upgrades and new apps using codepoints.");
+ /* TEMP-REMOVED - I just can't get it to work.
+ WriteLine(" - jumper: A simple 'jump over the obstacle' game.");
+ */
+ WriteLine(" - knowledge_input: Test your knowledge, and gain some Codepoints too.");
+ if (API.Upgrades["shifter"] == true)
+ WriteLine(" - shifter: Allows you to customize ShiftOS.");
+ if (API.Upgrades["skinning"] == true)
+ WriteLine(" - skinloader: Load and save ShiftOS skins.");
+ if (API.Upgrades["pong"] == true)
+ WriteLine(" - pong: A good ole' game of Pong.");
+ if (API.Upgrades["fileskimmer"] == true)
+ WriteLine(" - fileskimmer: Browse the files on your computer.");
+ if (API.Upgrades["textpad"] == true)
+ WriteLine(" - textpad: \"Write, save, and open a text document.\" - Philip Adams");
+ if (API.Upgrades["artpad"] == true)
+ WriteLine(" - artpad: A simple, but useful drawing application.");
+ if (API.Upgrades["shiftnet"] == true)
+ WriteLine("Also, more apps can be run by opening .saa files. Apps can also be installed using spkg or by double clicking .pkg or .stp files.");
+ }
+
+ public void listcommands()
+ {
+ WriteLine(" == Commands == " + Environment.NewLine);
+ WriteLine(" - clear: Clears the screen.");
+ WriteLine(" - shutdown: Shuts down your PC.");
+ WriteLine(" - codepoints: Shows how many codepoints you have.");
+ WriteLine(" - help: Shows this screen.");
+ if (API.Upgrades["secondssincemidnight"] == true)
+ {
+ WriteLine(" - time: Shows the current time.");
+ }
+ if (API.Upgrades["unitymode"] == true)
+ WriteLine(" - unity: Toggles Unity Mode.");
+ if (API.Upgrades["customusername"] == true)
+ {
+ WriteLine(" - username : Changes your username.");
+ WriteLine(" - osname : Changes the operating system name.");
+ }
+ if (API.Upgrades["shiftnet"] == true)
+ {
+ WriteLine(" - saa: Runs a specified .saa file.");
+ WriteLine(" - spkg: Shiftnet Package Manager (more info at shiftnet://main/spkg");
+ }
+ }
+
+ public void listinfo()
+ {
+ WriteLine(SaveSystem.Utilities.LoadedSave.osname + " - Version " + SaveSystem.Utilities.LoadedSave.ingameversion);
+ WriteLine("==========================" + Environment.NewLine);
+ WriteLine(" == Info == " + Environment.NewLine);
+ if (API.Upgrades["applaunchermenu"] == true)
+ {
+ WriteLine(" - Apps can be run using the App Launcher on the desktop.");
+ }
+ else
+ {
+ WriteLine(" - Apps can be run by typing their name in the Terminal.");
+ }
+ if (API.Upgrades["windowedterminal"] == true)
+ {
+ WriteLine(" - The Terminal runs in a window.");
+ }
+ else
+ {
+ WriteLine(" - The Terminal runs fullscreen at all times.");
+ }
+ if (API.Upgrades["titlebar"] == true)
+ {
+ WriteLine(" - Applications have a titlebar to help distinguish between other apps.");
+ }
+ if (API.Upgrades["windowborders"] == true)
+ {
+ WriteLine(" - Applications have a window border to help distinguish between other apps.");
+ }
+ 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)
+ {
+ WriteLine(" - Applications can be moved using CTRL+W,A,S,D.");
+ }
+ if (API.Upgrades["draggablewindows"] == true)
+ {
+ WriteLine(" - You can drag apps around the screen by dragging their titlebars.");
+ }
+ if (API.Upgrades["resizablewindows"] == true)
+ {
+ WriteLine(" - You can resize windows by dragging their borders.");
+ }
+ 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)
+ {
+ WriteLine(" - You can minimize and restore apps using the panel buttons.");
+ }
+ if (API.Upgrades["titletext"] == true)
+ {
+ WriteLine(" - Apps display their names on the titlebar.");
+ }
+ if (API.Upgrades["appicons"] == true)
+ {
+ WriteLine(" - Apps display their icons, and they are displayed in their titlebars.");
+ }
+ if (API.Upgrades["autoscrollterminal"] == true)
+ {
+ WriteLine(" - The Terminal will automatically scroll to the bottom.");
+ }
+ if (API.Upgrades["terminalscrollbar"] == true)
+ {
+ WriteLine(" - You can scroll up and down the Terminal's buffer.");
+ }
+ if (API.Upgrades["zoomableterminal"] == true)
+ {
+ WriteLine(" - You can zoom the Terminal in and out by holding CTRL and scrolling up or down.");
+ }
+ }
+
+
+ // ERROR: Handles clauses are not supported in C#
+ private void tmrfirstrun_Tick(object sender, EventArgs e)
+ {
+ switch (firstrun)
+ {
+ case 1:
+ txtterm.Text = txtterm.Text + "Installation Successfull" + Environment.NewLine;
+ blockctrlt = true;
+ 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);
+ break;
+ case 12:
+ txtterm.Text = txtterm.Text + "IP 199.108.232.1 Connected!" + Environment.NewLine + "User@" + SaveSystem.Utilities.LoadedSave.osname + " $> ";
+ API.PlaySound(Properties.Resources.writesound);
+ break;
+ case 15:
+ txtterm.Text = txtterm.Text + "DevX: Hi, my name is DevX and you are now using an early version of my operating system \"ShiftOS\"." + Environment.NewLine + "User@ShiftOS $> ";
+ API.PlaySound(Properties.Resources.writesound);
+ break;
+ case 22:
+ txtterm.Text = txtterm.Text + "DevX: Currently the terminal is open and I am using it to communicate with you remotely." + Environment.NewLine + "User@ShiftOS $> ";
+ API.PlaySound(Properties.Resources.writesound);
+ break;
+ case 28:
+ txtterm.Text = txtterm.Text + "DevX: ShiftOS is going to be the most revolutionary operating system in the world that will run on every electronic device you can think of." + Environment.NewLine + "User@ShiftOS $> ";
+ API.PlaySound(Properties.Resources.writesound);
+ break;
+ case 36:
+ txtterm.Text = txtterm.Text + "DevX: I can't tell you much about my future plans right now but if you can help me then I may tell you more in future" + Environment.NewLine + "User@ShiftOS $> ";
+ API.PlaySound(Properties.Resources.writesound);
+ break;
+ case 44:
+ txtterm.Text = txtterm.Text + "DevX: ShiftOS is barely usable in it's current state so I need you to help me evolve it using codepoints" + Environment.NewLine + "User@ShiftOS $> ";
+ API.PlaySound(Properties.Resources.writesound);
+ break;
+ case 50:
+ txtterm.Text = txtterm.Text + "DevX: Once you acquire codepoints you can use them to upgrade certain components of ShiftOS or add new software" + Environment.NewLine + "User@ShiftOS $> ";
+ API.PlaySound(Properties.Resources.writesound);
+ 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);
+ 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 $> ";
+ API.PlaySound(Properties.Resources.writesound);
+ break;
+ case 70:
+ txtterm.Text = txtterm.Text + "DevX: Once you are on the desktop open the terminal, type \"help\" and then press enter for a guide on using ShiftOS" + Environment.NewLine + "User@ShiftOS $> ";
+ API.PlaySound(Properties.Resources.writesound);
+ break;
+ case 80:
+ txtterm.Text = txtterm.Text + "DevX: Gotta run now but I'll contact you soon to see how you are going with evolving ShiftOS for me while I... Work on something else" + Environment.NewLine + "User@ShiftOS $> ";
+ API.PlaySound(Properties.Resources.writesound);
+ break;
+ case 89:
+ txtterm.Text = txtterm.Text + "DevX: Remember to always click the black desktop first and then press press CTRL + T to open the terminal otherwise the terminal won't open!" + Environment.NewLine + "User@ShiftOS $> ";
+ API.PlaySound(Properties.Resources.writesound);
+ break;
+ case 94:
+ API.PlaySound(Properties.Resources.typesound);
+ txtterm.Text = "User@" + SaveSystem.Utilities.LoadedSave.osname + " $> ";
+ tmrfirstrun.Stop();
+ this.Close();
+ blockctrlt = false;
+ SaveSystem.Utilities.saveGame();
+ break;
+ }
+ firstrun = firstrun + 1;
+ txtterm.SelectionStart = txtterm.TextLength;
+ }
+
+ public void runterminalfile(string path)
+ {
+ if (File.Exists(path))
+ {
+ string[] cmds = File.ReadAllLines(path);
+ foreach (string cmd in cmds)
+ {
+ command = cmd;
+ DoCommand();
+ }
+ }
+ }
+
+ // ERROR: Handles clauses are not supported in C#
+ private void tmrshutdown_Tick(object sender, EventArgs e)
+ {
+ Application.Exit();
+ }
+
+ public void WriteLine(string text)
+ {
+ API.CurrentSession.Invoke(new Action(() =>
+ {
+ if (txtterm.Text.Length > 0)
+ {
+ txtterm.Text += Environment.NewLine + text;
+ }
+ else
+ {
+ txtterm.Text += text;
+ }
+ 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(() =>
{
@@ -524,7 +2107,7 @@ internal void StartShellShock()
WriteLine(@"Username: devx
Password: z7fjsd3");
Thread.Sleep(100);
- WriteLine("Authenticating with SSH server on shiftnet://devx/tracker running Arch Linux x86_64...");
+ WriteLine("Authenticating with SSH server on shiftnet://devx/tracker running Ubuntu 666...");
Thread.Sleep(1000);
WriteLine("[SSH] Access granted.");
Thread.Sleep(100);
@@ -535,15 +2118,15 @@ internal void StartShellShock()
txtterm.Text = "";
}));
int i = 60;
- while(i >= 1)
+ 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('`'))
+ 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(() =>
@@ -559,10 +2142,10 @@ internal void StartShellShock()
FinalMission.EndGameHandler.GoToNextObjective();
}));
int progress = 0;
- while(progress <= 10000)
+ while (progress <= 10000)
{
int r = new Random().Next(0, 1);
- switch(r)
+ switch (r)
{
case 0:
WriteLine("-bash: fork: Resource temporarily unavailable");
@@ -584,11 +2167,6 @@ internal void StartShellShock()
t.Start();
}
- public void SetPrefix(string _prefix)
- {
- prefix = _prefix;
- }
-
internal void StartBridgeToMidGame()
{
var t2 = new System.Windows.Forms.Timer();
@@ -599,7 +2177,7 @@ internal void StartBridgeToMidGame()
switch (i2)
{
case 0:
- if(API.Upgrades["hacker101"] == true)
+ if (API.Upgrades["hacker101"] == true)
{
WriteLine("Hacker101: Hello. We meet again. The Other Player told me about your situation.");
}
@@ -664,7 +2242,7 @@ internal void StartBridgeToMidGame()
t.Tick += (object s, EventArgs a) =>
{
-
+
switch (i)
{
@@ -744,7 +2322,7 @@ internal void StartBridgeToMidGame()
}
i += 1;
};
- if(API.Upgrades["hacker101"] == true)
+ if (API.Upgrades["hacker101"] == true)
{
t2.Start();
}
@@ -753,65 +2331,7 @@ internal void StartBridgeToMidGame()
t.Start();
}
-
- }
- 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 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;
- }
}
internal void StartAidenNirhStory()
@@ -821,7 +2341,7 @@ internal void StartAidenNirhStory()
int i = 0;
t.Tick += (object s, EventArgs a) =>
{
- switch(i)
+ switch (i)
{
case 0:
WriteLine("User 151.43.85.33 connecting as \"Aiden\"...");
@@ -857,10 +2377,10 @@ internal void StartHacker101Story()
var t = new System.Windows.Forms.Timer();
t.Interval = 4000;
int i = 0;
-
+
t.Tick += (object s, EventArgs a) =>
{
- switch(i)
+ switch (i)
{
case 0:
WriteLine("IP connecting as Hacker101...");
@@ -949,13 +2469,13 @@ internal void StartOtherPlayerSysFix()
int i = 0;
t.Tick += (object s, EventArgs a) =>
{
- switch(i)
+ switch (i)
{
case 0:
WriteLine("User connected as ???.");
break;
case 1:
- if(API.Upgrades["otherplayerstory"] == true)
+ if (API.Upgrades["otherplayerstory"] == true)
{
WriteLine($"???: {API.Username}! Did he find out? Oh God, I hope he can see this...");
}
@@ -965,7 +2485,7 @@ internal void StartOtherPlayerSysFix()
}
break;
case 2:
- if(API.Upgrades["otherplayerstory"] == true)
+ if (API.Upgrades["otherplayerstory"] == true)
{
WriteLine("???: Ahh. Good. You can read this. It's me, the other player.");
}
@@ -998,7 +2518,7 @@ internal void StartOtherPlayerSysFix()
{
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;
+ break;
case 9:
WriteLine("???: Anyways, connected to your system, I can see your desktop. Looks pretty messed up, huh?");
break;
@@ -1027,7 +2547,7 @@ internal void StartOtherPlayerSysFix()
WriteLine("???: Go ahead and try to decrypt it. The Shiftnet Lua API is very useful.");
break;
case 16:
- if(API.Upgrades["otherplayerstory"] == true)
+ 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.");
}
@@ -1057,7 +2577,7 @@ internal void StartHackerBattleIntro()
int i = 0;
t.Tick += (object s, EventArgs a) =>
{
- switch(i)
+ switch (i)
{
case 0:
API.Upgrades["hackerbattles"] = true;
@@ -1226,1554 +2746,63 @@ private void StartDevXFuriousStory2()
})));
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()
- {
- 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(() =>
- {
- 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(() =>
- {
- 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());
- }
- //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)
- {
- 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;
- }
-
- private bool LuaMode = false;
-
- public string GetPath(string path)
- {
- return path.Replace(Paths.SaveRoot, "").Replace(OSInfo.DirectorySeparator, "/");
- }
-
- public string GetParent(string path)
- {
- if (new DirectoryInfo(path).Parent.FullName.Contains("ShiftOS"))
- {
- var d = new DirectoryInfo(path);
- return d.Parent.FullName;
- }
- else
- {
- return path;
- }
- }
-
- public void DoCommand()
- {
- API.LastRanCommand = command;
- string[] args = command.ToLower().Split(' ');
- switch (args[0])
- {
- case "ls":
- case "dir":
- if(API.Upgrades["fileskimmer"])
- {
- 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}");
- }
- }
- else
- {
- wrongcommand();
- }
- break;
- case "cd":
- if (API.Upgrades["fileskimmer"])
- {
- if (args[1] == "..")
- {
- if (GetPath(current_dir) != "/")
- {
- current_dir = GetParent(current_dir);
- SetPrefix($"{API.Username}@{API.OSName} in {GetPath(current_dir)} $> ");
- }
- else
- {
- WriteLine("cd: Can't go up past the root.");
- }
- }
- 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)} $> ");
- }
- }
- break;
- case "upg":
- if(API.DeveloperMode)
- {
- try
- {
- switch(args[1])
- {
- case "get":
- WriteLine(API.Upgrades[args[2]].ToString());
- break;
- }
- }
- catch
- {
-
- }
- }
- else
- {
- wrongcommand();
- }
- break;
- case "endgame_test":
- 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();
- }
- break;
- case "htutorial":
- ShiftOS.Hacking.StartBattleTutorial();
- break;
- case "fake_buy":
- 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();
- }
- break;
- case "connections":
- try
- {
- switch(args[1])
- {
- 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;
- }
- }
- catch
- {
- WriteLine("connections: Missing arguments.");
- }
- break;
- case "story":
- if(API.DeveloperMode == true && API.Upgrades["shiftnet"])
- {
- 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.");
- }
- }
- else { wrongcommand(); }
- break;
- case "make":
- try
- {
- string path = command.Replace("make ", "");
- string realpath = $"{Paths.SaveRoot}{path.Replace("/", OSInfo.DirectorySeparator)}";
- if (File.Exists(realpath + OSInfo.DirectorySeparator + "main.lua"))
- {
- WriteLine("Compiling to " + path + ".saa");
- ZipFile.CreateFromDirectory(realpath, realpath + ".saa");
- }
- else
- {
- WriteLine($"make: *** No rule to make target \"{realpath}\". Stop.");
- }
- }
- catch
- {
- WriteLine("make: Invalid arguments.");
- }
- break;
- case "linux":
- if(API.DeveloperMode)
- {
- WriteLine("Upgrading your system...");
- foreach(var upg in Shiftorium.Utilities.GetAvailable())
- {
- API.Upgrades[upg.id] = true;
- WriteLine("Installed upgrade \"" + upg.Name + "\"...");
- }
- API.UpdateWindows();
- API.CurrentSession.SetupDesktop();
- }
- else
- {
- wrongcommand();
- }
- break;
- case "cheat":
- if (API.DeveloperMode)
- {
- WriteLine("Opening...");
-
- //Apps.Cheats chts = new Apps.Cheats();
- //chts.Show();
- API.CreateForm(new Apps.Cheats(), "Cheats", API.GetIcon("Terminal"));
- }
- else
- {
- wrongcommand();
- }
- break;
- case "netgen":
- WriteLine("Starting netgen...");
- API.CreateForm(new NetGen(), "Network Generator", API.GetIcon("Terminal"));
- break;
- case "lua":
- if(API.DeveloperMode == true)
- {
- 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();
- }
- break;
- case "hack":
- if(API.Upgrades["hacking"] == true)
- {
- StartHackingSession("random");
- }
- else
- {
- wrongcommand();
- }
- break;
- case "virusscanner":
- case "vscan":
- 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.");
- }
- }
- break;
- case "infections":
- if (API.DeveloperMode == true)
- {
- foreach (KeyValuePair kv in Viruses.Infections)
- {
- WriteLine(kv.Key + " @ " + kv.Value);
- }
- }
- else
- {
- wrongcommand();
- }
- break;
- case "binarywater":
- 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.");
- }
- 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.");
- }
- break;
- case "color":
- 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.");
- }
- break;
- case "encrypt":
- if (API.DeveloperMode == true)
- {
- string messageToEncrypt = command.Replace("encrypt ", "");
- string encryptedMessage = API.Encryption.Encrypt(messageToEncrypt);
- WriteLine("Encrypted Message: " + encryptedMessage);
- }
- else
- {
- wrongcommand();
- }
- break;
- case "font":
- 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();
- }
- break;
- case "colorlist":
- if(API.Upgrades["setterminalcolors"] == true)
- {
- foreach(string itm in GetColorList())
- {
- WriteLine(itm);
- }
- }
- else
- {
- wrongcommand();
- }
- break;
- case "spkg":
- if (!API.LimitedMode)
- {
- if (API.Upgrades["shiftnet"] == true)
- {
- try
- {
- switch (args[1].ToLower())
- {
- case "install":
- if (args[2] != null && args[2] != "")
- {
- string pkgname = args[2].ToLower().Replace(".pkg", "");
- if (Package_Grabber.GetPackage(pkgname) == true)
- {
- WriteLine("Downloaded package '" + pkgname + "' from shiftnet://main/spkg/ successfully. Installing now.");
- string r = Package_Grabber.ExtractPackage();
- if (r == "fail")
- {
- WriteLine("[FATAL] Could not install package.");
- WriteLine("spkg: Killed.");
- }
- else
- {
- WriteLine("Extracted " + pkgname + " to " + r + "...");
- var res2 = Package_Grabber.InstallPackage(r + "\\");
- if (res2 != "success")
- {
- WriteLine("[FATAL] Could not install package. " + res2);
- WriteLine("spkg: Killed.");
- }
- else
- {
- WriteLine("[DONE] Package installed.");
- }
- }
- }
- else
- {
- WriteLine("spkg: Package '" + args[2] + "' not found.");
- }
- }
- break;
- default:
- WriteLine("spkg: Invalid argument: " + args[1]);
- break;
- }
- }
- catch (Exception ex)
- {
- WriteLine("spkg: " + ex.Message);
- }
- }
- else
- {
- wrongcommand();
- }
- }
- else
- {
- try
- {
- if(args[2] == "god_utils")
- {
- if(FinalMission.EndGameHandler.GodModeInstallEnabled == true)
- {
- var t = new Thread(new ThreadStart(new Action(() =>
- {
- WriteLine("Downloading package 'god_utils'... Please wait.");
- Thread.Sleep(10000);
- WriteLine("Download complete.");
- Thread.Sleep(100);
- WriteLine("Beginning installation.");
- Thread.Sleep(1000);
- WriteLine(@" == GOD MODE ==
-
-God Mode gives you FULL control of ShiftOS. You can add/remove Codepoints, buy or unbuy Shiftorium upgrades, and can do whatever you want.
-
-Installing core applications...");
- Thread.Sleep(250);
- WriteLine("Installing subpackage 'json_edit'...");
- Thread.Sleep(250);
- WriteLine("Installing subpackage 'upgrade_mod'...");
- Thread.Sleep(100);
- WriteLine("Installing subpackage 'hijacker'...");
- Thread.Sleep(500);
- WriteLine(@" == HIJACKER by DevX ==
-
-HIJACKER is a utility that allows you to hijack any system and install ShiftOS on it during a hacker battle.");
- Thread.Sleep(100);
- WriteLine("[hijacker] Injecting HIJACKER code into hbattleui.sft...");
- Thread.Sleep(150);
- WriteLine("[hijacker] Done.");
- this.Invoke(new Action(() =>
- {
- StartChoice1EndStory();
- }));
- })));
- t.Start();
- }
- else
- {
- WriteLine("spkg: Package '" + args[2] + "' not found.");
- }
- }
- else
- {
- WriteLine("spkg: Package '" + args[2] + "' not found.");
- }
- }
- catch
- {
- WriteLine("spkg: Missing arguments.");
- }
- }
- break;
- case "alias":
- try
- {
- switch(args[1])
- {
- case "-?":
- case "--help":
- WriteLine("Aliases Help" + Environment.NewLine);
- WriteLine("Alias is a command that lets you create aliases for other commands. You could make a command 'upgrade' alias 'shiftorium' if you wanted." + Environment.NewLine);
- WriteLine("Arguments:");
- WriteLine(" -h, --help: Displays this screen.");
- WriteLine("-a, --add : Adds a new alias.");
- WriteLine("-d, --delete : Deletes an alias.");
- WriteLine("-l, --list: Shows all available aliases.");
- break;
- case "--add":
- case "-a":
- if(API.AddAlias(args[2], command.Replace("alias " + args[1] + " " + args[2] + " ", "")))
- {
- WriteLine("Alias added successfully.");
- API.SaveAliases();
- }
- else
- {
- WriteLine("That alias already exists.");
- }
- break;
- case "--delete":
- case "-d":
- if(API.RemoveAlias(args[2]) == true)
- {
- WriteLine("Alias \"" + args[2] + "\" removed successfully.");
- API.SaveAliases();
- }
- else
- {
- WriteLine("That alias doesn't exist.");
- }
- break;
- case "-l":
- case "--list":
- WriteLine("Aliases:");
- foreach(KeyValuePair kv in API.CommandAliases)
- {
- WriteLine(kv.Key + " => " + kv.Value);
- }
- break;
- default:
- WriteLine("alias: Invalid argument. Try alias --help for help with the Alias command.");
- break;
- }
- }
- catch
- {
- WriteLine("alias: Missing arguments. Try alias --help for help with the Alias command.");
- }
- break;
- case "username":
- if(API.Upgrades["customusername"] == true)
- {
- try
- {
- API.CurrentSave.username = args[1];
- }
- catch
- {
- WriteLine("username: Missing arguments.");
- }
- }
- else
- {
- wrongcommand();
- }
- break;
- case "osname":
- if (API.Upgrades["customusername"] == true)
- {
- try
- {
- API.CurrentSave.osname = args[1];
- }
- catch
- {
- WriteLine("osname: Missing arguments.");
- }
- }
- else
- {
- wrongcommand();
- }
- break;
-
- case "unity":
- if (API.Upgrades["unitymode"] == true)
- {
- API.CurrentSession.SetUnityMode();
- API.CurrentSession.SetupDesktop();
- txtterm.Focus();
- } else
- {
- wrongcommand();
- }
- break;
- case "time":
- if (API.Upgrades["pmandam"] == false)
- {
- if (API.Upgrades["hourssincemidnight"] == false)
- {
- if (API.Upgrades["minutessincemidnight"] == false)
- {
- if (API.Upgrades["secondssincemidnight"] == true) {
- WriteLine("Since midnight, " + API.GetTime() + " seconds have passed.");
- } else {
- wrongcommand();
- }
- } else
- {
- WriteLine("Since midnight, " + API.GetTime() + " minutes have passed.");
- }
- }
- else
- {
- WriteLine("Since Midnight, " + API.GetTime() + " hours have passed.");
- }
- } else
- {
- WriteLine("Current time: " + API.GetTime());
- }
- break;
- case "saa":
- if (API.Upgrades["shiftnet"]) {
- var f = command.Replace("saa ", "");
- if (f.StartsWith("/"))
- {
- var withoutslash = f.Remove(0, 1);
- var dirsep = OSInfo.DirectorySeparator;
- var rightdir = $"{Paths.SaveRoot}{dirsep}{f.Replace("/", dirsep)}";
- if (File.Exists(rightdir))
- {
- var finf = new FileInfo(rightdir);
- if (finf.Extension == ".saa")
- {
- API.LaunchMod(finf.FullName);
- }
- else
- {
- WriteLine("saa: Cannot launch the file '" + finf.FullName + " because it isn't a valid stand-alone app.");
- }
- }
- else
- {
- WriteLine("saa: Cannot launch the file '" + f + "' because it doesn't exist.");
- }
- }
- else
- {
- WriteLine("saa: Cannot launch the file '" + f + "' because it doesn't exist.");
- }
- }
- else
- {
- wrongcommand();
- }
- break;
- case "help":
- try
- {
- showhelp(args[1]);
- }
- catch
- {
- showhelp();
- }
- break;
- case "codepoints":
- case "cp":
- WriteLine("You have " + API.Codepoints.ToString() + " Codepoints.");
- break;
- case "shutdown":
- API.ShutDownShiftOS();
- break;
- case "clear":
- txtterm.Text = "";
- break;
- case "close":
- if (command.Contains("close "))
- {
- var pid = command.Replace("close ", "");
- if (API.CloseProgram(pid) == true)
- {
- WriteLine("Closed all running " + pid + "s.");
- }
- else
- {
- WriteLine("No processes with id '" + pid + "' were found!");
- }
- }
- else
- {
- WriteLine("Insufficient arguments.");
- }
- break;
- case "05tray":
- if (API.DeveloperMode == true)
- {
- API.AddCodepoints(500);
- WriteLine("You've been granted 500 Codepoints.");
- } else
- {
- wrongcommand();
- }
-
- break;
- case "debug":
- if (API.DeveloperMode == true)
- {
- try
- {
- switch (args[1].ToLower())
- {
- case "shiftnet-story":
- WriteLine("Debugging Shiftnet Story...");
- StartShiftnetStory();
- break;
- case "devmode":
- API.DeveloperMode = false;
- WriteLine("Turned off developer mode. Use the passcode to turn it back on.");
- break;
- default:
- WriteLine("Invalid argument: " + args[1] + ". Debug can only debug the following: 'shiftnet-story'.");
- break;
- }
-
- }
- catch (Exception ex)
- {
- WriteLine("debug: " + ex.Message);
- }
- } else {
- try
- {
- switch (args[1].ToLower())
- {
- case "developers123":
- WriteLine("Turned Developer Mode on!");
- API.DeveloperMode = true;
- break;
- default:
- wrongcommand();
- break;
- }
- } catch
- {
- wrongcommand(); //Debug command pretends to be an invalid command if an exception is thrown.
- }
- }
- break;
- case "echo":
- if(command.Contains("echo "))
- {
- WriteLine(command.Replace("echo ", ""));
- }
- else
- {
- WriteLine("echo: Insufficient Parameters.");
- }
- break;
- case "syncsave":
- WriteLine("Command removed.");
- break;
-
- default:
- if (API.OpenProgram(args[0]) == false)
- {
- if (API.Upgrades["trmfiles"] == false)
- {
- bool done = false;
- foreach(KeyValuePair kv in API.CommandAliases)
- {
- if(kv.Key == command)
- {
- command = kv.Value;
- done = true;
- DoCommand();
- }
-
- }
- if(done == false)
- {
- wrongcommand();
- }
- }
- else
- {
- var f = command.Replace("\\", "/");
- if (f.StartsWith("/"))
- {
- var withoutslash = f.Remove(0, 1);
- var dirsep = OSInfo.DirectorySeparator;
- var proper = $"{Paths.SaveRoot}{dirsep}{withoutslash.Replace("/", dirsep)}";
- if (File.Exists(proper))
- {
- runterminalfile(proper);
- }
- else
- {
- wrongcommand();
- }
- }
- else
- {
- bool done = false;
- foreach (KeyValuePair kv in API.CommandAliases)
- {
- if (kv.Key == command)
- {
- command = kv.Value;
- done = true;
- DoCommand();
- }
-
- }
- if (done == false)
- {
- wrongcommand();
- }
- }
- }
- }
- break;
- }
- }
-
- private void StartChoice1EndStory()
+ public void StartOtherPlayerStory()
{
var t = new System.Windows.Forms.Timer();
- int i = 0;
t.Interval = 4000;
+ int i = 0;
t.Tick += (object s, EventArgs a) =>
{
- switch(i)
+ switch (i)
{
case 0:
- WriteLine("User '' connected as '???'");
+ WriteLine("IP Address is connecting as '???'...");
break;
case 1:
- WriteLine($"???: {API.Username}! What are you doing!?");
+ WriteLine("Connection established.");
break;
case 2:
- WriteLine("???: I went onto the Hacker Alliance room earlier and DevX was on there...");
+ WriteLine("???: Hi, ShiftOS user. I have something to tell you.");
break;
case 3:
- WriteLine("???: And he told me you SIDED WITH HIM.");
+ WriteLine("???: I'm not a hacker. I'm not a programmer. I am just like you.");
break;
case 4:
- WriteLine("???: This is a HUGE mistake! Listen!");
+ WriteLine("???: I am... the Other Player.");
break;
case 5:
- WriteLine("???: He's lying to you. Listen. DevX is not what you think he is.");
+ WriteLine("???: I too have heard DevX's story about ShiftOS being an experimental operating system.");
break;
case 6:
- WriteLine("???: He isn't a human! He's an AI! We were all played!");
+ WriteLine("???: I have also met another user. We'll call him... I don't know... Robert.");
break;
case 7:
- WriteLine("???: I'm telling the truth, I swear!");
+ WriteLine("???: And this Robert guy, well, he knows a lot about ShiftOS, and DevX.");
break;
case 8:
- WriteLine("???: You want proof? - holochat_cmd: ERROR: Remote host closed connection.");
+ WriteLine("???: Robert is a fake name I'm calling him. You might know him as Hacker101.");
break;
case 9:
- WriteLine("spkg: Rebooting system in 8 seconds.");
+ 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:
- API.Upgrades["titlebar"] = false;
- API.Upgrades["windowedterminal"] = false; //terminals must be fullscreen
- var trm = new Terminal();
+ 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.CreateForm(trm, "Terminal", API.GetIcon("Terminal"));
- trm.StartReboot();
+ API.Upgrades["otherplayerstory1"] = true;
break;
}
i += 1;
};
t.Start();
}
-
- public void StartReboot()
- {
- txtterm.Text = "";
- var t1 = new Thread(new ThreadStart(new Action(() =>
- {
- Thread.Sleep(500);
- WriteLine("ShiftOS: Kernel deactivated.");
- Thread.Sleep(1000);
- this.Invoke(new Action(() =>
- {
- txtterm.Text = "";
- }));
- Thread.Sleep(1000);
- WriteLine("Welcome to ShiftOS.");
- Thread.Sleep(500);
- WriteLine("Starting core...");
- API.Upgrades["windowedterminal"] = true;
- Thread.Sleep(450);
- WriteLine($"Your username is {API.Username}.");
- Thread.Sleep(100);
- WriteLine($"You have {API.Codepoints} Codepoints.");
- WriteLine("Loading modules...");
- Thread.Sleep(750);
- foreach(var upg in API.Upgrades)
- {
- if(upg.Value == true)
- {
- WriteLine($"Loaded module {upg.Key}...");
- }
- Thread.Sleep(100);
- }
- WriteLine("Starting desktop.");
- this.Invoke(new Action(() =>
- {
- var s = new ShiftOSDesktop();
- s.Show();
- s.EndGame_AttachEvents();
- }));
- Thread.Sleep(1000);
- this.Invoke(new Action(() =>
- {
- FinalMission.EndGameHandler.GoToNextObjective();
- }));
- API.Upgrades["titlebar"] = true;
- })));
- t1.Start();
- }
-
- public void Crash()
- {
- txtterm.Text = "";
- WriteLine(" *** SYSTEM PANIC *** ");
- 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 System.Windows.Forms.Timer();
- t.Interval = 1000;
- int p = 0;
- t.Tick += (object s, EventArgs a) =>
- {
- if(p == 4)
- {
- t.Stop();
- this.Close();
- }
- p += 1;
- };
- t.Start();
- }
-
- private void wrongcommand()
- {
- txtterm.Text = txtterm.Text + Environment.NewLine + "Command not recognized - Type 'help' for a list of commands!" + Environment.NewLine;
- }
-
- bool Hacking = false;
-
- private Control objToWriteTo = null;
- private string UpgradeToHack = null;
-
- public void StartHackingSession(string id)
- {
- UpgradeToHack = id;
- objToWriteTo = txtterm;
- Hacking = true;
- txtterm.ReadOnly = true;
- WriteLine("To continue, choose which way you ");
- WriteLine("would like to go about this. ");
- WriteLine(" ");
- WriteLine("1. Go it alone. ");
- WriteLine("2. Hire someone. ");
- WriteLine(" ");
- WriteLine("Press the key that corresponds to ");
- WriteLine("the option you want. ");
-
- }
-
- public void showhackinghelp()
- {
- WriteLine(" - Hacking - ");
- WriteLine(Environment.NewLine + "Hacking allows you to gain more features and upgrades by unlocking more of the OS's capabilities.");
- WriteLine(Environment.NewLine + "There are two ways you can execute a hack:");
- WriteLine(" - On your own: It'll take skill, and time, but if you have the correct tools you can do it on your own.");
- WriteLine(" - With a more competent partner: You have the option of employing a partner from a list of various hackers. The speed and success of the hack depends on their skill, and how fast they can pull it off. You will need to pay them a fee of Codepoints however. They can also grant you tools to do it on your own.");
- WriteLine(Environment.NewLine + "Some hacks are capable of:");
- WriteLine(" - Decreasing or increasing the price of Shiftorium Upgrades");
- WriteLine(" - Decreasing or increasing the amount of Codepoints earned by doing various tasks.");
- WriteLine(" - Unlocking more upgrades.");
- WriteLine(Environment.NewLine + "To start a hack, go to a locked or empty Shiftorium category and click the \"Hack It\" button.");
- API.Upgrades["hacking"] = true;
- }
-
- public void showhelp(string topic)
- {
- switch(topic)
- {
- case "hacking":
- showhackinghelp();
- break;
- default:
- WriteLine("No help available for this topic. Try 'help' for general help.");
- break;
- }
- }
-
- public void showhelp()
- {
- listinfo();
- WriteLine(" ");
- listcommands();
- listprograms();
- }
-
- private void listprograms()
- {
- WriteLine("Programs installed: " + Environment.NewLine);
- WriteLine(" - terminal: A command-line application that lets you run programs in ShiftOS");
- WriteLine(" - shiftorium: An application where you can buy upgrades and new apps using codepoints.");
- /* TEMP-REMOVED - I just can't get it to work.
- WriteLine(" - jumper: A simple 'jump over the obstacle' game.");
- */
- WriteLine(" - knowledge_input: Test your knowledge, and gain some Codepoints too.");
- if (API.Upgrades["shifter"] == true)
- WriteLine(" - shifter: Allows you to customize ShiftOS.");
- if (API.Upgrades["skinning"] == true)
- WriteLine(" - skinloader: Load and save ShiftOS skins.");
- if (API.Upgrades["pong"] == true)
- WriteLine(" - pong: A good ole' game of Pong.");
- if (API.Upgrades["fileskimmer"] == true)
- WriteLine(" - fileskimmer: Browse the files on your computer.");
- if (API.Upgrades["textpad"] == true)
- WriteLine(" - textpad: \"Write, save, and open a text document.\" - Philip Adams");
- if (API.Upgrades["artpad"] == true)
- WriteLine(" - artpad: A simple, but useful drawing application.");
- if (API.Upgrades["shiftnet"] == true)
- WriteLine("Also, more apps can be run by opening .saa files. Apps can also be installed using spkg or by double clicking .pkg or .stp files.");
- }
-
- public void listcommands()
- {
- WriteLine(" == Commands == " + Environment.NewLine);
- WriteLine(" - clear: Clears the screen.");
- WriteLine(" - shutdown: Shuts down your PC.");
- WriteLine(" - codepoints: Shows how many codepoints you have.");
- WriteLine(" - help: Shows this screen.");
- if(API.Upgrades["secondssincemidnight"] == true)
- {
- WriteLine(" - time: Shows the current time.");
- }
- if (API.Upgrades["unitymode"] == true)
- WriteLine(" - unity: Toggles Unity Mode.");
- if (API.Upgrades["customusername"] == true)
- {
- WriteLine(" - username : Changes your username.");
- WriteLine(" - osname : Changes the operating system name.");
- }
- if(API.Upgrades["shiftnet"] == true)
- {
- WriteLine(" - saa: Runs a specified .saa file.");
- WriteLine(" - spkg: Shiftnet Package Manager (more info at shiftnet://main/spkg");
- }
- }
-
- public void listinfo()
- {
- WriteLine(SaveSystem.Utilities.LoadedSave.osname + " - Version " + SaveSystem.Utilities.LoadedSave.ingameversion);
- WriteLine("==========================" + Environment.NewLine);
- WriteLine(" == Info == " + Environment.NewLine);
- if(API.Upgrades["applaunchermenu"] == true)
- {
- WriteLine(" - Apps can be run using the App Launcher on the desktop.");
- } else
- {
- WriteLine(" - Apps can be run by typing their name in the Terminal.");
- }
- if (API.Upgrades["windowedterminal"] == true)
- {
- WriteLine(" - The Terminal runs in a window.");
- }
- else
- {
- WriteLine(" - The Terminal runs fullscreen at all times.");
- }
- if(API.Upgrades["titlebar"] == true)
- {
- WriteLine(" - Applications have a titlebar to help distinguish between other apps.");
- }
- if(API.Upgrades["windowborders"] == true)
- {
- WriteLine(" - Applications have a window border to help distinguish between other apps.");
- }
- 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)
- {
- WriteLine(" - Applications can be moved using CTRL+W,A,S,D.");
- }
- if(API.Upgrades["draggablewindows"] == true)
- {
- WriteLine(" - You can drag apps around the screen by dragging their titlebars.");
- }
- if(API.Upgrades["resizablewindows"] == true)
- {
- WriteLine(" - You can resize windows by dragging their borders.");
- }
- 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)
- {
- WriteLine(" - You can minimize and restore apps using the panel buttons.");
- }
- if(API.Upgrades["titletext"] == true)
- {
- WriteLine(" - Apps display their names on the titlebar.");
- }
- if(API.Upgrades["appicons"] == true)
- {
- WriteLine(" - Apps display their icons, and they are displayed in their titlebars.");
- }
- if(API.Upgrades["autoscrollterminal"] == true)
- {
- WriteLine(" - The Terminal will automatically scroll to the bottom.");
- }
- if(API.Upgrades["terminalscrollbar"] == true)
- {
- WriteLine(" - You can scroll up and down the Terminal's buffer.");
- }
- if(API.Upgrades["zoomableterminal"] == true)
- {
- WriteLine(" - You can zoom the Terminal in and out by holding CTRL and scrolling up or down.");
- }
- }
-
-
- // ERROR: Handles clauses are not supported in C#
- private void tmrfirstrun_Tick(object sender, EventArgs e)
- {
- switch (firstrun)
- {
- case 1:
- txtterm.Text = txtterm.Text + "Installation Successfull" + Environment.NewLine;
- blockctrlt = true;
- 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);
- break;
- case 12:
- txtterm.Text = txtterm.Text + "IP 199.108.232.1 Connected!" + Environment.NewLine + "User@" + SaveSystem.Utilities.LoadedSave.osname + " $> ";
- API.PlaySound(Properties.Resources.writesound);
- break;
- case 15:
- txtterm.Text = txtterm.Text + "DevX: Hi, my name is DevX and you are now using an early version of my operating system \"ShiftOS\"." + Environment.NewLine + "User@ShiftOS $> ";
- API.PlaySound(Properties.Resources.writesound);
- break;
- case 22:
- txtterm.Text = txtterm.Text + "DevX: Currently the terminal is open and I am using it to communicate with you remotely." + Environment.NewLine + "User@ShiftOS $> ";
- API.PlaySound(Properties.Resources.writesound);
- break;
- case 28:
- txtterm.Text = txtterm.Text + "DevX: ShiftOS is going to be the most revolutionary operating system in the world that will run on every electronic device you can think of." + Environment.NewLine + "User@ShiftOS $> ";
- API.PlaySound(Properties.Resources.writesound);
- break;
- case 36:
- txtterm.Text = txtterm.Text + "DevX: I can't tell you much about my future plans right now but if you can help me then I may tell you more in future" + Environment.NewLine + "User@ShiftOS $> ";
- API.PlaySound(Properties.Resources.writesound);
- break;
- case 44:
- txtterm.Text = txtterm.Text + "DevX: ShiftOS is barely usable in it's current state so I need you to help me evolve it using codepoints" + Environment.NewLine + "User@ShiftOS $> ";
- API.PlaySound(Properties.Resources.writesound);
- break;
- case 50:
- txtterm.Text = txtterm.Text + "DevX: Once you acquire codepoints you can use them to upgrade certain components of ShiftOS or add new software" + Environment.NewLine + "User@ShiftOS $> ";
- API.PlaySound(Properties.Resources.writesound);
- 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);
- 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 $> ";
- API.PlaySound(Properties.Resources.writesound);
- break;
- case 70:
- txtterm.Text = txtterm.Text + "DevX: Once you are on the desktop open the terminal, type \"help\" and then press enter for a guide on using ShiftOS" + Environment.NewLine + "User@ShiftOS $> ";
- API.PlaySound(Properties.Resources.writesound);
- break;
- case 80:
- txtterm.Text = txtterm.Text + "DevX: Gotta run now but I'll contact you soon to see how you are going with evolving ShiftOS for me while I... Work on something else" + Environment.NewLine + "User@ShiftOS $> ";
- API.PlaySound(Properties.Resources.writesound);
- break;
- case 89:
- txtterm.Text = txtterm.Text + "DevX: Remember to always click the black desktop first and then press press CTRL + T to open the terminal otherwise the terminal won't open!" + Environment.NewLine + "User@ShiftOS $> ";
- API.PlaySound(Properties.Resources.writesound);
- break;
- case 94:
- API.PlaySound(Properties.Resources.typesound);
- txtterm.Text = "User@" + SaveSystem.Utilities.LoadedSave.osname + " $> ";
- tmrfirstrun.Stop();
- this.Close();
- blockctrlt = false;
- SaveSystem.Utilities.saveGame();
- break;
- }
- firstrun = firstrun + 1;
- txtterm.SelectionStart = txtterm.TextLength;
- }
-
- public void runterminalfile(string path)
- {
- if(File.Exists(path))
- {
- string[] cmds = File.ReadAllLines(path);
- foreach(string cmd in cmds)
- {
- command = cmd;
- DoCommand();
- }
- }
- }
-
- // ERROR: Handles clauses are not supported in C#
- private void tmrshutdown_Tick(object sender, EventArgs e)
- {
- Application.Exit();
- }
-
- public void WriteLine(string text)
- {
- API.CurrentSession.Invoke(new Action(() =>
- {
- if (txtterm.Text.Length > 0)
- {
- txtterm.Text += Environment.NewLine + text;
- }
- else
- {
- txtterm.Text += text;
- }
- 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;
- }
- }
}
-
}
diff --git a/source/WindowsFormsApplication1/Gameplay/HackUI.Designer.cs b/source/WindowsFormsApplication1/Gameplay/HackUI.Designer.cs
deleted file mode 100644
index 6db5640..0000000
--- a/source/WindowsFormsApplication1/Gameplay/HackUI.Designer.cs
+++ /dev/null
@@ -1,785 +0,0 @@
-namespace ShiftOS
-{
- partial class HackUI
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(HackUI));
- this.tbui = new System.Windows.Forms.TableLayoutPanel();
- this.pnlenemy = new System.Windows.Forms.Panel();
- this.lbenemycompromised = new System.Windows.Forms.Label();
- this.lbenemystats = new System.Windows.Forms.Label();
- this.txtyourconsole = new System.Windows.Forms.TextBox();
- this.pnlyou = new System.Windows.Forms.Panel();
- this.lbcompromised = new System.Windows.Forms.Label();
- this.lbstats = new System.Windows.Forms.Label();
- this.txtenemyconsole = new System.Windows.Forms.TextBox();
- this.btnnext = new System.Windows.Forms.Button();
- this.pnlbuy = new System.Windows.Forms.Panel();
- this.txthostname = new System.Windows.Forms.TextBox();
- this.lbhostname = new System.Windows.Forms.Label();
- this.txtgrade = new System.Windows.Forms.TextBox();
- this.lbgrade = new System.Windows.Forms.Label();
- this.lbmoduleinfo = new System.Windows.Forms.Label();
- this.cmbbuyable = new System.Windows.Forms.ComboBox();
- this.label4 = new System.Windows.Forms.Label();
- this.btndonebuying = new System.Windows.Forms.Button();
- this.pnldefensemanager = new System.Windows.Forms.Panel();
- this.btnbuy = new System.Windows.Forms.Button();
- this.label3 = new System.Windows.Forms.Label();
- this.cmbmodules = new System.Windows.Forms.ComboBox();
- this.label1 = new System.Windows.Forms.Label();
- this.button1 = new System.Windows.Forms.Button();
- this.pnlpcinfo = new System.Windows.Forms.Panel();
- this.lbtargets = new System.Windows.Forms.Label();
- this.btnpoweroff = new System.Windows.Forms.Button();
- this.btnupgrade = new System.Windows.Forms.Button();
- this.lbpcinfo = new System.Windows.Forms.Label();
- this.lbmoduletitle = new System.Windows.Forms.Label();
- this.btncloseinfo = new System.Windows.Forms.Button();
- this.flcontrols = new System.Windows.Forms.FlowLayoutPanel();
- this.btnaddmodule = new System.Windows.Forms.Button();
- this.lbcodepoints = new System.Windows.Forms.Label();
- this.btntogglemusic = new System.Windows.Forms.Button();
- this.lbsong = new System.Windows.Forms.Label();
- this.panel2 = new System.Windows.Forms.Panel();
- this.pgpong = new System.Windows.Forms.Panel();
- this.lblcountdown = new System.Windows.Forms.Label();
- this.ball = new System.Windows.Forms.Panel();
- this.paddleHuman = new System.Windows.Forms.PictureBox();
- this.paddleComputer = new System.Windows.Forms.Panel();
- this.lbllevelandtime = new System.Windows.Forms.Label();
- this.lblstatsY = new System.Windows.Forms.Label();
- this.lblstatsX = new System.Windows.Forms.Label();
- this.pnltutorial = new System.Windows.Forms.Panel();
- this.lbtutorial = new System.Windows.Forms.Label();
- this.tmrplayerhealthdetect = new System.Windows.Forms.Timer(this.components);
- this.tmrenemyhealthdetect = new System.Windows.Forms.Timer(this.components);
- this.tmrredraw = new System.Windows.Forms.Timer(this.components);
- this.tmrvisualizer = new System.Windows.Forms.Timer(this.components);
- this.pongGameTimer = new System.Windows.Forms.Timer(this.components);
- this.counter = new System.Windows.Forms.Timer(this.components);
- this.tmrcountdown = new System.Windows.Forms.Timer(this.components);
- this.tbui.SuspendLayout();
- this.pnlenemy.SuspendLayout();
- this.pnlyou.SuspendLayout();
- this.pnlbuy.SuspendLayout();
- this.pnldefensemanager.SuspendLayout();
- this.pnlpcinfo.SuspendLayout();
- this.flcontrols.SuspendLayout();
- this.panel2.SuspendLayout();
- this.pgpong.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.paddleHuman)).BeginInit();
- this.pnltutorial.SuspendLayout();
- this.SuspendLayout();
- //
- // tbui
- //
- this.tbui.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Single;
- this.tbui.ColumnCount = 2;
- this.tbui.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
- this.tbui.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
- this.tbui.Controls.Add(this.pnlenemy, 1, 1);
- this.tbui.Controls.Add(this.txtyourconsole, 0, 1);
- this.tbui.Controls.Add(this.pnlyou, 0, 0);
- this.tbui.Controls.Add(this.txtenemyconsole, 1, 0);
- this.tbui.Dock = System.Windows.Forms.DockStyle.Fill;
- this.tbui.Location = new System.Drawing.Point(0, 0);
- this.tbui.Name = "tbui";
- this.tbui.RowCount = 2;
- this.tbui.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
- this.tbui.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
- this.tbui.Size = new System.Drawing.Size(1339, 710);
- this.tbui.TabIndex = 0;
- //
- // pnlenemy
- //
- this.pnlenemy.BackColor = System.Drawing.Color.Black;
- this.pnlenemy.Controls.Add(this.lbenemycompromised);
- this.pnlenemy.Controls.Add(this.lbenemystats);
- this.pnlenemy.Dock = System.Windows.Forms.DockStyle.Fill;
- this.pnlenemy.Font = new System.Drawing.Font("Lucida Console", 8.25F);
- this.pnlenemy.ForeColor = System.Drawing.Color.White;
- this.pnlenemy.Location = new System.Drawing.Point(673, 358);
- this.pnlenemy.Name = "pnlenemy";
- this.pnlenemy.Size = new System.Drawing.Size(662, 348);
- this.pnlenemy.TabIndex = 4;
- //
- // lbenemycompromised
- //
- this.lbenemycompromised.AutoSize = true;
- this.lbenemycompromised.Location = new System.Drawing.Point(161, 90);
- this.lbenemycompromised.Name = "lbenemycompromised";
- this.lbenemycompromised.Size = new System.Drawing.Size(47, 11);
- this.lbenemycompromised.TabIndex = 1;
- this.lbenemycompromised.Text = "label1";
- this.lbenemycompromised.Visible = false;
- //
- // lbenemystats
- //
- this.lbenemystats.AutoSize = true;
- this.lbenemystats.Location = new System.Drawing.Point(13, 13);
- this.lbenemystats.Name = "lbenemystats";
- this.lbenemystats.Size = new System.Drawing.Size(131, 11);
- this.lbenemystats.TabIndex = 0;
- this.lbenemystats.Text = "Enemy Health: 100%";
- //
- // txtyourconsole
- //
- this.txtyourconsole.BackColor = System.Drawing.Color.Black;
- this.txtyourconsole.BorderStyle = System.Windows.Forms.BorderStyle.None;
- this.txtyourconsole.Dock = System.Windows.Forms.DockStyle.Fill;
- this.txtyourconsole.ForeColor = System.Drawing.Color.LightGreen;
- this.txtyourconsole.Location = new System.Drawing.Point(4, 358);
- this.txtyourconsole.Multiline = true;
- this.txtyourconsole.Name = "txtyourconsole";
- this.txtyourconsole.Size = new System.Drawing.Size(662, 348);
- this.txtyourconsole.TabIndex = 3;
- //
- // pnlyou
- //
- this.pnlyou.BackColor = System.Drawing.Color.Black;
- this.pnlyou.Controls.Add(this.lbcompromised);
- this.pnlyou.Controls.Add(this.lbstats);
- this.pnlyou.Dock = System.Windows.Forms.DockStyle.Fill;
- this.pnlyou.Font = new System.Drawing.Font("Lucida Console", 8.25F);
- this.pnlyou.ForeColor = System.Drawing.Color.White;
- this.pnlyou.Location = new System.Drawing.Point(4, 4);
- this.pnlyou.Name = "pnlyou";
- this.pnlyou.Size = new System.Drawing.Size(662, 347);
- this.pnlyou.TabIndex = 1;
- this.pnlyou.MouseDown += new System.Windows.Forms.MouseEventHandler(this.playfield_MouseDown);
- //
- // lbcompromised
- //
- this.lbcompromised.AutoSize = true;
- this.lbcompromised.Location = new System.Drawing.Point(66, 88);
- this.lbcompromised.Name = "lbcompromised";
- this.lbcompromised.Size = new System.Drawing.Size(103, 11);
- this.lbcompromised.TabIndex = 3;
- this.lbcompromised.Text = "SYSTEM DAMAGED";
- this.lbcompromised.Visible = false;
- //
- // lbstats
- //
- this.lbstats.AutoSize = true;
- this.lbstats.Location = new System.Drawing.Point(13, 13);
- this.lbstats.Name = "lbstats";
- this.lbstats.Size = new System.Drawing.Size(138, 11);
- this.lbstats.TabIndex = 0;
- this.lbstats.Text = "System Health: 100%";
- //
- // txtenemyconsole
- //
- this.txtenemyconsole.BackColor = System.Drawing.Color.Black;
- this.txtenemyconsole.BorderStyle = System.Windows.Forms.BorderStyle.None;
- this.txtenemyconsole.Dock = System.Windows.Forms.DockStyle.Fill;
- this.txtenemyconsole.ForeColor = System.Drawing.Color.LightGreen;
- this.txtenemyconsole.Location = new System.Drawing.Point(673, 4);
- this.txtenemyconsole.Multiline = true;
- this.txtenemyconsole.Name = "txtenemyconsole";
- this.txtenemyconsole.Size = new System.Drawing.Size(662, 347);
- this.txtenemyconsole.TabIndex = 2;
- //
- // btnnext
- //
- this.btnnext.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.btnnext.AutoSize = true;
- this.btnnext.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
- this.btnnext.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.btnnext.Location = new System.Drawing.Point(294, 161);
- this.btnnext.Name = "btnnext";
- this.btnnext.Size = new System.Drawing.Size(66, 23);
- this.btnnext.TabIndex = 9;
- this.btnnext.Text = "Next >>";
- this.btnnext.UseVisualStyleBackColor = true;
- this.btnnext.Visible = false;
- this.btnnext.Click += new System.EventHandler(this.btnnext_Click);
- //
- // pnlbuy
- //
- this.pnlbuy.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.pnlbuy.Controls.Add(this.txthostname);
- this.pnlbuy.Controls.Add(this.lbhostname);
- this.pnlbuy.Controls.Add(this.txtgrade);
- this.pnlbuy.Controls.Add(this.lbgrade);
- this.pnlbuy.Controls.Add(this.lbmoduleinfo);
- this.pnlbuy.Controls.Add(this.cmbbuyable);
- this.pnlbuy.Controls.Add(this.label4);
- this.pnlbuy.Controls.Add(this.btndonebuying);
- this.pnlbuy.Location = new System.Drawing.Point(7, 405);
- this.pnlbuy.Name = "pnlbuy";
- this.pnlbuy.Size = new System.Drawing.Size(382, 299);
- this.pnlbuy.TabIndex = 6;
- this.pnlbuy.Visible = false;
- //
- // txthostname
- //
- this.txthostname.BackColor = System.Drawing.Color.Black;
- this.txthostname.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.txthostname.ForeColor = System.Drawing.Color.White;
- this.txthostname.Location = new System.Drawing.Point(186, 236);
- this.txthostname.Name = "txthostname";
- this.txthostname.Size = new System.Drawing.Size(186, 18);
- this.txthostname.TabIndex = 10;
- //
- // lbhostname
- //
- this.lbhostname.AutoSize = true;
- this.lbhostname.Location = new System.Drawing.Point(112, 240);
- this.lbhostname.Name = "lbhostname";
- this.lbhostname.Size = new System.Drawing.Size(68, 11);
- this.lbhostname.TabIndex = 9;
- this.lbhostname.Text = "Hostname:";
- //
- // txtgrade
- //
- this.txtgrade.BackColor = System.Drawing.Color.Black;
- this.txtgrade.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.txtgrade.ForeColor = System.Drawing.Color.White;
- this.txtgrade.Location = new System.Drawing.Point(65, 236);
- this.txtgrade.Name = "txtgrade";
- this.txtgrade.Size = new System.Drawing.Size(40, 18);
- this.txtgrade.TabIndex = 8;
- this.txtgrade.TextChanged += new System.EventHandler(this.txtgrade_TextChanged);
- //
- // lbgrade
- //
- this.lbgrade.AutoSize = true;
- this.lbgrade.Location = new System.Drawing.Point(12, 240);
- this.lbgrade.Name = "lbgrade";
- this.lbgrade.Size = new System.Drawing.Size(47, 11);
- this.lbgrade.TabIndex = 7;
- this.lbgrade.Text = "Grade:";
- //
- // lbmoduleinfo
- //
- this.lbmoduleinfo.Location = new System.Drawing.Point(10, 63);
- this.lbmoduleinfo.Name = "lbmoduleinfo";
- this.lbmoduleinfo.Size = new System.Drawing.Size(367, 156);
- this.lbmoduleinfo.TabIndex = 6;
- this.lbmoduleinfo.Text = resources.GetString("lbmoduleinfo.Text");
- //
- // cmbbuyable
- //
- this.cmbbuyable.BackColor = System.Drawing.Color.Black;
- this.cmbbuyable.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.cmbbuyable.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.cmbbuyable.ForeColor = System.Drawing.Color.White;
- this.cmbbuyable.FormattingEnabled = true;
- this.cmbbuyable.Location = new System.Drawing.Point(12, 38);
- this.cmbbuyable.Name = "cmbbuyable";
- this.cmbbuyable.Size = new System.Drawing.Size(360, 19);
- this.cmbbuyable.TabIndex = 3;
- this.cmbbuyable.SelectedIndexChanged += new System.EventHandler(this.cmbbuyable_SelectedIndexChanged);
- //
- // label4
- //
- this.label4.AutoSize = true;
- this.label4.Location = new System.Drawing.Point(10, 12);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(75, 11);
- this.label4.TabIndex = 2;
- this.label4.Text = "Buy Module";
- //
- // btndonebuying
- //
- this.btndonebuying.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.btndonebuying.AutoSize = true;
- this.btndonebuying.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
- this.btndonebuying.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.btndonebuying.Location = new System.Drawing.Point(341, 273);
- this.btndonebuying.Name = "btndonebuying";
- this.btndonebuying.Size = new System.Drawing.Size(38, 23);
- this.btndonebuying.TabIndex = 1;
- this.btndonebuying.Text = "Buy";
- this.btndonebuying.UseVisualStyleBackColor = true;
- this.btndonebuying.Click += new System.EventHandler(this.btndonebuying_Click);
- //
- // pnldefensemanager
- //
- this.pnldefensemanager.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.pnldefensemanager.Controls.Add(this.btnbuy);
- this.pnldefensemanager.Controls.Add(this.label3);
- this.pnldefensemanager.Controls.Add(this.cmbmodules);
- this.pnldefensemanager.Controls.Add(this.label1);
- this.pnldefensemanager.Controls.Add(this.button1);
- this.pnldefensemanager.Location = new System.Drawing.Point(395, 424);
- this.pnldefensemanager.Name = "pnldefensemanager";
- this.pnldefensemanager.Size = new System.Drawing.Size(382, 280);
- this.pnldefensemanager.TabIndex = 5;
- this.pnldefensemanager.Visible = false;
- //
- // btnbuy
- //
- this.btnbuy.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.btnbuy.AutoSize = true;
- this.btnbuy.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
- this.btnbuy.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.btnbuy.Location = new System.Drawing.Point(199, 254);
- this.btnbuy.Name = "btnbuy";
- this.btnbuy.Size = new System.Drawing.Size(122, 23);
- this.btnbuy.TabIndex = 7;
- this.btnbuy.Text = "Buy new module.";
- this.btnbuy.UseVisualStyleBackColor = true;
- this.btnbuy.Click += new System.EventHandler(this.btnbuy_Click);
- //
- // label3
- //
- this.label3.Location = new System.Drawing.Point(12, 95);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(367, 156);
- this.label3.TabIndex = 6;
- this.label3.Text = resources.GetString("label3.Text");
- //
- // cmbmodules
- //
- this.cmbmodules.BackColor = System.Drawing.Color.Black;
- this.cmbmodules.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.cmbmodules.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.cmbmodules.ForeColor = System.Drawing.Color.White;
- this.cmbmodules.FormattingEnabled = true;
- this.cmbmodules.Location = new System.Drawing.Point(12, 38);
- this.cmbmodules.Name = "cmbmodules";
- this.cmbmodules.Size = new System.Drawing.Size(360, 19);
- this.cmbmodules.TabIndex = 3;
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(10, 12);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(75, 11);
- this.label1.TabIndex = 2;
- this.label1.Text = "Add Module";
- //
- // button1
- //
- this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.button1.AutoSize = true;
- this.button1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
- this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.button1.Location = new System.Drawing.Point(327, 254);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(52, 23);
- this.button1.TabIndex = 1;
- this.button1.Text = "Done.";
- this.button1.UseVisualStyleBackColor = true;
- this.button1.Click += new System.EventHandler(this.button1_Click_1);
- //
- // pnlpcinfo
- //
- this.pnlpcinfo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.pnlpcinfo.Controls.Add(this.lbtargets);
- this.pnlpcinfo.Controls.Add(this.btnpoweroff);
- this.pnlpcinfo.Controls.Add(this.btnupgrade);
- this.pnlpcinfo.Controls.Add(this.lbpcinfo);
- this.pnlpcinfo.Controls.Add(this.lbmoduletitle);
- this.pnlpcinfo.Controls.Add(this.btncloseinfo);
- this.pnlpcinfo.Location = new System.Drawing.Point(783, 424);
- this.pnlpcinfo.Name = "pnlpcinfo";
- this.pnlpcinfo.Size = new System.Drawing.Size(382, 280);
- this.pnlpcinfo.TabIndex = 7;
- this.pnlpcinfo.Visible = false;
- //
- // lbtargets
- //
- this.lbtargets.Location = new System.Drawing.Point(12, 165);
- this.lbtargets.Name = "lbtargets";
- this.lbtargets.Size = new System.Drawing.Size(367, 86);
- this.lbtargets.TabIndex = 9;
- this.lbtargets.Text = "Targets";
- //
- // btnpoweroff
- //
- this.btnpoweroff.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.btnpoweroff.AutoSize = true;
- this.btnpoweroff.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
- this.btnpoweroff.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.btnpoweroff.Location = new System.Drawing.Point(85, 254);
- this.btnpoweroff.Name = "btnpoweroff";
- this.btnpoweroff.Size = new System.Drawing.Size(80, 23);
- this.btnpoweroff.TabIndex = 8;
- this.btnpoweroff.Text = "Power Off";
- this.btnpoweroff.UseVisualStyleBackColor = true;
- this.btnpoweroff.Click += new System.EventHandler(this.btnpoweroff_Click);
- //
- // btnupgrade
- //
- this.btnupgrade.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.btnupgrade.AutoSize = true;
- this.btnupgrade.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
- this.btnupgrade.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.btnupgrade.Location = new System.Drawing.Point(171, 254);
- this.btnupgrade.Name = "btnupgrade";
- this.btnupgrade.Size = new System.Drawing.Size(150, 23);
- this.btnupgrade.TabIndex = 7;
- this.btnupgrade.Text = "Upgrade This Module";
- this.btnupgrade.UseVisualStyleBackColor = true;
- this.btnupgrade.Click += new System.EventHandler(this.btnupgrade_Click);
- //
- // lbpcinfo
- //
- this.lbpcinfo.Location = new System.Drawing.Point(12, 41);
- this.lbpcinfo.Name = "lbpcinfo";
- this.lbpcinfo.Size = new System.Drawing.Size(367, 86);
- this.lbpcinfo.TabIndex = 6;
- this.lbpcinfo.Text = resources.GetString("lbpcinfo.Text");
- //
- // lbmoduletitle
- //
- this.lbmoduletitle.AutoSize = true;
- this.lbmoduletitle.Location = new System.Drawing.Point(10, 12);
- this.lbmoduletitle.Name = "lbmoduletitle";
- this.lbmoduletitle.Size = new System.Drawing.Size(75, 11);
- this.lbmoduletitle.TabIndex = 2;
- this.lbmoduletitle.Text = "Add Module";
- //
- // btncloseinfo
- //
- this.btncloseinfo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.btncloseinfo.AutoSize = true;
- this.btncloseinfo.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
- this.btncloseinfo.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.btncloseinfo.Location = new System.Drawing.Point(327, 254);
- this.btncloseinfo.Name = "btncloseinfo";
- this.btncloseinfo.Size = new System.Drawing.Size(52, 23);
- this.btncloseinfo.TabIndex = 1;
- this.btncloseinfo.Text = "Done.";
- this.btncloseinfo.UseVisualStyleBackColor = true;
- this.btncloseinfo.Click += new System.EventHandler(this.btncloseinfo_Click);
- //
- // flcontrols
- //
- this.flcontrols.Controls.Add(this.btnaddmodule);
- this.flcontrols.Controls.Add(this.lbcodepoints);
- this.flcontrols.Controls.Add(this.btntogglemusic);
- this.flcontrols.Controls.Add(this.lbsong);
- this.flcontrols.Dock = System.Windows.Forms.DockStyle.Bottom;
- this.flcontrols.Location = new System.Drawing.Point(0, 710);
- this.flcontrols.Name = "flcontrols";
- this.flcontrols.Size = new System.Drawing.Size(1339, 31);
- this.flcontrols.TabIndex = 4;
- //
- // btnaddmodule
- //
- this.btnaddmodule.AutoSize = true;
- this.btnaddmodule.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
- this.btnaddmodule.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.btnaddmodule.Location = new System.Drawing.Point(3, 3);
- this.btnaddmodule.Name = "btnaddmodule";
- this.btnaddmodule.Size = new System.Drawing.Size(87, 23);
- this.btnaddmodule.TabIndex = 0;
- this.btnaddmodule.Text = "Add Module";
- this.btnaddmodule.UseVisualStyleBackColor = true;
- this.btnaddmodule.Click += new System.EventHandler(this.btnaddmodule_Click);
- //
- // lbcodepoints
- //
- this.lbcodepoints.Location = new System.Drawing.Point(96, 0);
- this.lbcodepoints.Name = "lbcodepoints";
- this.lbcodepoints.Size = new System.Drawing.Size(127, 26);
- this.lbcodepoints.TabIndex = 1;
- this.lbcodepoints.Text = "Codepoints:";
- this.lbcodepoints.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // btntogglemusic
- //
- this.btntogglemusic.AutoSize = true;
- this.btntogglemusic.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
- this.btntogglemusic.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.btntogglemusic.Location = new System.Drawing.Point(229, 3);
- this.btntogglemusic.Name = "btntogglemusic";
- this.btntogglemusic.Size = new System.Drawing.Size(101, 23);
- this.btntogglemusic.TabIndex = 2;
- this.btntogglemusic.Text = "Toggle Music";
- this.btntogglemusic.UseVisualStyleBackColor = true;
- this.btntogglemusic.Click += new System.EventHandler(this.button2_Click);
- //
- // lbsong
- //
- this.lbsong.Location = new System.Drawing.Point(336, 0);
- this.lbsong.Name = "lbsong";
- this.lbsong.Size = new System.Drawing.Size(414, 26);
- this.lbsong.TabIndex = 3;
- this.lbsong.Text = "Codepoints:";
- this.lbsong.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // panel2
- //
- this.panel2.Controls.Add(this.pgpong);
- this.panel2.Controls.Add(this.pnltutorial);
- this.panel2.Controls.Add(this.pnlbuy);
- this.panel2.Controls.Add(this.pnlpcinfo);
- this.panel2.Controls.Add(this.pnldefensemanager);
- this.panel2.Controls.Add(this.tbui);
- this.panel2.Controls.Add(this.flcontrols);
- this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
- this.panel2.Location = new System.Drawing.Point(0, 0);
- this.panel2.Name = "panel2";
- this.panel2.Size = new System.Drawing.Size(1339, 741);
- this.panel2.TabIndex = 1;
- //
- // pgpong
- //
- this.pgpong.BackColor = System.Drawing.Color.Black;
- this.pgpong.Controls.Add(this.lblcountdown);
- this.pgpong.Controls.Add(this.ball);
- this.pgpong.Controls.Add(this.paddleHuman);
- this.pgpong.Controls.Add(this.paddleComputer);
- this.pgpong.Controls.Add(this.lbllevelandtime);
- this.pgpong.Controls.Add(this.lblstatsY);
- this.pgpong.Controls.Add(this.lblstatsX);
- this.pgpong.ForeColor = System.Drawing.Color.White;
- this.pgpong.Location = new System.Drawing.Point(0, 0);
- this.pgpong.Name = "pgpong";
- this.pgpong.Size = new System.Drawing.Size(700, 400);
- this.pgpong.TabIndex = 22;
- this.pgpong.Visible = false;
- this.pgpong.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pongMain_MouseMove);
- //
- // lblcountdown
- //
- this.lblcountdown.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblcountdown.Location = new System.Drawing.Point(187, 152);
- this.lblcountdown.Name = "lblcountdown";
- this.lblcountdown.Size = new System.Drawing.Size(315, 49);
- this.lblcountdown.TabIndex = 7;
- this.lblcountdown.Text = "3";
- this.lblcountdown.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- this.lblcountdown.Visible = false;
- //
- // ball
- //
- this.ball.BackColor = System.Drawing.Color.Gray;
- this.ball.Location = new System.Drawing.Point(300, 152);
- this.ball.Name = "ball";
- this.ball.Size = new System.Drawing.Size(20, 20);
- this.ball.TabIndex = 2;
- //
- // paddleHuman
- //
- this.paddleHuman.BackColor = System.Drawing.Color.Gray;
- this.paddleHuman.Location = new System.Drawing.Point(10, 134);
- this.paddleHuman.Name = "paddleHuman";
- this.paddleHuman.Size = new System.Drawing.Size(20, 100);
- this.paddleHuman.TabIndex = 3;
- this.paddleHuman.TabStop = false;
- //
- // paddleComputer
- //
- this.paddleComputer.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.paddleComputer.BackColor = System.Drawing.Color.Gray;
- this.paddleComputer.Location = new System.Drawing.Point(666, 134);
- this.paddleComputer.MaximumSize = new System.Drawing.Size(20, 100);
- this.paddleComputer.Name = "paddleComputer";
- this.paddleComputer.Size = new System.Drawing.Size(20, 100);
- this.paddleComputer.TabIndex = 1;
- //
- // lbllevelandtime
- //
- this.lbllevelandtime.Dock = System.Windows.Forms.DockStyle.Top;
- this.lbllevelandtime.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lbllevelandtime.Location = new System.Drawing.Point(0, 0);
- this.lbllevelandtime.Name = "lbllevelandtime";
- this.lbllevelandtime.Size = new System.Drawing.Size(700, 22);
- this.lbllevelandtime.TabIndex = 4;
- this.lbllevelandtime.Text = "Level: 1";
- this.lbllevelandtime.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // lblstatsY
- //
- this.lblstatsY.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.lblstatsY.Font = new System.Drawing.Font("Georgia", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblstatsY.Location = new System.Drawing.Point(542, 356);
- this.lblstatsY.Name = "lblstatsY";
- this.lblstatsY.Size = new System.Drawing.Size(144, 35);
- this.lblstatsY.TabIndex = 11;
- this.lblstatsY.Text = "Yspeed:";
- this.lblstatsY.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // lblstatsX
- //
- this.lblstatsX.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.lblstatsX.Font = new System.Drawing.Font("Georgia", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblstatsX.Location = new System.Drawing.Point(3, 356);
- this.lblstatsX.Name = "lblstatsX";
- this.lblstatsX.Size = new System.Drawing.Size(144, 35);
- this.lblstatsX.TabIndex = 5;
- this.lblstatsX.Text = "Xspeed: ";
- this.lblstatsX.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // pnltutorial
- //
- this.pnltutorial.Controls.Add(this.btnnext);
- this.pnltutorial.Controls.Add(this.lbtutorial);
- this.pnltutorial.Location = new System.Drawing.Point(174, 161);
- this.pnltutorial.Name = "pnltutorial";
- this.pnltutorial.Size = new System.Drawing.Size(363, 187);
- this.pnltutorial.TabIndex = 10;
- this.pnltutorial.Visible = false;
- //
- // lbtutorial
- //
- this.lbtutorial.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.lbtutorial.Location = new System.Drawing.Point(-2, 50);
- this.lbtutorial.Name = "lbtutorial";
- this.lbtutorial.Size = new System.Drawing.Size(367, 86);
- this.lbtutorial.TabIndex = 9;
- this.lbtutorial.Text = resources.GetString("lbtutorial.Text");
- this.lbtutorial.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- this.lbtutorial.Visible = false;
- //
- // tmrplayerhealthdetect
- //
- this.tmrplayerhealthdetect.Tick += new System.EventHandler(this.tmrplayerhealthdetect_Tick);
- //
- // tmrenemyhealthdetect
- //
- this.tmrenemyhealthdetect.Tick += new System.EventHandler(this.tmrenemyhealthdetect_Tick);
- //
- // tmrredraw
- //
- this.tmrredraw.Tick += new System.EventHandler(this.tmrredraw_Tick);
- //
- // tmrvisualizer
- //
- this.tmrvisualizer.Tick += new System.EventHandler(this.tmrvisualizer_Tick);
- //
- // pongGameTimer
- //
- this.pongGameTimer.Interval = 30;
- this.pongGameTimer.Tick += new System.EventHandler(this.pongGameTimer_Tick);
- //
- // counter
- //
- this.counter.Interval = 1000;
- this.counter.Tick += new System.EventHandler(this.counter_Tick);
- //
- // tmrcountdown
- //
- this.tmrcountdown.Interval = 1000;
- this.tmrcountdown.Tick += new System.EventHandler(this.tmrcountdown_Tick);
- //
- // HackUI
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 11F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.Black;
- this.ClientSize = new System.Drawing.Size(1339, 741);
- this.Controls.Add(this.panel2);
- this.Font = new System.Drawing.Font("Lucida Console", 8.25F);
- this.ForeColor = System.Drawing.Color.LightGreen;
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
- this.Name = "HackUI";
- this.Text = "HackUI";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.this_Closing);
- this.Load += new System.EventHandler(this.HackUI_Load);
- this.tbui.ResumeLayout(false);
- this.tbui.PerformLayout();
- this.pnlenemy.ResumeLayout(false);
- this.pnlenemy.PerformLayout();
- this.pnlyou.ResumeLayout(false);
- this.pnlyou.PerformLayout();
- this.pnlbuy.ResumeLayout(false);
- this.pnlbuy.PerformLayout();
- this.pnldefensemanager.ResumeLayout(false);
- this.pnldefensemanager.PerformLayout();
- this.pnlpcinfo.ResumeLayout(false);
- this.pnlpcinfo.PerformLayout();
- this.flcontrols.ResumeLayout(false);
- this.flcontrols.PerformLayout();
- this.panel2.ResumeLayout(false);
- this.pgpong.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.paddleHuman)).EndInit();
- this.pnltutorial.ResumeLayout(false);
- this.pnltutorial.PerformLayout();
- this.ResumeLayout(false);
-
- }
-
- #endregion
-
- private System.Windows.Forms.TableLayoutPanel tbui;
- private System.Windows.Forms.Panel pnlyou;
- private System.Windows.Forms.Panel pnlbuy;
- private System.Windows.Forms.TextBox txthostname;
- private System.Windows.Forms.Label lbhostname;
- private System.Windows.Forms.TextBox txtgrade;
- private System.Windows.Forms.Label lbgrade;
- private System.Windows.Forms.Label lbmoduleinfo;
- private System.Windows.Forms.ComboBox cmbbuyable;
- private System.Windows.Forms.Label label4;
- private System.Windows.Forms.Button btndonebuying;
- private System.Windows.Forms.Panel pnldefensemanager;
- private System.Windows.Forms.Button btnbuy;
- private System.Windows.Forms.Label label3;
- private System.Windows.Forms.ComboBox cmbmodules;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.Button button1;
- private System.Windows.Forms.Button btnnext;
- private System.Windows.Forms.Panel pnlpcinfo;
- private System.Windows.Forms.Label lbtargets;
- private System.Windows.Forms.Button btnpoweroff;
- private System.Windows.Forms.Button btnupgrade;
- private System.Windows.Forms.Label lbpcinfo;
- private System.Windows.Forms.Label lbmoduletitle;
- private System.Windows.Forms.Button btncloseinfo;
- private System.Windows.Forms.FlowLayoutPanel flcontrols;
- private System.Windows.Forms.Button btnaddmodule;
- private System.Windows.Forms.Label lbcompromised;
- private System.Windows.Forms.Label lbstats;
- private System.Windows.Forms.TextBox txtyourconsole;
- private System.Windows.Forms.TextBox txtenemyconsole;
- private System.Windows.Forms.Panel pnlenemy;
- private System.Windows.Forms.Label lbenemycompromised;
- private System.Windows.Forms.Label lbenemystats;
- private System.Windows.Forms.Panel panel2;
- private System.Windows.Forms.Timer tmrplayerhealthdetect;
- private System.Windows.Forms.Timer tmrenemyhealthdetect;
- private System.Windows.Forms.Timer tmrredraw;
- private System.Windows.Forms.Label lbcodepoints;
- private System.Windows.Forms.Button btntogglemusic;
- private System.Windows.Forms.Label lbsong;
- private System.Windows.Forms.Panel pnltutorial;
- private System.Windows.Forms.Label lbtutorial;
- private System.Windows.Forms.Timer tmrvisualizer;
- internal System.Windows.Forms.Panel pgpong;
- internal System.Windows.Forms.Label lblcountdown;
- internal System.Windows.Forms.Panel ball;
- internal System.Windows.Forms.PictureBox paddleHuman;
- internal System.Windows.Forms.Panel paddleComputer;
- internal System.Windows.Forms.Label lbllevelandtime;
- internal System.Windows.Forms.Label lblstatsY;
- internal System.Windows.Forms.Label lblstatsX;
- internal System.Windows.Forms.Timer pongGameTimer;
- internal System.Windows.Forms.Timer counter;
- internal System.Windows.Forms.Timer tmrcountdown;
- }
-}
\ No newline at end of file
diff --git a/source/WindowsFormsApplication1/Gameplay/HackUI.cs b/source/WindowsFormsApplication1/Gameplay/HackUI.cs
deleted file mode 100644
index a1c1555..0000000
--- a/source/WindowsFormsApplication1/Gameplay/HackUI.cs
+++ /dev/null
@@ -1,2112 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace ShiftOS
-{
- public partial class HackUI : Form
- {
- public HackUI()
- {
- InitializeComponent();
- this.TopMost = false;
- ThisEnemyHacker = new EnemyHacker("Test Dummy", "A test hacker", "A test hacker", 1, 1, "easy");
- }
-
- public event EventHandler OnWin;
-
- private bool InOnlineBattle = false;
- private Online.Hacking.NetTransmitter transmitter = null;
- private Online.Hacking.NetTransmitter _playerTransmitter = null;
- private Online.Hacking.NetListener receiver = null;
- private Online.Hacking.NetListener player_listener = null;
-
- public HackUI(EnemyHacker enemy)
- {
- ThisEnemyHacker = enemy;
- InitializeComponent();
- }
-
- public HackUI(Online.Hacking.NetTransmitter t, Online.Hacking.NetListener l, Online.Hacking.NetListener playerListener, Online.Hacking.NetTransmitter playerTransmitter)
- {
- InOnlineBattle = true;
- transmitter = t;
- receiver = l;
- player_listener = playerListener;
- _playerTransmitter = playerTransmitter;
- InitializeComponent();
- }
-
- public Computer ThisPlayerPC = null;
- private decimal TotalPlayerHP = 0;
- private EnemyHacker EnemyNet = null;
-
- private List MyNetwork = new List();
-
- #region PLAYER
-
- private void LoadPlayerScreen()
- {
- AntiVirusBounds = new List();
- var tc = new Module(SystemType.Core, 1, "localhost");
- tc.HP = 100;
- TutorialNetwork.Add(tc);
- foreach (var m in GetMyNet())
- {
- if (m.Type == SystemType.Core)
- {
- MyNetwork.Add(m);
- }
- }
- VisualizePlayerNetwork();
- if (EnemyNet != null)
- {
- tmrplayerhealthdetect.Start();
- }
- else
- {
- tmrplayerhealthdetect.Start();
- }
- if (IsTutorial)
- {
- SetupTutorialUI(0);
- }
- if (InOnlineBattle)
- LoadOnlinePlayer();
- }
-
- private void VisualizePlayerNetwork()
- {
- AllPlayerComputers = new List();
- foreach (Module m in MyNetwork)
- {
- if (AllPlayerComputers.Count <= 10)
- {
- var c = m.Deploy();
- if (c.Type == SystemType.Core)
- {
- ThisPlayerPC = c;
- }
- AddModule(c);
- }
- }
- if(ThisPlayerPC == null)
- {
- var m = new Module(SystemType.Core, 1, "localhost");
- GetMyNet().Add(m);
- MyNetwork.Add(m);
- var c = m.Deploy();
- ThisPlayerPC = c;
- AddModule(c);
- }
- }
-
- private void player_listener_ModuleRemoved(object sender, Online.Hacking.Events.ModuleRemoved e)
- {
- Computer c = null;
- foreach (var m in AllPlayerComputers)
- {
- if (m.Hostname == e.new_module)
- {
- c = m;
- }
- }
- AllPlayerComputers.Remove(c);
- c.Dispose();
- }
-
- private void player_listener_ModuleHealthSet(object sender, Online.Hacking.Events.Health e)
- {
- var mod = new Computer();
- foreach (var m in AllPlayerComputers)
- {
- if (m.Hostname == e.host_name)
- mod = m;
- }
- mod.HP = e.health;
- int old_hp = mod.HP;
- mod.HP = e.health;
- if (mod.HP > old_hp)
- {
- mod.throw_repaired();
- }
- else
- {
- mod.throw_damaged();
- }
- }
-
-
- public void LoadOnlinePlayer()
- {
- //register event handlers
- player_listener.ModuleHealthSet += player_listener_ModuleHealthSet;
- player_listener.ModuleRemoved += player_listener_ModuleRemoved;
- player_listener.ModuleDisabled += (o, e) =>
- {
- foreach (var c in AllPlayerComputers)
- {
- if (c.Hostname == e.hostName)
- {
- c.Disable();
- }
- }
- };
- }
-
- public List AllPlayerComputers = null;
-
- private void tmrplayerhealthdetect_Tick(object sender, EventArgs e)
- {
- if(ThisPlayerPC != null)
- {
- ThisPlayerPC.Left = (pnlyou.Width - ThisPlayerPC.Width) / 2;
- ThisPlayerPC.Top = (pnlyou.Height - ThisPlayerPC.Height) / 2;
-
- }
- var rnd = new Random();
- int chance = 0;
- foreach (var pc in AllPlayerComputers)
- {
- if (pc.Disabled == false)
- {
- var elist = new List();
- if (pc.Enslaved)
- elist = AllPlayerComputers;
- else
- elist = pc.Enemies;
- if (elist != null)
- {
- foreach (var enemy in elist)
- {
- if (enemy != null && enemy.HP > 0)
- {
- chance = rnd.Next(1, 15);
- if (chance == 7)
- {
- if (IsTutorial)
- {
- if (TutorialProgress == 32 || TutorialProgress == 9)
- {
- enemy.LaunchAttack(pc.GetProperType(), pc.GetDamageRate());
- }
- }
- else
- {
- enemy.LaunchAttack(pc.GetProperType(), pc.GetDamageRate());
- }
- }
- }
- }
- }
- }
- }
- decimal health = 0;
- foreach (var pc in AllPlayerComputers)
- {
- health += (decimal)pc.HP;
- }
- if (health > TotalPlayerHP)
- {
- TotalPlayerHP = health;
- }
- try
- {
- decimal percent = (health / TotalPlayerHP) * 100;
- lbstats.Text = $"System Health: {percent}%";
- }
- catch
- {
-
- }
- if (ThisPlayerPC.HP <= 0)
- {
- API.CreateInfoboxSession("System compromised.", "The enemy hacker has overthrown your defenses and compromised your system. You will need to wait until your core heals before beginning another battle.", infobox.InfoboxMode.Info);
- Hacking.Failure = true;
- Hacking.FailDate = DateTime.Now;
- UserRequestedClose = false;
- this.Close();
- }
- }
-
- public bool UserRequestedClose = true;
-
- private void this_Closing(object sender, FormClosingEventArgs e)
- {
- var t = new Thread(new ThreadStart(() =>
- {
- int prev_volume = Audio._wmp.settings.volume;
- while(Audio._wmp.settings.volume > 0)
- {
- Thread.Sleep(100);
- Audio._wmp.settings.volume -= 1;
- }
- Audio.ForceStop();
- Audio._wmp.settings.volume = prev_volume;
- }));
- t.Start();
- if (UserRequestedClose == false)
- {
- this.TopMost = false;
- Computer[] pcs = new Computer[AllPlayerComputers.Count];
- AllPlayerComputers.CopyTo(pcs);
- foreach (var pc in pcs)
- {
- pc?.Dispose();
- }
- Computer[] epcs = new Computer[AllEnemyComputers.Count];
- AllEnemyComputers.CopyTo(epcs);
- foreach (var epc in epcs)
- {
- epc?.Dispose();
- }
- tmrplayerhealthdetect.Stop();
- tmrenemyhealthdetect.Stop();
- Hacking.RepairTimer.Start(); //Now the player can repair.
- }
- else
- {
- e.Cancel = true;
- }
- }
-
- public Computer SelectedPlayerComputer = null;
-
- public Computer module_to_steal = null;
-
- public void AddModule(Computer newModule)
- {
- if (InOnlineBattle)
- {
- newModule.Transmitter = transmitter;
- transmitter?.send_message(Online.Hacking.NetTransmitter.Messages.PlaceModule, new Online.Hacking.Module { Grade = newModule.Grade, Hostname = newModule.Hostname, HP = newModule.HP, Type = (int)newModule.Type, X = newModule.Left, Y = newModule.Top });
- }
- pnlyou.Controls.Add(newModule);
- int hp = newModule.HP;
- WriteLine($"[Network] Welcome to the network, {newModule.Hostname}!");
- TotalPlayerHP += newModule.HP;
- AllPlayerComputers.Add(newModule);
- newModule.Show();
- if (!InOnlineBattle)
- {
- newModule.StolenModule += (o, a) =>
- {
- var t = new Thread(new ThreadStart(() =>
- {
- var rnd = new Random();
- var lst = new List();
- if (newModule.Enslaved)
- lst = AllPlayerComputers;
- else
- lst = AllEnemyComputers;
- WriteLine($"[{newModule.Hostname}] Starting network hack...");
- Thread.Sleep(5000);
-
- var pc = lst[rnd.Next(0, lst.Count)];
- this.Invoke(new Action(() =>
- {
- if (pc.Type != SystemType.Core)
- {
- module_to_steal = pc;
-
- pgpong.Left = (this.Width - pgpong.Width) / 2;
- pgpong.Top = (this.Height - pgpong.Height) / 2;
-
- pgpong.Show();
- newgame();
- }
- }));
- }));
- t.Start();
- };
- newModule.EnslavedModule += (o, e) =>
- {
- if (!newModule.Enslaved)
- {
- var pc = AllEnemyComputers[rand.Next(0, AllEnemyComputers.Count)];
- if (!pc.Enslaved)
- {
- WriteLine($"[{newModule.Hostname}] Successfully enslaved {pc.Hostname}");
- pc.Enslaved = true;
- }
-
- }
- };
- }
- newModule.OnDestruction += (object s, EventArgs a) =>
- {
- if (this.SelectedPlayerComputer == newModule)
- {
- SelectedPlayerComputer = null;
- }
- if (newModule.Type == SystemType.Firewall)
- {
- Player_Firewall_Destroy(newModule);
- }
- AllPlayerComputers.Remove(newModule);
- newModule.Dispose();
- WriteLine($"[Network] {newModule.Hostname} has gone OFFLINE.");
- transmitter?.send_message(Online.Hacking.NetTransmitter.Messages.RemoveModule, newModule.Hostname);
- };
- newModule.Select += (object s, EventArgs e) =>
- {
- SelectedPlayerComputer = newModule;
- ShowPCInfo(newModule.Hostname);
- if (IsTutorial)
- {
- if (TutorialProgress == 6)
- {
- if (newModule == ThisPlayerPC)
- {
- SetupTutorialUI(7);
- }
- }
- }
- };
- newModule.HP_Decreased += new EventHandler(Player_System_Damaged);
- newModule.OnRepair += new EventHandler(Player_System_Repaired);
- if (newModule.Type == SystemType.Antivirus || newModule.Type == SystemType.RepairModule)
- {
- var b = newModule.GetAreaOfEffect();
- AntiVirusBounds.Add(b);
- pnlyou.Refresh();
- newModule.AntivirusRepair += (object s, EventArgs a) =>
- {
- foreach (Computer pc in AllPlayerComputers)
- {
- if (pc != newModule && pc.Bounds.IntersectsWith(b))
- {
- if (newModule.Type == SystemType.RepairModule)
- {
- if (pc.HP < newModule.HP)
- {
- if (pc.HP < pc.GetTotal())
- {
- WriteLine($"[{newModule.Hostname}] Repairing neighbouring system \"{pc.Hostname}\"");
- pc.Repair(1);
- }
- }
-
- }
- else
- {
- if (pc.HP < 10)
- {
- WriteLine($"[{newModule.Hostname}] Repairing neighbouring system \"{pc.Hostname}\"");
- pc.Repair(1);
- }
- }
- }
- }
- };
-
- }
- if (newModule.Type == SystemType.Firewall)
- {
- var b = newModule.GetAreaOfEffect();
- AntiVirusBounds.Add(b);
- pnlenemy.Refresh();
- Player_Firewall_Deflect(newModule);
- }
- if (newModule.Type == SystemType.ServerStack)
- {
- newModule.MassDDoS += (object s, EventArgs a) =>
- {
- if (newModule.Enslaved)
- WormToPlayer();
- else
- WormToEnemy();
- };
- }
- }
-
- public void WormToEnemy()
- {
- var rnd = new Random();
- int r = rnd.Next(0, 10);
- WriteLine("[Network] Launching distributed denial-of-service attack on rival network.");
- foreach (Computer c in AllEnemyComputers)
- {
- if (r == 5)
- {
- c.Disable();
- }
- }
- }
-
- public void ShowPCInfo(string hostname)
- {
- Computer c = null;
- foreach (var pc in AllPlayerComputers)
- {
- if (pc.Hostname == hostname)
- {
- c = pc;
- }
- }
-
- Module mod = null;
- foreach (var m in GetMyNet())
- {
- if (m.Hostname == hostname)
- {
- mod = m;
- }
- }
- if (mod != null)
- {
- pnlpcinfo.Left = 7;
- pnlpcinfo.Show();
- lbmoduletitle.Text = "Module Info - " + hostname;
- lbpcinfo.Text = $"Hostname: {hostname}{Environment.NewLine}Type: {mod.Type.ToString()}{Environment.NewLine}{Environment.NewLine}";
- if (mod.Type == SystemType.Core)
- {
- lbpcinfo.Text += Environment.NewLine + "This represents your main system. If this module is destroyed, you will automatically lose the battle. Protect it at all costs.";
- btnupgrade.Hide();
- btnpoweroff.Hide();
- }
- else
- {
- lbpcinfo.Text += $"{Environment.NewLine}Grade: {mod.Grade}";
- if (mod.Grade < 4)
- {
- btnupgrade.Show();
- }
- else
- {
- btnupgrade.Hide();
- }
- btnpoweroff.Show();
- }
-
- }
- if (c != null)
- {
- if (c.Enslaved)
- {
- lbtargets.Text = "*** WARNING ***: This module has been ENSLAVED! Consider a redeploy.";
- }
- else
- {
- lbtargets.Text = "Targets: ";
- if (c.Enemies != null)
- {
- if (c.Enemies.Count > 0)
- {
- foreach (var pc in c.Enemies)
- {
- lbtargets.Text += " " + pc.Hostname + ",";
- }
- }
- else
- {
- lbtargets.Text += " - Click on an enemy module to target it.";
- }
- }
- else
- {
- lbtargets.Text += " - Click on an enemy module to target it.";
- }
- lbtargets.Text += Environment.NewLine + "Some modules will not fire at their targets.";
- }
- }
- }
-
- public void Player_Firewall_Deflect(Computer fwall)
- {
- //Safegaurd...
- if (fwall.Type == SystemType.Firewall)
- {
- var r = fwall.GetAreaOfEffect();
- foreach (var pc in AllPlayerComputers)
- {
- if (pc != fwall)
- {
- if (pc.Bounds.IntersectsWith(r))
- {
- pc.DamageDefector = fwall.Grade;
- }
- }
- }
- }
- }
-
- public void Player_Firewall_Destroy(Computer fwall)
- {
- //Safegaurd...
- if (fwall.Type == SystemType.Firewall)
- {
- var r = fwall.GetAreaOfEffect();
- foreach (var pc in AllPlayerComputers)
- {
- if (pc.Bounds.IntersectsWith(r))
- {
- pc.DamageDefector = 1;
- UpdatePlayerFirewalls();
- }
- }
- }
- }
-
- public void UpdatePlayerFirewalls()
- {
- foreach (var pc in AllPlayerComputers)
- {
- if (pc.Type == SystemType.Firewall)
- {
- Player_Firewall_Deflect(pc);
- }
- }
- }
-
-
- private void Player_System_Repaired(object s, EventArgs e)
- {
- var c = (Computer)s;
- WriteLine($"[{c.Hostname}] System repaired.");
- lbcompromised.Text = "System regenerating...";
- int location = c.Left - (lbcompromised.Width / 4);
- int y = c.Top - 25;
- lbcompromised.Location = new Point(location, y);
- lbcompromised.Show();
- c.Flash(lbcompromised);
- transmitter?.send_message(Online.Hacking.NetTransmitter.Messages.SetHealth, $"{c.Hostname} {c.HP}");
- }
-
-
- private void Player_System_Damaged(object s, EventArgs e)
- {
- var c = (Computer)s;
- WriteLine($"[{c.Hostname}] System damaged. Total HP: {c.HP}");
- lbcompromised.Text = "System damaged!";
- int location = c.Left - (lbcompromised.Width / 4);
- int y = c.Top - 25;
- lbcompromised.Location = new Point(location, y);
- lbcompromised.Show();
- c.Flash(lbcompromised);
- transmitter?.send_message(Online.Hacking.NetTransmitter.Messages.SetHealth, $"{c.Hostname} {c.HP}");
-
- }
-
- private void btnaddmodule_Click(object sender, EventArgs e)
- {
- SetupModuleList();
- pnldefensemanager.Left = 7;
- pnldefensemanager.Visible = !pnldefensemanager.Visible;
- if (IsTutorial)
- {
- if (TutorialProgress == 12)
- {
- SetupTutorialUI(13);
- }
- }
- }
-
- private Dictionary FutureModules = null;
- public List TutorialNetwork = new List();
-
- public void SetupModuleList()
- {
- FutureModules = new Dictionary();
- cmbmodules.Items.Clear();
- List net = null;
- if (IsTutorial)
- {
- net = TutorialNetwork;
- }
- else
- {
- net = Hacking.MyNetwork;
- }
- foreach (var item in net)
- {
- Computer m = null;
- foreach (var mod in AllPlayerComputers)
- {
- if (mod.Hostname == item.Hostname)
- {
- m = mod;
- }
- }
- if (m == null)
- {
- if (item.HP > 0)
- {
- cmbmodules.Items.Add(item.Hostname);
- FutureModules.Add(item.Hostname, item.Type);
- }
- }
- }
-
- }
-
- bool PlacingNewModule = false;
-
-
- private void button1_Click_1(object sender, EventArgs e)
- {
- if (cmbmodules.Text != "")
- {
- PlacingNewModule = true;
- pnldefensemanager.Hide();
- if (IsTutorial)
- {
- if (TutorialProgress == 20)
- {
- SetupTutorialUI(21);
- }
- }
- }
- }
-
- private void playfield_MouseDown(object sender, MouseEventArgs e)
- {
- if (PlacingNewModule == true)
- {
- if (e.Button == MouseButtons.Left)
- {
- if (AllPlayerComputers.Count < 10)
- {
- bool cont = true;
- try
- {
- SystemType type = FutureModules[cmbmodules.Text];
- }
- catch
- {
- cont = false;
- API.CreateInfoboxSession("Error", "Please select a module type.", infobox.InfoboxMode.Info);
- }
- if (cont == true)
- {
- var coordinates = pnlyou.PointToClient(Cursor.Position);
- int x = coordinates.X;
- int y = coordinates.Y;
-
- var m = new Module(FutureModules[cmbmodules.Text], 1, cmbmodules.Text);
- foreach (var mod in GetMyNet())
- {
- if (mod.Hostname == cmbmodules.Text)
- {
- m = mod;
- }
- }
- m.X = x;
- m.Y = y;
- var c = m.Deploy();
- AddModule(c);
- API.RemoveCodepoints(10);
- pnldefensemanager.Hide();
- if (IsTutorial)
- {
- if (TutorialProgress == 21)
- {
- SetupTutorialUI(22);
- }
- else if (TutorialProgress == 25)
- {
- SetupTutorialUI(26);
- }
- }
- }
- PlacingNewModule = false;
- }
- else
- {
- API.CreateInfoboxSession("Too much deployed modules", "You can have a maximum of 10 modules deployed on your network, including your main system. You will have to wait for one to be destroyed.", infobox.InfoboxMode.Info);
- PlacingNewModule = false;
- }
- }
- else
- {
- PlacingNewModule = false;
- }
- }
- }
-
- public List BuyableModules = null;
-
- public void SetupBuyable()
- {
- if (!IsTutorial)
- {
- BuyableModules = Hacking.GetFutureModules();
- }
- cmbbuyable.Items.Clear();
- foreach (var m in BuyableModules)
- {
- cmbbuyable.Items.Add(m.Name);
- }
- lbmoduleinfo.Text = "";
- txtgrade.Text = "1";
- }
-
- private void btnbuy_Click(object sender, EventArgs e)
- {
- if (IsTutorial)
- {
- if (TutorialProgress == 14)
- {
- SetupTutorialUI(15);
- }
- }
- SetupBuyable();
- pnlbuy.Show();
- pnldefensemanager.Hide();
- }
-
- public List AntiVirusBounds = null;
- public List IndicatorsToDestroy = new List();
- private void boundpaint(object sender, PaintEventArgs e)
- {
- foreach (Rectangle r in IndicatorsToDestroy)
- {
- AntiVirusBounds.Remove(r);
- var sb = new SolidBrush(Color.Black);
- var p = new Pen(sb);
- p.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
- p.Width = 2;
- e.Graphics.DrawRectangle(p, r);
-
- }
- IndicatorsToDestroy.Clear();
- foreach (Rectangle r in AntiVirusBounds)
- {
- IndicatorsToDestroy.Add(r);
- tmrredraw.Start();
- var sb = new SolidBrush(Color.White);
- var p = new Pen(sb);
- p.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
- p.Width = 2;
- e.Graphics.DrawRectangle(p, r);
- }
- }
-
- private void tmrredraw_Tick(object sender, EventArgs e)
- {
- pnlyou.Refresh();
- tmrredraw.Stop();
- }
-
- private void SetupModuleInfo()
- {
- bool cont = false;
- FutureModule m = null;
- foreach (var mod in BuyableModules)
- {
- if (mod.Name == cmbbuyable.Text)
- {
- m = mod;
- cont = true;
- }
- }
- if (cont == true)
- {
- lbmoduleinfo.Text = m.Name;
- lbmoduleinfo.Text += Environment.NewLine + $"Cost: {m.Cost * Convert.ToInt32(txtgrade.Text)} CP";
- lbmoduleinfo.Text += Environment.NewLine + $"Description: {Environment.NewLine}{m.Description}";
- }
- }
-
- private void cmbbuyable_SelectedIndexChanged(object sender, EventArgs e)
- {
- SetupModuleInfo();
- if (IsTutorial)
- {
- if (TutorialProgress == 17)
- {
- if (cmbbuyable.Text == "Antivirus")
- {
- SetupTutorialUI(18);
- }
- }
- }
- }
-
- private void txtgrade_TextChanged(object sender, EventArgs e)
- {
- try
- {
- int g = Convert.ToInt32(txtgrade.Text);
- if (g < 1)
- {
- txtgrade.Text = "1";
- }
- else if (g > 4)
- {
- txtgrade.Text = "4";
- }
- SetupModuleInfo();
- }
- catch
- {
- txtgrade.Text = "1";
- SetupModuleInfo();
- }
- }
-
- public List GetMyNet()
- {
- if (IsTutorial)
- {
- return TutorialNetwork;
- }
- else
- {
- return Hacking.MyNetwork;
- }
- }
-
- private void btndonebuying_Click(object sender, EventArgs e)
- {
- var mod = new FutureModule("", 0, "", SystemType.Core);
- bool cont = false;
- foreach (var m in BuyableModules)
- {
- if (m.Name == cmbbuyable.Text)
- {
- mod = m;
- cont = true;
- }
- }
- if (cont == true)
- {
- if (API.Codepoints >= mod.Cost)
- {
- if (txthostname.Text != "")
- {
- bool cont2 = true;
- string hname = txthostname.Text.Replace(" ", "_");
- foreach (var pc in GetMyNet())
- {
- if (pc.Hostname == hname)
- {
- cont2 = false;
- }
- }
- if (cont2 == true)
- {
- var newModule = new Module(mod.Type, Convert.ToInt32(txtgrade.Text), hname);
- newModule.HP = newModule.GetTotalHP();
- GetMyNet().Add(newModule);
- API.RemoveCodepoints(mod.Cost);
- API.CreateInfoboxSession("Module added.", "To deploy the module to the network, select 'Add Module' and choose the hostname from the menu.", infobox.InfoboxMode.Info);
- pnlbuy.Hide();
- if (IsTutorial)
- {
- if (TutorialProgress == 19)
- {
- SetupTutorialUI(20);
- }
- else if (TutorialProgress == 24)
- {
- SetupTutorialUI(25);
- }
- }
- }
- else
- {
- API.CreateInfoboxSession("Please enter a unique hostname.", "No two computers can share the same hostname. Please choose another.", infobox.InfoboxMode.Info);
- }
- }
- else
- {
- API.CreateInfoboxSession("Please enter a hostname.", "It is best to enter a hostname for your new computer so you know which one it is.", infobox.InfoboxMode.Info);
- }
-
- }
- else
- {
- API.CreateInfoboxSession("Insufficient Codepoints", "You do not have enough Codepoints to buy this module.", infobox.InfoboxMode.Info);
- }
- }
- }
-
- private void btncloseinfo_Click(object sender, EventArgs e)
- {
- SelectedPlayerComputer = null;
- pnlpcinfo.Hide();
- Hacking.SaveCharacters();
- }
-
- private void btnpoweroff_Click(object sender, EventArgs e)
- {
- //Remove the computer from the game.
- pnlyou.Controls.Remove(SelectedPlayerComputer);
- AllPlayerComputers.Remove(SelectedPlayerComputer);
- btnpoweroff.Hide();
- }
-
- private void btnupgrade_Click(object sender, EventArgs e)
- {
- int price = 20 * SelectedPlayerComputer.Grade;
- if (API.Codepoints >= price)
- {
- foreach (var m in GetMyNet())
- {
- if (m.Hostname == SelectedPlayerComputer.Hostname)
- {
- SelectedPlayerComputer.Grade += 1;
- m.Grade += 1;
- Hacking.SaveCharacters();
- API.CreateInfoboxSession("Upgrade successful.", "Your module has been upgraded.", infobox.InfoboxMode.Info);
- }
- }
- }
- else
- {
- API.CreateInfoboxSession("Insufficient funds", $"You need at least {price} CP to upgrade this module.", infobox.InfoboxMode.Info);
- }
- ShowPCInfo(SelectedPlayerComputer.Hostname);
- }
-
- public int TutorialProgress = 0;
- public bool IsTutorial = false;
-
- public void SetupTutorialUI(int p)
- {
- TutorialProgress = p;
- lbtutorial.Show();
- pnltutorial.Show();
- pnltutorial.Left = (this.Width - pnltutorial.Width) / 2;
- pnltutorial.Top = (this.Height - pnltutorial.Height) / 2;
- switch (p)
- {
- case 0:
- lbtutorial.Text = "Welcome to the Hacker Battle tutorial. This guide will teach you the fundamentals and basics of taking part in a Hacker Battle. When you're done here, you'll be able to start up a network and start dominating others' networks.";
- btnaddmodule.Hide();
- btnnext.Show();
- break;
- case 1:
- lbtutorial.Text = "Let's go over the user interface. It's quite simple, actually. There are 4 different displays on your screen. One for your network, one for your console, and same for the enemy.";
- break;
- case 2:
- lbtutorial.Text = "On the left side is your console and playfield. Your console will log all the actions that happen on your network. Your Playfield is a visual representation of your network. Each square represents a different module. Most of your actions will take place in the Playfield.";
- break;
- case 3:
- lbtutorial.Text = "On the right is the enemy's console and playfield. Both playfields will show the HP (health) of each module, and the total network HP.";
- break;
- case 4:
- lbtutorial.Text = "If the enemy's total network health hits 0%, or his core's strength hits 0%, you win.";
- break;
- case 5:
- lbtutorial.Text = "However, if the same happens to you, you will lose the battle, and won't be able to fight back until your Core heals.";
- break;
- case 6:
- lbtutorial.Text = "Each network has one core. It is represented by the square in the centre of the playfield. Click on your Core to view information about it.";
- btnnext.Hide();
- break;
- case 7:
- lbtutorial.Text = "When you click on a module, you can see information about it, such as it's grade level, HP, and type. This module is a Core, so it has no grade level. It currently has 100 HP.";
- btnnext.Show();
- break;
- case 8:
- lbtutorial.Text = "When a module is selected you can left-click an enemy module to target it. This will make the selected module attempt to fire at the target. Cores are very weak, but are capable of bringing a target down by 1 HP.";
- break;
- case 9:
- lbtutorial.Text = "The enemy Core is attacking your Core now. Looks like it's time to fight back. Select your core, and target the enemy's Core to fight back.";
- btnnext.Hide();
- break;
- case 10:
- lbtutorial.Text = "Phew! He couldn't do much damage before we fought back. In a real battle, modules won't just stop fighting randomly, but for the purpose of this tutorial, your Core will stop attacking the enemy Core.";
- btnnext.Show();
- ThisPlayerPC.Enemies.Clear();
- break;
- case 11:
- lbtutorial.Text = "Should your Core fall to a fatal state in the future, you can deploy some defenses to slow the enemy down. Any hacker knows it's best to disable defenses before attacking the main target.";
- ThisPlayerPC.HP = 5;
- break;
- case 12:
- lbtutorial.Text = "We will look at ways of healing damaged modules now. You can add new modules to the network by clicking the [Add Module] button in the lower-left corner.";
- btnaddmodule.Show();
- btnnext.Hide();
- break;
- case 13:
- btnbuy.Hide();
- lbtutorial.Text = "You can select a module from the list of hostnames. Only modules that are not powered on will display in the menu.";
- btnnext.Show();
- BuyableModules = new List();
- BuyableModules.Add(new FutureModule("Antivirus", 0, "This module will heal any other module within it's area of effect to 10 HP. Higher grades can improve it's area of effect.", SystemType.Antivirus));
- break;
- case 14:
- btnbuy.Show();
- lbtutorial.Text = "In this demonstration, you have no other modules to deploy. You will need to buy some modules to get started. Click [Buy New Module] to continue.";
- btnnext.Hide();
- break;
- case 15:
- cmbbuyable.Enabled = false;
- lbtutorial.Text = "Let's go over the user interface, shall we? At the top is a list of all possible module types.";
- btnnext.Show();
- btndonebuying.Hide();
- lbgrade.Hide();
- txtgrade.Hide();
- txthostname.Hide();
- lbhostname.Hide();
- lbmoduleinfo.Hide();
- break;
- case 16:
- lbtutorial.Text = "Below that, is the cost and description of the selected module type. It's invisible right now, but when you select a new module, it will populate.";
- lbmoduleinfo.Show();
- break;
- case 17:
- cmbbuyable.Enabled = true;
- lbtutorial.Text = "We need an Antivirus module, so go ahead and select it from the menu.";
- btnnext.Hide();
- break;
- case 18:
- lbtutorial.Text = "Normally, an Antivirus would cost us 15 Codepoints, however since this is a tutorial, it is free.";
- btnnext.Show();
- break;
- case 19:
- lbtutorial.Text = "Below the description is the Hostname box. A Hostname is used to identify the new module. Pick something you'll remember as this new Antivirus, then click [Buy] to purchase it.";
- btnnext.Hide();
- lbhostname.Show();
- txthostname.Show();
- btndonebuying.Show();
- break;
- case 20:
- btnnext.Hide();
- lbtutorial.Text = "Now that we have an antivirus module, go ahead and deploy it by selecting [Add Module], choosing the hostname you entered, and clicking [Done].";
- break;
- case 21:
- btnnext.Hide();
- lbtutorial.Text = "Alrighty. Now you get to choose where you place your module. Simply left-click in a blank area where you'd like to place the module. Right-click to cancel. Oh, be sure to place close to our Core!";
- break;
- case 22:
- lbtutorial.Text = "The Antivirus has been placed. You may've noticed that white dotted box around it when you placed it. If the Core is even slightly within the box, the Antivirus will heal it back to 10 HP.";
- btnnext.Show();
- break;
- case 23:
- lbtutorial.Text = "The higher the Antivirus' grade, the bigger this area of effect becomes. However, it will always only be able to heal modules to 10 HP.";
- break;
- case 24:
- lbtutorial.Text = "A Turret has been added to the list of buyable modules. Go pick one up!";
- btnnext.Hide();
- BuyableModules.Clear();
- BuyableModules.Add(new FutureModule("Turret", 0, "It's not super-effective, but the Turret will blast through any Grade 1 defenses pretty quickly. The higher the grade, the higher the strength.", SystemType.Turret));
- break;
- case 25:
- lbtutorial.Text = "Turrets can fire damaging viruses at their targets. Go ahead and place your Turret somewhere within the Antivirus's Area of Effect.";
- break;
- case 26:
- lbtutorial.Text = "Notice how the Turret only has 10 HP, just like the Antivirus?";
- btnnext.Show();
- break;
- case 27:
- lbtutorial.Text = "This is because both the Antivirus and Turret are at Grade 1. There are four grades of modules you can get, and you can easily upgrade by selecting a module and choosing [Upgrade This Module].";
- break;
- case 28:
- lbtutorial.Text = "Upgrading a module will increase it's max HP. Grade 1 is 10 HP, Grade 2 is 20 HP, Grade 3 is 40 HP, and Grade 4 is 80 HP.";
- break;
- case 29:
- lbtutorial.Text = "Some modules will have a higher attack rate based on their grade. Others may throw more damaging attacks, and any module's Area of Effect (if it has one) will grow.";
- break;
- case 30:
- lbtutorial.Text = "Another tip: Multiple modules can target the same module, and a module can have multiple targets. This means that you can have your Core and your Turret both attack the enemy Core.";
- break;
- case 31:
- lbtutorial.Text = "Some modules do not work on a target-based system. Some may work using an area-of-effect system (like an Antivirus), and some may target the entire enemy network.";
- break;
- case 32:
- pnltutorial.Left = this.Width - pnltutorial.Width;
- pnltutorial.Top = this.Height - flcontrols.Height - pnltutorial.Height;
- lbtutorial.Text = "We have reset both your Cores' health. Go ahead and finish off the enemy Core using your newfound skills.";
- ThisPlayerPC.HP = 100;
- ThisEnemyPC.HP = 100;
- btnnext.Hide();
- BuyableModules = new List();
- BuyableModules.Add(new FutureModule("Antivirus", 0, "This module will heal any other module within it's area of effect to 10 HP. Higher grades can improve it's area of effect.", SystemType.Antivirus));
- BuyableModules.Add(new FutureModule("Turret", 0, "It's not super-effective, but the Turret will blast through any Grade 1 defenses pretty quickly. The higher the grade, the higher the strength.", SystemType.Turret));
- break;
- default:
- btnnext.Show();
- lbtutorial.Text = "This concludes the Hacker Battle tutorial. Happy hunting, soldier. Just kidding. Stay safe.";
- btnnext.Text = "Close";
- break;
- }
- }
-
- private void btnnext_Click(object sender, EventArgs e)
- {
- if (btnnext.Text == "Close")
- {
- UserRequestedClose = false;
- this.Close();
- }
- SetupTutorialUI(TutorialProgress + 1);
- }
-
- #endregion
-
- private void HackUI_Load(object sender, EventArgs e)
- {
- this.TopMost = false;
- Audio.Stopped += (o, a) =>
- {
- if (this != null)
- {
- Audio.Play("hackerbattle_ambient");
- }
- };
- Audio.Play("hackerbattle_ambient");
-
- Hacking.RepairTimer.Stop(); //Don't want the player to be able to repair dead modules during a battle!
- this.WindowState = FormWindowState.Maximized;
- LoadPlayerScreen();
- if (InOnlineBattle)
- LoadOnlineEnemy();
- else
- LoadEnemyScreen();
- tmrvisualizer.Interval = 10;
- tmrvisualizer.Start();
- }
-
- #region ENEMY
- private EnemyHacker ThisEnemyHacker { get; set; }
- public List AllEnemyComputers = null;
- public Computer ThisEnemyPC { get; set; }
- private void LoadEnemyScreen()
- {
- AllEnemyComputers = new List();
- VisualizeEnemyNetwork();
- tmrenemyhealthdetect.Start();
- ThisEnemyPC.Enemy = !InOnlineBattle;
- }
-
- private void VisualizeEnemyNetwork()
- {
- var rnd = new Random();
- foreach (Module m in ThisEnemyHacker.Network)
- {
- m.HP = m.GetTotalHP();
- var c = m.Deploy();
- if (c.Type == SystemType.Core)
- {
- ThisEnemyPC = c;
- ThisEnemyPC.EnemyComputer = ThisPlayerPC;
- ThisPlayerPC.EnemyComputer = ThisEnemyPC;
- }
- AddEnemyModule(c);
- c.Location = new Point(m.X, m.Y);
- }
- }
-
- public void Enemy_System_Attacking(object s, EventArgs a)
- {
- if (!InOnlineBattle)
- {
- int i = new Random().Next(AllPlayerComputers.Count);
- var pc = AllPlayerComputers[i];
- var se = (Computer)s;
- pc.LaunchAttack(se.GetProperType());
- }
- }
-
- public Computer SelectedEnemyComputer = null;
-
- public void AddEnemyModule(Computer newModule)
- {
- if(newModule.Type == SystemType.Core)
- {
- newModule.Left = (pnlenemy.Width - newModule.Width) / 2;
- newModule.Top = (pnlenemy.Height - newModule.Height) / 2;
- }
- var rnd = new Random();
- pnlenemy.Controls.Add(newModule);
- foreach (var pc in AllEnemyComputers)
- {
- while (newModule.Bounds.IntersectsWith(pc.Bounds))
- {
- newModule.Location = new Point(rnd.Next(100, 350), rnd.Next(100, 350));
- }
- }
- AllEnemyComputers.Add(newModule);
- int hp = newModule.HP;
- TotalEnemyHP += (decimal)newModule.HP;
- newModule.Show();
-
- newModule.StolenModule += (o, a) =>
- {
- var t = new Thread(new ThreadStart(() =>
- {
- var lst = new List();
- if (!newModule.Enslaved)
- lst = AllPlayerComputers;
- else
- lst = AllEnemyComputers;
- WriteLine_Enemy($"[{newModule.Hostname}] Starting network hack...");
- Thread.Sleep(5000);
-
- var pc = lst[rnd.Next(0, lst.Count)];
- this.Invoke(new Action(() =>
- {
- if (pc.Type != SystemType.Core)
- {
- module_to_steal = pc;
-
- pgpong.Left = (this.Width - pgpong.Width) / 2;
- pgpong.Top = (this.Height - pgpong.Height) / 2;
-
- pgpong.Show();
- newgame();
- }
- }));
- }));
- t.Start();
- };
- newModule.EnslavedModule += (o, e) =>
- {
- if (!newModule.Enslaved)
- {
- var pc = AllPlayerComputers[rand.Next(0, AllPlayerComputers.Count)];
- if (!pc.Enslaved)
- {
- WriteLine_Enemy($"[{newModule.Hostname}] Successfully enslaved {pc.Hostname}");
- pc.Enslaved = true;
- }
-
- }
- };
- newModule.OnDestruction += (object s, EventArgs a) =>
- {
- if (this.SelectedEnemyComputer == newModule)
- {
- SelectedEnemyComputer = null;
- }
- WriteLine_Enemy($"[Network] {newModule.Hostname} has gone OFFLINE.");
- AllEnemyComputers.Remove(newModule);
- newModule.Dispose();
- };
- newModule.Select += (object s, EventArgs a) =>
- {
- bool c = true;
- foreach (var pc in SelectedPlayerComputer.Enemies)
- {
- if (pc.Hostname == newModule.Hostname)
- {
- c = false;
- }
- }
- if (c == true)
- {
- SelectedPlayerComputer.Enemies.Add(newModule);
- ShowPCInfo(SelectedPlayerComputer.Hostname);
- if (IsTutorial)
- {
- if (TutorialProgress == 9)
- {
- SetupTutorialUI(10);
- }
- }
- WriteLine_Enemy("[Network] WARNING! Rival system has targeted a system on this network!");
- WriteLine($"[Network] System \"{SelectedPlayerComputer.Hostname}\" is now targeting rival system \"{newModule.Hostname}\".");
- }
- };
- newModule.HP_Decreased += new EventHandler(Enemy_System_Damaged);
- newModule.OnRepair += new EventHandler(Enemy_System_Repaired);
- if (newModule.Type == SystemType.Antivirus)
- {
- var b = newModule.GetAreaOfEffect();
- newModule.AntivirusRepair += (object s, EventArgs a) =>
- {
- foreach (Computer pc in AllEnemyComputers)
- {
- if (pc != newModule && pc.Bounds.IntersectsWith(b))
- {
- if (newModule.Type == SystemType.RepairModule)
- {
- if (pc.HP < newModule.HP)
- {
- if (pc.HP < pc.GetTotal())
- {
- WriteLine_Enemy($"[{newModule.Hostname}] Repairing neighbouring system \"{pc.Hostname}\"...");
- pc.Repair(1);
- }
- }
-
- }
- else
- {
- if (pc.HP < 10)
- {
- pc.Repair(1);
- }
- }
- }
- }
- };
- }
- if (newModule.Type == SystemType.Firewall)
- {
- pnlenemy.Refresh();
- Enemy_Firewall_Deflect(newModule);
- }
- if (newModule.Type == SystemType.ServerStack)
- {
- newModule.MassDDoS += (object s, EventArgs a) =>
- {
- if (newModule.Enslaved)
- WormToEnemy();
- else
- WormToPlayer();
- };
- }
- newModule.Enemy = !InOnlineBattle;
- }
-
- public void Enemy_Firewall_Deflect(Computer fwall)
- {
- //Safeguard... also apparently I can't spell... because this used to be 'Safegaurd'...
- if (fwall.Enslaved == false && fwall.Type == SystemType.Firewall)
- {
- var r = fwall.GetAreaOfEffect();
- foreach (var pc in AllEnemyComputers)
- {
- if (pc != fwall)
- {
- if (pc.Bounds.IntersectsWith(r))
- {
- pc.DamageDefector = fwall.Grade;
- }
- }
- }
- }
- }
-
- public void Enemy_Firewall_Destroy(Computer fwall)
- {
- //Safegaurd...
- if (fwall.Type == SystemType.Firewall)
- {
- var r = fwall.GetAreaOfEffect();
- foreach (var pc in AllEnemyComputers)
- {
- if (pc.Bounds.IntersectsWith(r))
- {
- pc.DamageDefector = 1;
- UpdateEnemyFirewalls();
- }
- }
- }
- }
-
- public void UpdateEnemyFirewalls()
- {
- foreach (var pc in AllEnemyComputers)
- {
- if (pc.Type == SystemType.Firewall)
- {
- Enemy_Firewall_Deflect(pc);
- }
- }
- }
-
-
- private void Enemy_System_Repaired(object s, EventArgs e)
- {
- var c = (Computer)s;
- WriteLine_Enemy($"[{c.Hostname}] System repaired.");
- lbenemycompromised.Text = "System regenerating...";
- int location = c.Left - (lbenemycompromised.Width / 4);
- int y = c.Top - 25;
- lbenemycompromised.Location = new Point(location, y);
- lbenemycompromised.Show();
- c.Flash(lbenemycompromised);
- _playerTransmitter?.send_message(Online.Hacking.NetTransmitter.Messages.SetHealth, $"{c.Hostname} {c.HP}");
- }
-
-
- private void Enemy_System_Damaged(object s, EventArgs e)
- {
- var c = (Computer)s;
- WriteLine_Enemy($"[{c.Hostname}] System damaged. Current HP: {c.HP}");
- WriteLine($"[Network] Damaged system on rival network with hostname \"{c.Hostname}\"");
- lbenemycompromised.Text = "System damaged!";
- int location = c.Left - (lbenemycompromised.Width / 4);
- int y = c.Top - 25;
- lbenemycompromised.Location = new Point(location, y);
- lbenemycompromised.Show();
- c.Flash(lbenemycompromised);
- _playerTransmitter?.send_message(Online.Hacking.NetTransmitter.Messages.SetHealth, $"{c.Hostname} {c.HP}");
- }
-
- private decimal TotalEnemyHP = 0;
-
- private void tmrenemyhealthdetect_Tick(object sender, EventArgs e)
- {
- lbsong.Visible = true;
- btntogglemusic.Visible = true;
-
- lbsong.Text = Audio.Name + " @ " + Audio.CurrentPosition;
-
- decimal health = 0;
- lbcodepoints.Text = $"Codepoints: {API.Codepoints}";
- var rnd = new Random();
- int chance = 0;
- if (!InOnlineBattle)
- {
- foreach (var pc in AllEnemyComputers)
- {
- if (pc.Disabled == false)
- {
- var elist = new List();
- if (pc.Enslaved)
- elist = AllEnemyComputers;
- else
- elist = AllPlayerComputers;
- foreach (var enemy in elist)
- {
- chance = rnd.Next(1, 20);
- if (chance == 10)
- {
- if (IsTutorial)
- {
- if (TutorialProgress == 9)
- {
- ThisPlayerPC.LaunchAttack(pc.GetProperType(), pc.GetDamageRate());
- }
- else if (TutorialProgress == 32)
- {
- enemy.LaunchAttack(pc.GetProperType(), pc.GetDamageRate());
- }
- else
- {
- enemy.Enemies.Clear();
- }
- }
- else
- {
- enemy.LaunchAttack(pc.GetProperType(), pc.GetDamageRate());
- }
- }
- }
- }
- }
- }
- foreach (var pc in AllEnemyComputers)
- {
- health += (decimal)pc.HP;
- }
- try
- {
- decimal percent = (health / TotalEnemyHP) * 100;
- lbenemystats.Text = $"Enemy Health: {percent}%";
- if (ThisEnemyPC.HP <= 0)
- {
- if (IsTutorial)
- {
- SetupTutorialUI(33);
- }
- else
- {
- string message = "You have successfully beaten the enemy hacker.";
- if (ThisEnemyHacker.IsLeader == false)
- {
- switch(rnd.Next(0, 6))
- {
- case 1:
- API.AddCodepoints(1000);
- message = "You have beaten the enemy. You have earned some precious Codepoints for your effort!";
- break;
- case 2:
- message = "You have beaten the enemy. As a reward, all Shiftorium Upgrades cost half-price.";
- Hacking.GiveHack(Hack.PriceDrop);
- break;
- case 3:
- message = "You have beaten the enemy. As a reward, applications will now pay out more Codepoints than usual.";
- Hacking.GiveHack(Hack.PayoutIncrease);
- break;
- case 4:
- message = "The enemy has recognized your skill and has decided to become a friend. You can now hire them for free as a partner during a system hack.";
- //befriend the enemy.
- var skill = ThisEnemyHacker.FriendSkill;
- var speed = ThisEnemyHacker.FriendSpeed;
- var desc = ThisEnemyHacker.FriendDesc;
- var name = ThisEnemyHacker.Name;
- Hacking.AddCharacter(new Character(name, desc, skill, speed, 0));
- break;
- case 5:
- var cats = SaveSystem.ShiftoriumRegistry.GetCategories(false);
- string cat = cats[rnd.Next(0, cats.Count - 1)];
- if (API.Upgrades[cat] == false)
- {
- API.Upgrades[cat] = true;
- message = $"You have beaten the enemy, and as a result, the {cat.ToUpper()} Shiftorium category has been unlocked.";
- }
- break;
- default:
- message = "You have successfully beaten the enemy hacker.";
- break;
- }
- }
- API.CreateInfoboxSession("You won.", message, infobox.InfoboxMode.Info);
-
- UserRequestedClose = false;
- var h = OnWin;
- if(h != null)
- {
- h(this, new EventArgs());
- }
- this.Close();
- }
- }
- }
- catch
- {
-
- }
- }
-
- public void WormToPlayer()
- {
- var rnd = new Random();
- int r = rnd.Next(0, 10);
- WriteLine_Enemy("[NETWORK] Launching distributed denial-of-service attack on rival network...");
- foreach (Computer c in AllPlayerComputers)
- {
- if (r == 5)
- {
- c.Disable();
- }
- }
- }
-
- public void WriteLine_Enemy(string text)
- {
- try
- {
- if (txtenemyconsole.Text.Length == 0)
- {
- txtenemyconsole.Text = text + Environment.NewLine;
- }
- else
- {
- txtenemyconsole.Text += text + Environment.NewLine;
- }
- txtenemyconsole.Select(txtenemyconsole.TextLength, 0);
- txtenemyconsole.ScrollToCaret();
- }
- catch
- {
- this.Invoke(new Action(() => { WriteLine_Enemy(text); }));
- }
- }
-
- public void WriteLine(string text)
- {
- try
- {
- if (txtyourconsole.Text.Length == 0)
- {
- txtyourconsole.Text = text + Environment.NewLine;
- }
- else
- {
- txtyourconsole.Text += text + Environment.NewLine;
- }
- txtyourconsole.Select(txtyourconsole.TextLength, 0);
- txtyourconsole.ScrollToCaret();
- }
- catch
- {
- this.Invoke(new Action(() => { WriteLine(text); }));
- }
- }
-
- #endregion
-
- #region ONLINE ENEMY
-
- public void LoadOnlineEnemy()
- {
- AllEnemyComputers = new List();
- tmrenemyhealthdetect.Start();
- //register event handlers
- receiver.ModuleHealthSet += Receiver_ModuleHealthSet;
- receiver.ModulePlaced += Receiver_ModulePlaced;
- receiver.ModuleUpgraded += Receiver_ModuleUpgraded;
- receiver.ModuleRemoved += Receiver_ModuleRemoved;
- receiver.ModuleDisabled += (o, e) =>
- {
- foreach(var c in AllEnemyComputers)
- {
- if(c.Hostname == e.hostName)
- {
- c.Disable();
- }
- }
- };
- receiver.Won += (o, e) =>
- {
- //the enemy won!
- tmrplayerhealthdetect.Stop();
- tmrenemyhealthdetect.Stop();
- //dispose all the modules.
- while(AllPlayerComputers.Count > 0)
- {
- AllPlayerComputers[0].Dispose();
- AllPlayerComputers.RemoveAt(0);
- }
- while (AllEnemyComputers.Count > 0)
- {
- AllEnemyComputers[0].Dispose();
- AllEnemyComputers.RemoveAt(0);
- }
- //Destroy server connection.
- Online.Hacking.Matchmaker.DestroySession();
- //Display win message.
- API.CreateInfoboxSession($"{e.Winner.Name} won.", $"{e.Winner.Name} has overthrown your defenses and compromised your system.", infobox.InfoboxMode.Info);
- //Kill the hacker UI.
- UserRequestedClose = false;
- this.Close();
- };
- }
-
- private void Receiver_ModuleRemoved(object sender, Online.Hacking.Events.ModuleRemoved e)
- {
- Computer c = null;
- foreach(var m in AllEnemyComputers)
- {
- if(m.Hostname == e.new_module)
- {
- c = m;
- }
- }
- AllEnemyComputers.Remove(c);
- c.Dispose();
- }
-
- private void Receiver_ModuleUpgraded(object sender, Online.Hacking.Events.ModuleUpgraded e)
- {
- foreach(var m in AllEnemyComputers)
- {
- if (m.Hostname == e.hostname)
- m.Grade = e.grade;
- }
- }
-
- private void Receiver_ModulePlaced(object sender, Online.Hacking.Events.ModulePlaced e)
- {
- var newModule = new Module((SystemType)e.new_module.Type, e.new_module.Grade, e.new_module.Hostname);
- newModule.HP = e.new_module.HP;
- newModule.X = e.new_module.X;
- newModule.Y = e.new_module.Y;
- AddEnemyModule(newModule.Deploy());
- }
-
- private void Receiver_ModuleHealthSet(object sender, Online.Hacking.Events.Health e)
- {
- var mod = new Computer();
- foreach(var m in AllEnemyComputers)
- {
- if (m.Hostname == e.host_name)
- mod = m;
- }
- int old_hp = mod.HP;
- mod.HP = e.health;
- if(mod.HP > old_hp)
- {
- mod.throw_repaired();
- }
- else
- {
- mod.throw_damaged();
- }
- }
-
- #endregion
-
- bool playing = true;
-
- private void button2_Click(object sender, EventArgs e)
- {
- if (playing == true)
- {
- Audio.ForceStop();
- }
- else
- {
- Audio.Play("hackerbattle_ambient");
- }
- playing = !playing;
- }
-
- Panel winningPlayfield = null;
-
- int bgcol = 0;
- int pulse = 0;
- Panel losingPlayfield = null;
- private void tmrvisualizer_Tick(object sender, EventArgs e)
- {
- int enemy_hp = 0;
- int player_hp = 0;
- foreach(var p in AllPlayerComputers)
- {
- player_hp += p.HP;
- }
- foreach (var p in AllEnemyComputers)
- {
- enemy_hp += p.HP;
- }
-
- if (player_hp >= enemy_hp)
- {
- winningPlayfield = pnlyou;
- losingPlayfield = pnlenemy;
- }
- else
- {
- winningPlayfield = pnlenemy;
- losingPlayfield = pnlyou;
- }
-
- losingPlayfield.BackColor = Color.Black;
-
-
- try
- {
- var visualizer = Audio.GetVisualizer();
- switch(visualizer.type)
- {
- case VisualizerType.Pulse:
- tmrvisualizer.Interval = 1;
- if(pulse == 0)
- {
- if(bgcol < 255)
- {
- bgcol += 10;
- }
- else
- {
- pulse = 1;
- }
- }
- else
- {
- if(bgcol > 0)
- {
- bgcol -= 10;
- }
- else
- {
- pulse = 0;
- }
- }
- break;
- case VisualizerType.CalmDown:
- bgcol = 255 - MathEx.LinearInterpolate(visualizer.startTime * 100, visualizer.endTime * 100, Audio.CurrentPositionMS, 0, 255);
- break;
- case VisualizerType.BuildUp:
- bgcol = MathEx.LinearInterpolate(visualizer.startTime, visualizer.endTime, Audio.CurrentPosition, 0, 255);
- break;
- }
- Color c = new Color();
- int r = 0;
- int g = 0;
- int b = 0;
- if (visualizer.R)
- r = bgcol;
- if (visualizer.G)
- g = bgcol;
- if (visualizer.B)
- b = bgcol;
- c = Color.FromArgb(r, g, b);
- if(playing)
- winningPlayfield.BackColor = c;
- }
- catch
- {
-
- }
- }
-
- private void pongMain_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
- {
- paddleHuman.Location = new Point(paddleHuman.Location.X, (MousePosition.Y - pgpong.Location.Y) - (paddleHuman.Height / 2));
- }
-
-
- private void pongGameTimer_Tick(object sender, EventArgs e)
- {
- //Set the computer player to move according to the ball's position.
- if (ball.Location.X > 500 - xVel * 10 && xVel > 0)
- {
- if (ball.Location.Y > paddleComputer.Location.Y + 50)
- {
- paddleComputer.Location = new Point(paddleComputer.Location.X, paddleComputer.Location.Y + computerspeed * 2 + ((int)yveldec / 2));
- }
- if (ball.Location.Y < paddleComputer.Location.Y + 50)
- {
- paddleComputer.Location = new Point(paddleComputer.Location.X, paddleComputer.Location.Y - computerspeed * 2 + ((int)yveldec / 2));
- }
- casualposition = rand.Next(-150, 201);
- }
-
- //Set Xvel and Yvel speeds from decimal
- if (xVel > 0)
- xVel = (int)Math.Round(xveldec);
- if (xVel < 0)
- xVel = (int)-Math.Round(xveldec);
- if (yVel > 0)
- yVel = (int)Math.Round(yveldec);
- if (yVel < 0)
- yVel = (int)-Math.Round(yveldec);
-
- // Move the game ball.
- ball.Location = new Point(ball.Location.X + xVel, ball.Location.Y + yVel);
-
- // Check for top wall.
- if (ball.Location.Y < 0)
- {
- ball.Location = new Point(ball.Location.X, 0);
- yVel = -yVel;
- }
-
- // Check for bottom wall.
- if (ball.Location.Y > pgpong.Height - ball.Height)
- {
- ball.Location = new Point(ball.Location.X, pgpong.Height - ball.Size.Height);
- yVel = -yVel;
- }
-
- // Check for player paddle.
- if (ball.Bounds.IntersectsWith(paddleHuman.Bounds))
- {
- ball.Location = new Point(paddleHuman.Location.X + ball.Size.Width, ball.Location.Y);
- //randomly increase x or y speed of ball
- switch (rand.Next(1, 3))
- {
- case 1:
- xveldec = xveldec + incrementx;
- break;
- case 2:
- if (yveldec > 0)
- yveldec = yveldec + incrementy;
- if (yveldec < 0)
- yveldec = yveldec - incrementy;
- break;
- }
- xVel = -xVel;
- }
-
- // Check for computer paddle.
- if (ball.Bounds.IntersectsWith(paddleComputer.Bounds))
- {
- ball.Location = new Point(paddleComputer.Location.X - paddleComputer.Size.Width + 1, ball.Location.Y);
- xveldec = xveldec + incrementx;
- xVel = -xVel;
- }
-
- // Check for left wall.
- if (ball.Location.X < -100)
- {
- var m = module_to_steal;
- if (m.Enemy)
- AllEnemyComputers.Remove(m);
-
- var lst = new List();
- if (!m.Enemy)
- lst = MyNetwork;
- else
- lst = ThisEnemyHacker.Network;
-
- string hn = m.Hostname;
-
- Module mod = null;
- foreach(var pc in lst)
- {
- if(pc.Hostname == hn)
- {
- mod = pc;
- }
- }
-
- if (!AllPlayerComputers.Contains(m))
- AddModule(mod.Deploy());
-
- if(!Hacking.MyNetwork.Contains(mod))
- {
- Hacking.MyNetwork.Add(mod);
- }
-
- if(module_to_steal.Parent != pnlyou)
- {
- module_to_steal.Parent.Controls.Remove(module_to_steal);
- module_to_steal.Dispose();
- }
- tmrcountdown.Stop();
- pongGameTimer.Stop();
- counter.Stop();
- pgpong.Hide();
- }
-
- // Check for right wall.
- if (ball.Location.X > pgpong.Width - ball.Size.Width - paddleComputer.Width + 100)
- {
- var m = module_to_steal;
- if (!m.Enemy)
- AllPlayerComputers.Remove(m);
-
- var lst = new List();
- if (!m.Enemy)
- lst = MyNetwork;
- else
- lst = ThisEnemyHacker.Network;
-
- string hn = m.Hostname;
-
- Module mod = null;
- foreach (var pc in lst)
- {
- if (pc.Hostname == hn)
- {
- mod = pc;
- }
- }
-
- if (!AllEnemyComputers.Contains(m))
- AddEnemyModule(mod.Deploy());
-
- if (!ThisEnemyHacker.Network.Contains(mod))
- {
- ThisEnemyHacker.Network.Add(mod);
- }
-
- if (module_to_steal.Parent != pnlenemy)
- {
- module_to_steal.Parent.Controls.Remove(module_to_steal);
- module_to_steal.Dispose();
- }
- tmrcountdown.Stop();
- pongGameTimer.Stop();
- counter.Stop();
- pgpong.Hide();
- }
-
- //lblstats.Text = "Xspeed: " & Math.Abs(xVel) & " Yspeed: " & Math.Abs(yVel) & " Human Location: " & paddleHuman.Location.ToString & " Computer Location: " & paddleComputer.Location.ToString & Environment.NewLine & " Ball Location: " & ball.Location.ToString & " Xdec: " & xveldec & " Ydec: " & yveldec & " Xinc: " & incrementx & " Yinc: " & incrementy
- lblstatsX.Text = "Xspeed: " + xveldec;
- lblstatsY.Text = "Yspeed: " + yveldec;
-
- lbllevelandtime.Text = "Level: " + level;
-
- if (xVel > 20 || xVel < -20)
- {
- paddleHuman.Width = Math.Abs(xVel);
- paddleComputer.Width = Math.Abs(xVel);
- }
- else
- {
- paddleHuman.Width = 20;
- paddleComputer.Width = 20;
- }
-
- computerspeed = Math.Abs(yVel);
-
- // pgcontents.Refresh()
- // pgcontents.CreateGraphics.FillRectangle(Brushes.Black, ball.Location.X, ball.Location.Y, ball.Width, ball.Height)
-
- }
-
- #region pong visualizer variables
-
- Random rand = new Random();
- int xVel = 7;
- int yVel = 8;
- int computerspeed = 8;
- int level = 1;
- int secondsleft = 60;
- int casualposition;
- double xveldec = 3.0;
- double yveldec = 3.0;
- double incrementx = 0.4;
- double incrementy = 0.2;
- int levelxspeed = 3;
- int levelyspeed = 3;
- int[] levelrewards = new int[50];
- int countdown = 3;
-
- #endregion
-
- private void counter_Tick(object sender, EventArgs e)
- {
- secondsleft = secondsleft - 1;
- if (secondsleft == -1)
- {
- secondsleft = 60;
- level = level + 1;
- }
- }
-
- private void tmrcountdown_Tick(object sender, EventArgs e)
- {
- switch (countdown)
- {
- case 0:
- countdown = 3;
- lblcountdown.Hide();
- pongGameTimer.Start();
- counter.Start();
- tmrcountdown.Stop();
- break;
- case 1:
- lblcountdown.Text = "1";
- countdown = countdown - 1;
- break;
- case 2:
- lblcountdown.Text = "2";
- countdown = countdown - 1;
- break;
- case 3:
- lblcountdown.Text = "3";
- countdown = countdown - 1;
- lblcountdown.Show();
- break;
- }
-
- }
-
- private void newgame()
- {
- level = 1;
- secondsleft = 60;
- //reset stats text
- lblstatsX.Text = "Xspeed: ";
- lblstatsY.Text = "Yspeed: ";
-
- levelxspeed = 3;
- levelyspeed = 3;
-
- incrementx = 0.4;
- incrementy = 0.2;
-
- xveldec = levelxspeed;
- yveldec = levelyspeed;
-
- tmrcountdown.Start();
- if (xVel < 0)
- xVel = Math.Abs(xVel);
- lbllevelandtime.Text = "Level: " + level + " - " + secondsleft + " Seconds Left";
- }
- }
-}
-
-namespace System
-{
- public class MathEx
- {
- public static int LinearInterpolate(int input_start, int input_end, int input, int output_start, int output_end)
- {
- int input_range = input_end - input_start;
- int output_range = output_end - output_start;
-
- return (input - input_start) * output_range / input_range + output_start;
- }
- }
-}
diff --git a/source/WindowsFormsApplication1/Gameplay/HackUI.resx b/source/WindowsFormsApplication1/Gameplay/HackUI.resx
deleted file mode 100644
index 9def72b..0000000
--- a/source/WindowsFormsApplication1/Gameplay/HackUI.resx
+++ /dev/null
@@ -1,177 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- When you press 'Done', simply click where you'd like to place the new module. You can right-click the playing field to cancel the deployment.
-
-Some modules have a range of effect. For example, an Antivirus will only heal modules within it's area of effect and only if their HP is below 10. This can be upgraded.
-
-To upgrade a module, simply right-click it on the playing field and choose 'Upgrade this module'.
-
-If you would like to buy a new module, click 'Buy new module'.
-
-
- When you press 'Done', simply click where you'd like to place the new module. You can right-click the playing field to cancel the deployment.
-
-Some modules have a range of effect. For example, an Antivirus will only heal modules within it's area of effect and only if their HP is below 10. This can be upgraded.
-
-To upgrade a module, simply right-click it on the playing field and choose 'Upgrade this module'.
-
-If you would like to buy a new module, click 'Buy new module'.
-
-
- When you press 'Done', simply click where you'd like to place the new module. You can right-click the playing field to cancel the deployment.
-
-Some modules have a range of effect. For example, an Antivirus will only heal modules within it's area of effect and only if their HP is below 10. This can be upgraded.
-
-To upgrade a module, simply right-click it on the playing field and choose 'Upgrade this module'.
-
-If you would like to buy a new module, click 'Buy new module'.
-
-
- When you press 'Done', simply click where you'd like to place the new module. You can right-click the playing field to cancel the deployment.
-
-Some modules have a range of effect. For example, an Antivirus will only heal modules within it's area of effect and only if their HP is below 10. This can be upgraded.
-
-To upgrade a module, simply right-click it on the playing field and choose 'Upgrade this module'.
-
-If you would like to buy a new module, click 'Buy new module'.
-
-
- 17, 17
-
-
- 63, 42
-
-
- 191, 17
-
-
- 238, 42
-
-
- 358, 42
-
-
- 501, 42
-
-
- 594, 42
-
-
\ No newline at end of file
diff --git a/source/WindowsFormsApplication1/Gameplay/Hacking.cs b/source/WindowsFormsApplication1/Gameplay/Hacking.cs
deleted file mode 100644
index 23c382d..0000000
--- a/source/WindowsFormsApplication1/Gameplay/Hacking.cs
+++ /dev/null
@@ -1,810 +0,0 @@
-using Newtonsoft.Json;
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace ShiftOS
-{
- ///
- /// Hacker battles and stuff like that.
- ///
- public class Hacking
- {
- public static List Characters = new List();
- public static List Tools = new List();
- public static List EnemyHackers = new List();
- public static List MyNetwork = new List();
- public static bool Failure = false;
- public static DateTime FailDate = DateTime.Now;
- internal static string HackerBattleAward = null;
- public static Timer RepairTimer = null;
-
- public static Module MyCore
- {
- get
- {
- var m = new Module(SystemType.Core, 1, "invalid");
- foreach(var mod in MyNetwork)
- {
- if(mod.Hostname == "localhost")
- {
- m = mod;
- }
- }
- return m;
- }
- }
-
- ///
- /// Gives a shiftorium upgrade for free.
- ///
- /// Upgrade ID.
- public static void GiveUpgrade(string id)
- {
- API.Upgrades[id] = true;
- }
-
- ///
- /// Increases skill of a character.
- ///
- /// The character ID.
- public static void IncreaseSkill(int cid)
- {
- var rnd = new Random();
- int newspeed = rnd.Next(0, 5);
- int newskill = rnd.Next(0, 10);
- Characters[cid].Speed += newspeed;
- Characters[cid].Skill += newskill;
- SaveCharacters();
- API.CreateInfoboxSession("Hack complete.", $"{Characters[cid].Name} has successfully completed their hack. {Characters[cid].Name} has gained {newspeed} Speed Points, and {newskill} Skill Points.", infobox.InfoboxMode.Info);
- }
-
- ///
- /// Applies a hack.
- ///
- /// Type of hack to apply.
- public static void GiveHack(Hack hack)
- {
- switch (hack)
- {
- case Hack.PayoutIncrease:
- API.CurrentSave.CodepointMultiplier += 1;
- break;
- case Hack.PriceDrop:
- API.CurrentSave.PriceDivider += 1;
- break;
- }
- }
-
- ///
- /// Add a new character.
- ///
- /// The new character.
- public static void AddCharacter(Character ch)
- {
- bool c = true;
- foreach(var character in Characters)
- {
- if(character.Name == ch.Name)
- {
- c = false;
- }
- }
- if(c == true)
- {
- Characters.Add(ch);
- SaveCharacters();
- }
- }
-
- ///
- /// Adds a new hacking tool.
- ///
- /// The hacking tool.
- public static void AddTool(HackTool ch)
- {
- if (!Tools.Contains(ch))
- {
- Tools.Add(ch);
- }
- }
-
- ///
- /// Returns a random hack type.
- ///
- /// The hack type.
- public static Hack GetRandomHack()
- {
- var t = new List(Enum.GetValues(typeof(Hack)).Cast());
- var rnd = new Random();
- return t[rnd.Next(0, t.Count - 1)];
- }
-
- ///
- /// Start a hack with a character.
- ///
- /// Character to hire.
- /// Type of hack to pull off.
- public static void StartHackWithCharacter(int cid, Hack hack)
- {
- var h = Characters[cid];
- var f = new Form();
- f.BackColor = Color.Black;
- f.ForeColor = Color.White;
- f.Font = new Font(OSInfo.GetMonospaceFont(), 9);
- var l = new Label();
- int p = 0;
- int speed = 10000 / h.Speed; //If a hacker has a speed of one, it will take 10,000 milliseconds to move 1% in the hack progress. Divide it by a thousand, you get 1,000 seconds.
- var t = new Timer();
- t.Interval = speed;
- f.FormBorderStyle = FormBorderStyle.None;
- f.Show();
- switch (API.CurrentSkin.desktoppanelposition)
- {
- case "Top":
- f.Location = new Point(5, API.CurrentSkin.desktoppanelheight + 5);
- break;
- case "Bottom":
- f.Location = new Point(5, 5);
- break;
- }
-
- f.Controls.Add(l);
- l.Show();
- l.TextAlign = ContentAlignment.MiddleCenter;
- f.Height = 25;
- f.TopMost = true;
- l.Text = $"Progress: {p}%";
- l.Dock = DockStyle.Fill;
- t.Tick += (object s, EventArgs a) =>
- {
- if (l.Text != "Hack failed.")
- {
- if (p <= 100)
- {
- l.Text = $"Progress: {p}%";
- int fail = new Random().Next(0, h.Skill * h.Speed);
- if (fail == 1)
- {
- l.Text = "Hack failed.";
- }
- }
- else
- {
- GiveHack(hack);
- f.Close();
- t.Stop();
- IncreaseSkill(cid);
- }
- }
- else
- {
- f.Close();
- t.Stop();
- }
-
- p += 1;
- };
- t.Start();
- }
-
- ///
- /// Hacker Battles: List of modules the user can buy.
- ///
- /// The list that was created by the method. What did you think it would return? A boolean?
- public static List GetFutureModules()
- {
- var lst = new List();
- lst.Add(new FutureModule("Antivirus", 15, "This module will heal any other module within it's area of effect to 10 HP. Higher grades can improve it's area of effect.", SystemType.Antivirus));
- lst.Add(new FutureModule("Enslaver", 75, "The Enslaver is a scary module for an opposing network. At any time, the Enslaver can take over any module on the enemy network and turn it against them.", SystemType.Enslaver));
- lst.Add(new FutureModule("Module Thief", 100, "The Module Thief can hack into the enemy's network and attempt to steal one of their modules and bring them into your network temporarily though. Be careful though, it might not work all the time!", SystemType.ModuleStealer));
- lst.Add(new FutureModule("Dedicated DDoS module", 10, "This module will attempt to disable the enemy network by sending a DDoS attack allowing you to take a breather.", SystemType.DedicatedDDoS));
- lst.Add(new FutureModule("Turret", 5, "It's not super-effective, but the Turret will blast through any Grade 1 defenses pretty quickly. The higher the grade, the higher the strength.", SystemType.Turret));
- lst.Add(new FutureModule("Firewall", 20, "Will decrease the amount of damage taken by any module within it's area of effect. The higher the grade, the bigger the area of effect and more protection it offers.", SystemType.Firewall));
- lst.Add(new FutureModule("Repair Module", 150, "Slowly repairs all modules within the area of effect to the same HP as the repair module.", SystemType.RepairModule));
- lst.Add(new FutureModule("Server Stack", 250, "Capable of sending a worm attack to the entire enemy network, preventing it from attacking until it can recover.", SystemType.ServerStack));
- return lst;
- }
-
- ///
- /// Hire a character to attempt to hack a Shiftorium Upgrade.
- ///
- /// The character.
- /// The upgrade ID.
- public static void StartHackWithCharacter(int cid, string upgrade)
- {
- if (upgrade == "random")
- {
- StartHackWithCharacter(cid, GetRandomHack());
- }
- else {
- var h = Characters[cid];
- var f = new Form();
- f.BackColor = Color.Black;
- f.ForeColor = Color.White;
- f.Font = new Font(OSInfo.GetMonospaceFont(), 9);
- var l = new Label();
- int p = 0;
- int speed = 10000 / h.Speed; //If a hacker has a speed of one, it will take 10,000 milliseconds to move 1% in the hack progress. Divide it by a thousand, you get 1,000 seconds.
- var t = new Timer();
- t.Interval = speed;
- f.FormBorderStyle = FormBorderStyle.None;
- f.Show();
- switch (API.CurrentSkin.desktoppanelposition)
- {
- case "Top":
- f.Location = new Point(5, API.CurrentSkin.desktoppanelheight + 5);
- break;
- case "Bottom":
- f.Location = new Point(5, 5);
- break;
- }
-
- f.Controls.Add(l);
- l.Show();
- l.TextAlign = ContentAlignment.MiddleCenter;
- f.Height = 25;
- f.TopMost = true;
- l.Text = $"Progress: {p}%";
- l.Dock = DockStyle.Fill;
- t.Tick += (object s, EventArgs a) =>
- {
- if (l.Text != "Hack failed.")
- {
- if (p <= 100)
- {
- l.Text = $"Progress: {p}%";
- int fail = new Random().Next(0, h.Skill * h.Speed);
- if (fail == 1)
- {
- l.Text = "Hack failed.";
- }
- }
- else
- {
- GiveUpgrade(upgrade);
- f.Close();
- t.Stop();
- IncreaseSkill(cid);
- }
- }
- else
- {
- f.Close();
- t.Stop();
- }
-
- p += 1;
- };
- t.Start();
- }
- }
-
- ///
- /// Start a hack with a tool.
- ///
- /// Tool ID.
- /// The hack type.
- public static void StartHack(int cid, Hack hack)
- {
- var h = Tools[cid];
- switch (h.Name)
- {
- case "Destabilizer Attack":
- var t = new Timer();
- t.Interval = 100;
- var rnd = new Random();
- t.Tick += (object s, EventArgs a) =>
- {
- int r = rnd.Next(0, 100);
- if (r == 90)
- {
- t.Stop();
-
- API.CreateInfoboxSession("Hack complete.", "The hack has been completed.", infobox.InfoboxMode.Info);
- GiveHack(hack);
- }
- else
- {
- try {
- int p = rnd.Next(0, 10);
- switch (p)
- {
- case 1:
- API.OpenProgram("shiftorium");
- break;
- case 2:
- API.OpenProgram("ki");
- break;
- case 3:
- API.CreateInfoboxSession(API.Encryption.Encrypt("Praise Lord Michael"), API.Encryption.Encrypt("You will bow down to me."), infobox.InfoboxMode.Info);
- break;
- case 4:
- API.PlaySound(Properties.Resources._3beepvirus);
- break;
- case 5:
- API.CurrentSession.BackColor = Color.White;
- break;
- case 6:
- API.CurrentSession.BackColor = Color.Black;
- break;
- case 7:
- API.PlaySound(Properties.Resources.dial_up_modem_02);
- break;
- case 8:
- API.PlaySound(Properties.Resources.writesound);
- break;
- case 9:
- API.PlaySound(Properties.Resources.typesound);
- break;
- }
- }
- catch
- {
- t.Stop();
- var tr = new Terminal();
- tr.Show();
- tr.WindowState = FormWindowState.Maximized;
- tr.txtterm.BackColor = Color.Red;
- tr.Crash();
- }
- }
- };
- t.Start();
-
-
- break;
- }
- }
-
- ///
- /// Start a hack with a tool, to attempt to get an upgrade.
- ///
- /// Tool ID.
- /// Upgrade ID.
- public static void StartHack(int cid, string upgrade)
- {
- if (upgrade == "random")
- {
- StartHack(cid, GetRandomHack());
- }
- else
- {
- if (Tools.Count <= cid)
- {
- API.CreateInfoboxSession("Failed!", "No Hacking Tools Avalible!", infobox.InfoboxMode.Info);
- return;
- }
- else
- {
- HackTool h = Tools[cid];
- switch (h.Name)
- {
- case "Destabilizer Attack":
- var t = new Timer();
- t.Interval = 1000 / h.Effectiveness;
- var rnd = new Random();
- t.Tick += (object s, EventArgs a) =>
- {
- int r = rnd.Next(0, 100);
- if (r == 90)
- {
- t.Stop();
- API.CreateInfoboxSession("Hack complete.", "The hack has been completed.", infobox.InfoboxMode.Info);
- GiveUpgrade(upgrade);
- }
- else
- {
- int p = rnd.Next(0, 10);
- switch (p)
- {
- case 1:
- API.OpenProgram("shiftorium");
- break;
- case 2:
- API.OpenProgram("ki");
- break;
- case 3:
- API.CreateInfoboxSession(API.Encryption.Encrypt("Praise Lord Michael"), API.Encryption.Encrypt("You will bow down to me."), infobox.InfoboxMode.Info);
- break;
- case 4:
- API.PlaySound(Properties.Resources._3beepvirus);
- break;
- case 5:
- API.CurrentSession.BackColor = Color.White;
- break;
- case 6:
- API.CurrentSession.BackColor = Color.Black;
- break;
- case 7:
- API.PlaySound(Properties.Resources.dial_up_modem_02);
- break;
- case 8:
- API.PlaySound(Properties.Resources.writesound);
- break;
- case 9:
- API.PlaySound(Properties.Resources.typesound);
- break;
- }
- }
- };
- t.Start();
-
-
- break;
- }
- }
- }
- }
-
- ///
- /// Initiates the Hacker Battle training simulation.
- ///
- public static void StartBattleTutorial()
- {
- var e = new EnemyHacker("Tutorial", "Tutorial hacker", "Tutorial hacker", 0, 0, "easy");
- var y = new HackUI(e);
- y.IsTutorial = true;
- API.CreateForm(y, "You", Properties.Resources.iconTerminal);
- }
-
- ///
- /// Loads characters and other data from the save file.
- ///
- public static void GetCharacters()
- {
- if (File.Exists(Paths.SystemDir + "_hackers.json"))
- {
- Characters = JsonConvert.DeserializeObject>(API.Encryption.Decrypt(File.ReadAllText(Paths.SystemDir + "_hackers.json")));
- }
- else
- {
- var c = new Character("BinaryFire", "I may not be good, but it's what I like to do. You don't need to pay me.", 25, 10, 0);
- AddCharacter(c);
- File.WriteAllText(Paths.SystemDir + "_hackers.json", API.Encryption.Encrypt(JsonConvert.SerializeObject(Characters)));
- }
- if(File.Exists(Paths.SystemDir + "_hacktools.json"))
- {
- Tools = JsonConvert.DeserializeObject>(API.Encryption.Decrypt(File.ReadAllText(Paths.SystemDir + "_hacktools.json")));
- }
- else
- {
- var c = new HackTool("Destabilizer Attack", 10, "Destabilize ShiftOS by causing it to go beyond what it can do, opening many programs at once, and making it do things it was NEVER intended to do.");
- AddTool(c);
- File.WriteAllText(Paths.SystemDir + "_hacktools.json", API.Encryption.Encrypt(JsonConvert.SerializeObject(Tools)));
-
- }
- if (File.Exists(Paths.SystemDir + "_enemies.json"))
- {
- EnemyHackers = JsonConvert.DeserializeObject>(API.Encryption.Decrypt(File.ReadAllText(Paths.SystemDir + "_enemies.json")));
- }
- else
- {
- var c = new EnemyHacker("Tutorial", "Enter the Tutorial Sequence.", "", 0, 0, "Easy");
- EnemyHackers.Add(c);
- File.WriteAllText(Paths.SystemDir + "enemies.json", API.Encryption.Encrypt(JsonConvert.SerializeObject(EnemyHackers)));
-
- }
- if (File.Exists(Paths.Drivers + "Network.dri"))
- {
- MyNetwork = JsonConvert.DeserializeObject>(API.Encryption.Decrypt(File.ReadAllText(Paths.Drivers + "Network.dri")));
- }
- else
- {
- var c = new Module(SystemType.Core, 1, "localhost");
- c.HP = 100; //bugfix: core not appearing during battle on new save
- c.X = 0;
- c.Y = 0;
- MyNetwork.Add(c);
- File.WriteAllText(Paths.Drivers + "Network.dri", API.Encryption.Encrypt(JsonConvert.SerializeObject(MyNetwork)));
-
- }
- List coresToRemove = new List();
- foreach(var m in MyNetwork)
- {
- if(m.Type == SystemType.Core && m != MyCore)
- {
- coresToRemove.Add(m);
- }
- }
- foreach(var m in coresToRemove)
- {
- MyNetwork.Remove(m);
- }
- RepairTimer = new Timer();
- RepairTimer.Interval = 2000;
- var r = new Random();
- RepairTimer.Tick += (object s, EventArgs a) =>
- {
- var repairable = new List();
- foreach(var mod in MyNetwork)
- {
- if(mod.HP < mod.GetTotalHP())
- {
- repairable.Add(mod);
- }
- }
- int index = r.Next(0, repairable.Count);
- try
- {
- int increase = 1;
- foreach(var mod in MyNetwork)
- {
- if(mod.Type == SystemType.RepairModule)
- {
- increase += mod.HP / 4;
- }
- }
-
- var m = repairable[index];
- while(m.HP + increase > m.GetTotalHP())
- {
- increase -= 1;
- }
- if(m.HP < m.GetTotalHP())
- {
- m.HP += increase;
- }
- }
- catch
- {
-
- }
- };
- RepairTimer.Start();
- }
-
- ///
- /// Saves characters and other data to the save file.
- ///
- public static void SaveCharacters()
- {
- if (MyNetwork == null)
- {
- MyNetwork = new List();
- var c = new Module(SystemType.Core, 1, "localhost");
- c.HP = 100; //bugfix: core not appearing during battle on new save
- c.X = 0;
- c.Y = 0;
- MyNetwork.Add(c);
- }
- File.WriteAllText(Paths.SystemDir + "_hackers.json", API.Encryption.Encrypt(JsonConvert.SerializeObject(Characters)));
- File.WriteAllText(Paths.SystemDir + "_hacktools.json", API.Encryption.Encrypt(JsonConvert.SerializeObject(Tools)));
- File.WriteAllText(Paths.Drivers + "Network.dri", API.Encryption.Encrypt(JsonConvert.SerializeObject(MyNetwork)));
- File.WriteAllText(Paths.SystemDir + "_enemies.json", API.Encryption.Encrypt(JsonConvert.SerializeObject(EnemyHackers)));
-
- }
-
- ///
- /// Tells user about the 'help hacking' command.
- ///
- public static void StartTutorial()
- {
- API.CreateInfoboxSession("Upgrade Category Not Available", "This upgrade category requires more capability from the OS, and is locked. You can type 'help hacking' in the Terminal for more info.", infobox.InfoboxMode.Info);
- }
- }
-
- public class Character
- {
- ///
- /// Creates a new hirable character.
- ///
- /// The name of the character.
- /// The bio of the character.
- /// Starting skill level.
- /// Starting speed level.
- /// Amount of Codepoints required to hire the hacker.
- public Character(string name, string bio, int skill, int speed, int cost)
- {
- Name = name;
- Skill = skill;
- Speed = speed;
- Cost = cost;
- Bio = bio;
- }
-
- public string Name { get; set; }
- public int Speed { get; set; }
- public int Skill { get; set; }
- public int Cost { get; set; }
- public string Bio { get; set; }
- }
-
- public class HackTool
- {
- ///
- /// Creates a new hacking tool.
- ///
- /// Tool name.
- /// Effectiveness level.
- /// Tool description.
- public HackTool(string name, int effectiveness, string description)
- {
- Name = name;
- Effectiveness = effectiveness;
- Description = description;
- }
-
- public string Name { get; set; }
- public int Effectiveness { get; set; }
- public string Description { get; set; }
- }
-
- ///
- /// Enum representing a type of hack.
- ///
- public enum Hack
- {
- PriceDrop,
- PayoutIncrease,
- }
-
- public class Module
- {
- ///
- /// Creates a new module.
- ///
- /// Type of module.
- /// Starting grade level.
- /// Hostname.
- public Module(SystemType t, int grade, string hname)
- {
- Hostname = hname;
- Type = t;
- Grade = grade;
- }
-
- public string Hostname { get; set; }
- public ModuleType ModuleType { get; set; }
- public SystemType Type { get; set; }
- public int HP { get; set; }
- public int Grade { get; set; }
- ///
- /// X position on the virtual network.
- ///
- public int X { get; set; }
- ///
- /// Y position on the virtual network.
- ///
- public int Y { get; set; }
-
- ///
- /// Deploys the module to a Computer control that can actually do things.
- ///
- /// The new computer.
- public Computer Deploy()
- {
- var c = new Computer();
- c.TotalHP = GetTotalHP(); //for proper status display
- c.Hostname = Hostname;
- c.Type = Type;
- c.HP = HP;
- c.Visible = true;
- c.Grade = Grade;
- if(X != 0 && Y != 0)
- {
- c.Location = new Point(X, Y);
- }
- return c;
- }
-
- public int GetTotalHP()
- {
- switch (Type)
- {
- case SystemType.Core:
- return 100;
- default:
- switch (Grade)
- {
- case 1:
- return 10;
- case 2:
- return 20;
- case 3:
- return 40;
- case 4:
- return 80;
- default:
- return 10;
-
- }
- }
- }
- }
-
- ///
- /// Unused...
- ///
- public enum ModuleType
- {
- Offensive,
- Defensive
- }
-
- public class EnemyHacker
- {
- ///
- /// An enemy network.
- ///
- /// Leader or network name.
- /// Network Description
- /// If the leader becomes a friend, what will his bio be?
- /// If the leader becomes a friend, what will his skill be?
- /// If the leader becomes a friend, what will his speed be?
- /// Arbitrary value that means absolutely nothing.
- public EnemyHacker(string name, string description, string fdesc, int fskill, int fspeed, string difficulty)
- {
- Name = name;
- Description = description;
- FriendDesc = fdesc;
- FriendSkill = fskill;
- FriendSpeed = fspeed;
- Difficulty = difficulty;
- Network = new List();
- var m = new Module(SystemType.Core, 1, name.ToLower().Replace(" ", "_"));
- m.X = 0;
- m.Y = 0;
- Network.Add(m); //Hacker will always have a core system.
- }
-
- public bool IsLeader = false;
- public string Name { get; set; }
- public string FriendDesc { get; set; }
- public string Description { get; set; }
- public int FriendSpeed { get; set; }
- public int FriendSkill { get; set; }
- public string Difficulty { get; set; }
- public List Network { get; set; }
-
- ///
- /// Add a new module to this hacker's network.
- ///
- /// The module to add.
- public void AddModule(Module m)
- {
- Network.Add(m);
- }
-
- ///
- /// Befriends the leader.
- ///
- /// How much will it cost to hire him?
- public void Befriend(int cost)
- {
- var c = new Character(Name, FriendDesc, FriendSpeed, FriendSkill, cost);
- Hacking.AddCharacter(c);
- Hacking.SaveCharacters();
- }
-
-
- }
-
- public class FutureModule
- {
- ///
- /// A purchasable module.
- ///
- /// Module name.
- /// Cost in Codepoints
- /// Module description
- /// Module type.
- public FutureModule(string name, int cost, string description, SystemType type)
- {
- Name = name;
- Description = description;
- Type = type;
- Cost = cost;
- }
-
- public string Name { get; set; }
- public int Cost { get; set; }
- public string Description { get; set; }
- public SystemType Type { get; set; }
- }
-}
diff --git a/source/WindowsFormsApplication1/Gameplay/HijackScreen.Designer.cs b/source/WindowsFormsApplication1/Gameplay/HijackScreen.Designer.cs
deleted file mode 100644
index 12e30ab..0000000
--- a/source/WindowsFormsApplication1/Gameplay/HijackScreen.Designer.cs
+++ /dev/null
@@ -1,116 +0,0 @@
-using System;
-
-namespace ShiftOS
-{
- partial class HijackScreen
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.lblHijack = new System.Windows.Forms.Label();
- this.conversationtimer = new System.Windows.Forms.Timer(this.components);
- this.textgen = new System.Windows.Forms.Timer(this.components);
- this.lblhackwords = new System.Windows.Forms.Label();
- this.hackeffecttimer = new System.Windows.Forms.Timer(this.components);
- this.BackgroundWorker1 = new System.ComponentModel.BackgroundWorker();
- this.btnskip = new System.Windows.Forms.Button();
- this.SuspendLayout();
- //
- // lblHijack
- //
- this.lblHijack.Anchor = System.Windows.Forms.AnchorStyles.None;
- this.lblHijack.AutoSize = true;
- this.lblHijack.BackColor = System.Drawing.Color.WhiteSmoke;
- this.lblHijack.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblHijack.ForeColor = System.Drawing.Color.DimGray;
- this.lblHijack.Location = new System.Drawing.Point(143, 193);
- this.lblHijack.Name = "lblHijack";
- this.lblHijack.Size = new System.Drawing.Size(18, 25);
- this.lblHijack.TabIndex = 0;
- this.lblHijack.Text = "\\";
- //
- // textgen
- //
- this.textgen.Interval = 20;
- //
- // lblhackwords
- //
- this.lblhackwords.AutoSize = true;
- this.lblhackwords.Dock = System.Windows.Forms.DockStyle.Fill;
- this.lblhackwords.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.lblhackwords.ForeColor = System.Drawing.SystemColors.ButtonFace;
- this.lblhackwords.Location = new System.Drawing.Point(0, 0);
- this.lblhackwords.Name = "lblhackwords";
- this.lblhackwords.Size = new System.Drawing.Size(127, 18);
- this.lblhackwords.TabIndex = 1;
- this.lblhackwords.Text = "Hijack in progress";
- //
- // hackeffecttimer
- //
- this.hackeffecttimer.Interval = 50;
- //
- // btnskip
- //
- this.btnskip.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
- this.btnskip.ForeColor = System.Drawing.Color.White;
- this.btnskip.Location = new System.Drawing.Point(566, 422);
- this.btnskip.Name = "btnskip";
- this.btnskip.Size = new System.Drawing.Size(75, 23);
- this.btnskip.TabIndex = 2;
- this.btnskip.Text = "Skip";
- this.btnskip.UseVisualStyleBackColor = true;
- this.btnskip.Visible = false;
- this.btnskip.Click += new System.EventHandler(this.btnskip_Click);
- //
- // HijackScreen
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.Silver;
- this.ClientSize = new System.Drawing.Size(653, 457);
- this.Controls.Add(this.btnskip);
- this.Controls.Add(this.lblhackwords);
- this.Controls.Add(this.lblHijack);
- this.Name = "HijackScreen";
- this.Text = "ShiftOS";
- this.TransparencyKey = System.Drawing.Color.White;
- this.Load += new System.EventHandler(this.HijackScreen_Load);
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
- internal System.Windows.Forms.Label lblHijack;
- internal System.Windows.Forms.Timer conversationtimer;
- internal System.Windows.Forms.Timer textgen;
- internal System.Windows.Forms.Label lblhackwords;
- internal System.Windows.Forms.Timer hackeffecttimer;
- internal System.ComponentModel.BackgroundWorker BackgroundWorker1;
- #endregion
-
- private System.Windows.Forms.Button btnskip;
- }
-}
\ No newline at end of file
diff --git a/source/WindowsFormsApplication1/Gameplay/HijackScreen.cs b/source/WindowsFormsApplication1/Gameplay/HijackScreen.cs
deleted file mode 100644
index e234514..0000000
--- a/source/WindowsFormsApplication1/Gameplay/HijackScreen.cs
+++ /dev/null
@@ -1,723 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace ShiftOS
-{
- public partial class HijackScreen : Form
- {
- public HijackScreen()
- {
- InitializeComponent();
- }
-
-
- string rtext;
- string gtexttotype;
- int charcount;
- int currentletter;
- int slashcount;
- int conversationcount = 0;
- Label textgeninput;
- bool needtoclose = false;
- public bool upgraded = false;
- FileStream fs;
- int hackeffect;
- int percentcount;
-
- // ERROR: Handles clauses are not supported in C#
- private void HijackScreen_Load(object sender, EventArgs e)
- {
- hackeffecttimer.Tick += new EventHandler(hackeffecttimer_Tick);
- conversationtimer.Tick += new EventHandler(conversationtimer_Tick);
- textgen.Tick += new EventHandler(textgen_Tick);
-
- this.FormBorderStyle = FormBorderStyle.None;
- this.WindowState = FormWindowState.Maximized;
- BackgroundWorker1.RunWorkerAsync();
- conversationtimer.Start();
- hackeffecttimer.Start();
- }
-
- private void TextType(string texttotype)
- {
- conversationtimer.Stop();
- charcount = texttotype.Length;
- gtexttotype = texttotype;
- currentletter = 0;
- slashcount = 1;
- textgen.Start();
- }
-
-
- // ERROR: Handles clauses are not supported in C#
- private void textgen_Tick(object sender, EventArgs e)
- {
- switch (slashcount)
- {
- case 1:
- if (currentletter < gtexttotype.Length)
- {
- textgeninput.Text = rtext + "\\";
- }
-
- break;
- case 2:
- if (currentletter < gtexttotype.Length)
- {
- textgeninput.Text = rtext + "|";
- }
-
- break;
- case 3:
- if (currentletter < gtexttotype.Length)
- {
- textgeninput.Text = rtext + "/";
- }
-
- break;
- case 4:
- if (currentletter < gtexttotype.Length)
- {
- rtext = rtext + gtexttotype.Substring(currentletter, 1);
- currentletter = currentletter + 1;
- textgeninput.Text = rtext;
- API.PlaySound(Properties.Resources.typesound);
- }
- break;
- }
-
- slashcount = slashcount + 1;
-
- if (slashcount == 5)
- slashcount = 1;
- if (currentletter == gtexttotype.Length)
- {
- gtexttotype = "";
- conversationtimer.Start();
- textgen.Stop();
- }
-
-
- }
-
- // ERROR: Handles clauses are not supported in C#
- private void conversationtimer_Tick(object sender, EventArgs e)
- {
- switch (conversationcount)
- {
- case 0:
- if (needtoclose == true)
- this.Close();
- break;
- case 1:
-
- textgeninput = lblHijack;
- TextType("Your computer is now being Hijacked");
- conversationtimer.Interval = 1000;
-
- break;
- case 3:
- textgeninput = lblhackwords;
- textgen.Interval = 10;
- rtext = "";
- btnskip.Show();
- TextType("Congratulations, you have been involuntarily selected to be an Alpha Tester for ShiftOS." + Environment.NewLine + Environment.NewLine);
- break;
- case 4:
- TextType("At this current point in time I do not wish to reveal my identity or future intentions." + Environment.NewLine + Environment.NewLine);
- break;
- case 5:
- TextType("I just need to use you and your computer as an external test bed to evolve my experimental operating system." + Environment.NewLine + Environment.NewLine);
- break;
- case 6:
- TextType("Right now ShiftOS is practically non-existent but I’ll work on coding it remotely as you use it." + Environment.NewLine + Environment.NewLine);
- break;
- case 7:
- TextType("Your hard drive will now be formatted in preparation for the installation of ShiftOS" + Environment.NewLine + Environment.NewLine);
- break;
- case 8:
- TextType("Starting Format.");
- conversationtimer.Interval = 500;
- break;
- case 9:
- case 10:
- case 11:
- case 12:
- case 13:
- case 14:
- case 15:
- case 16:
- case 17:
- case 18:
- TextType(".");
- break;
- case 19:
- rtext = "";
- break;
- case 20:
- TextType("Scanning System Drive...");
- break;
- case 21:
- TextType(Environment.NewLine + Environment.NewLine + "Current OS: " + OSInfo.GetPlatformID().Replace("microsoft", "Windows"));
- break;
- case 22:
- if(OSInfo.GetPlatformID() == "microsoft")
- {
- var dinf = new DriveInfo(Environment.GetFolderPath(Environment.SpecialFolder.Windows).Substring(0, 3));
- TextType(Environment.NewLine + $"Mountpoint and File System: {dinf.Name} ({dinf.DriveFormat})");
- }
- break;
- case 23:
- if (OSInfo.GetPlatformID() == "microsoft")
- {
- var dinf = new DriveInfo(Environment.GetFolderPath(Environment.SpecialFolder.Windows).Substring(0, 3));
- TextType(Environment.NewLine + $"Size: {dinf.TotalFreeSpace} free, {dinf.TotalSize} total");
- }
- break;
- case 24:
- TextType(Environment.NewLine + "New File System: ShiftFS");
- break;
- case 25:
- TextType(Environment.NewLine + Environment.NewLine + "Formatting system drive - ");
- conversationtimer.Interval = 100;
- break;
- case 26:
- case 28:
- case 30:
- case 32:
- case 36:
- case 38:
- case 40:
- case 42:
- case 44:
- case 46:
- case 48:
- case 50:
- case 52:
- case 54:
- case 56:
- case 58:
- case 60:
- case 62:
- case 64:
- case 66:
- case 68:
- case 70:
- case 72:
- case 74:
- case 76:
- case 78:
- case 80:
- case 82:
- case 84:
- case 86:
- case 88:
- case 90:
- case 92:
- case 94:
- case 96:
- case 98:
- case 100:
- case 102:
- case 104:
- case 106:
- case 108:
- case 110:
- case 112:
- case 114:
- case 116:
- case 118:
- case 120:
- case 122:
- case 124:
- case 126:
- textgeninput.Text = rtext + percentcount + "%";
- if (percentcount < 101)
- {
- percentcount += 2;
- API.PlaySound(Properties.Resources.writesound);
- }
- break;
- case 127:
- rtext = rtext + "100%";
- conversationtimer.Interval = 1000;
- break;
- case 128:
- TextType(Environment.NewLine + "Format Complete");
- break;
- case 129:
- rtext = "";
- percentcount = 0;
- TextType("Installing ShiftOS Alpha 0.0.1 - ");
- conversationtimer.Interval = 200;
- break;
- case 130:
- case 131:
- case 132:
- case 133:
- case 134:
- case 135:
- case 136:
- case 137:
- case 138:
- case 139:
- case 140:
- case 141:
- case 142:
- case 143:
- case 144:
- case 145:
- case 146:
- case 147:
- case 148:
- case 149:
- case 150:
- case 151:
- case 152:
- case 153:
- case 154:
- case 155:
- case 156:
- case 157:
- case 158:
- case 159:
- case 160:
- case 161:
- case 162:
- case 163:
- case 164:
- case 165:
- case 166:
- case 167:
- case 168:
- case 169:
- case 170:
- case 171:
- case 172:
- case 173:
- case 174:
- case 175:
- case 176:
- case 177:
- case 178:
- case 179:
- case 180:
- case 181:
- case 182:
- case 183:
- case 184:
- case 185:
- case 186:
- case 187:
- case 188:
- case 189:
- case 190:
- case 191:
- case 192:
- case 193:
- case 194:
- case 195:
- case 196:
- case 197:
- case 198:
- case 199:
- case 200:
- case 201:
- case 202:
- case 203:
- case 204:
- case 205:
- case 206:
- case 207:
- case 208:
- case 209:
- case 210:
- case 211:
- case 212:
- case 213:
- case 214:
- case 215:
- case 216:
- case 217:
- case 218:
- case 219:
- case 220:
- case 221:
- case 222:
- case 223:
- case 224:
- case 225:
- case 226:
- case 227:
- case 228:
- case 229:
- case 230:
-
- textgeninput.Text = rtext + percentcount + "%" + Environment.NewLine + Environment.NewLine;
- if (percentcount < 101)
- {
- percentcount = percentcount + 1;
- API.PlaySound(Properties.Resources.writesound);
- }
- switch (percentcount)
- {
- case 1:
- case 2:
- textgeninput.Text = textgeninput.Text + "/Home";
- if ((!System.IO.Directory.Exists(Paths.Home)))
- System.IO.Directory.CreateDirectory(Paths.Home);
- break;
- case 3:
- case 4:
- textgeninput.Text = textgeninput.Text + "/Home/Documents";
- if ((!System.IO.Directory.Exists(Paths.Documents)))
- System.IO.Directory.CreateDirectory(Paths.Documents);
- break;
- case 5:
- case 6:
- case 7:
- case 8:
- case 9:
- case 10:
- case 11:
- case 12:
- textgeninput.Text = textgeninput.Text + "/Home/Music";
- if ((!System.IO.Directory.Exists(Paths.Music)))
- System.IO.Directory.CreateDirectory(Paths.Music);
- break;
- case 13:
- case 14:
- case 15:
- textgeninput.Text = textgeninput.Text + "/Home/Pictures";
- if ((!System.IO.Directory.Exists(Paths.Pictures)))
- System.IO.Directory.CreateDirectory(Paths.Pictures);
- break;
- case 16:
- case 17:
- case 18:
- textgeninput.Text = textgeninput.Text + "/Shiftum42";
- if ((!System.IO.Directory.Exists(Paths.SystemDir)))
- System.IO.Directory.CreateDirectory(Paths.SystemDir);
- break;
- case 19:
- case 20:
- textgeninput.Text = textgeninput.Text + "/Shiftum42/Drivers";
- if ((!System.IO.Directory.Exists(Paths.Drivers)))
- System.IO.Directory.CreateDirectory(Paths.Drivers);
- break;
- case 21:
- case 22:
- case 23:
- case 24:
- case 25:
- case 26:
- case 27:
- textgeninput.Text = textgeninput.Text + "/Shiftum42/Drivers/HDD.dri";
- break;
- case 28:
- case 29:
- case 30:
- case 31:
- case 32:
- case 33:
- case 34:
- case 35:
- textgeninput.Text = textgeninput.Text + "/Shiftum42/Drivers/Keyboard.dri";
- fs = File.Create(Paths.Drivers + "Keyboard.dri");
- fs.Close();
- break;
- case 36:
- case 37:
- case 38:
- case 39:
- case 40:
- case 41:
- case 42:
- case 43:
- case 44:
- textgeninput.Text = textgeninput.Text + "/Shiftum42/Drivers/Monitor.dri";
- fs = File.Create(Paths.Drivers + "Monitor.dri");
- fs.Close();
- break;
- case 45:
- case 46:
- case 47:
- case 48:
- case 49:
- case 50:
- case 51:
- case 52:
- textgeninput.Text = textgeninput.Text + "/Shiftum42/Drivers/Mouse.dri";
- fs = File.Create(Paths.Drivers + "Mouse.dri");
- fs.Close();
- break;
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- case 58:
- case 59:
- case 60:
- textgeninput.Text = textgeninput.Text + "/Shiftum42/Drivers/Printer.dri";
- fs = File.Create(Paths.Drivers + "Printer.dri");
- fs.Close();
- break;
- case 61:
- case 62:
- case 63:
- case 64:
- case 65:
- case 66:
- case 67:
- case 68:
- textgeninput.Text = textgeninput.Text + "/Shiftum42/Languages/";
- if ((!System.IO.Directory.Exists(Paths.SystemDir + "Languages")))
- System.IO.Directory.CreateDirectory(Paths.SystemDir + "Languages");
- break;
- case 69:
- case 70:
- case 71:
- case 72:
- case 73:
- case 74:
- case 75:
- case 76:
- textgeninput.Text = textgeninput.Text + "/Shiftum42/Languages/Current.lang";
- fs = File.Create(Paths.SystemDir + "Languages/Current.lang");
- fs.Close();
- break;
- case 77:
- case 78:
- case 79:
- case 80:
- case 81:
- case 82:
- case 83:
- case 84:
- textgeninput.Text = textgeninput.Text + "/Shiftum42/HDAccess.sft";
- break;
- case 85:
- case 86:
- case 87:
- case 88:
- case 89:
- textgeninput.Text = textgeninput.Text + "/Shiftum42/ShiftGUI.sft";
- fs = File.Create(Paths.SystemDir + "ShiftGUI.sft");
- fs.Close();
- break;
- case 90:
- case 91:
- case 92:
- case 93:
- textgeninput.Text = textgeninput.Text + "/Shiftum42/SKernal.sft";
- fs = File.Create(Paths.SystemDir + "SKernal.sft");
- fs.Close();
- break;
- case 94:
- case 95:
- case 96:
- case 97:
- textgeninput.Text = textgeninput.Text + "/Shiftum42/SRead.sft";
- fs = File.Create(Paths.SystemDir + "SRead.sft");
- fs.Close();
- break;
- case 98:
- case 99:
- case 100:
- case 101:
- textgeninput.Text = textgeninput.Text + "/Shiftum42/SWrite.sft";
- fs = File.Create(Paths.SystemDir + "SWrite.sft");
- fs.Close();
- break;
- }
-
- break;
-
- case 231:
- textgeninput.Text = rtext + "100%" + Environment.NewLine + Environment.NewLine + "/Shiftum42/SWrite.sft";
- conversationtimer.Interval = 1000;
- API.PlaySound(Properties.Resources.writesound);
- break;
- case 232:
- textgeninput.Text = rtext + "100%" + Environment.NewLine + Environment.NewLine + "ShiftOS Installation Complete!";
- API.PlaySound(Properties.Resources.typesound);
- if ((!System.IO.Directory.Exists(Paths.SoftwareData)))
- System.IO.Directory.CreateDirectory(Paths.SoftwareData);
- if ((!System.IO.Directory.Exists(Paths.KnowledgeInput)))
- System.IO.Directory.CreateDirectory(Paths.KnowledgeInput);
- break;
- case 234:
- SaveSystem.Utilities.LoadedSave.newgame = false;
- API.CurrentSession.Opacity = 100;
- Terminal term = new Terminal();
- term.Show();
- term.tmrfirstrun.Start();
- this.Close();
-
- break;
- }
- conversationcount = conversationcount + 1;
- }
-
- // ERROR: Handles clauses are not supported in C#
- private void hackeffecttimer_Tick(object sender, EventArgs e)
- {
- if (hackeffect < 101)
- {
- switch (hackeffect)
- {
- case 1:
- case 3:
- case 5:
- case 7:
- case 9:
- case 11:
- case 13:
- case 15:
- case 17:
- case 19:
- case 21:
- case 23:
- case 25:
- case 27:
- case 29:
- case 31:
- case 33:
- case 35:
- case 37:
- case 39:
- case 41:
- case 43:
- case 45:
- case 47:
- case 49:
- case 51:
- case 53:
- case 55:
- case 57:
- case 59:
- case 61:
- case 63:
- case 65:
- case 67:
- case 69:
- case 71:
- case 73:
- case 75:
- case 77:
- case 79:
- case 81:
- case 83:
- case 85:
- case 87:
- case 89:
- case 91:
- case 93:
- case 95:
- this.BackColor = Color.Magenta;
- this.TransparencyKey = Color.Magenta;
- API.PlaySound(Properties.Resources.writesound);
- this.TopMost = true;
- break;
- case 2:
- case 4:
- case 6:
- case 8:
- case 10:
- case 12:
- case 14:
- case 16:
- case 18:
- case 20:
- case 22:
- case 24:
- case 26:
- case 28:
- this.BackColor = Color.Magenta;
- API.PlaySound(Properties.Resources.typesound);
- break;
- case 30:
- case 32:
- case 34:
- case 36:
- case 38:
- case 40:
- case 42:
- case 44:
- case 46:
- case 48:
- case 50:
- this.BackColor = Color.Magenta;
- API.PlaySound(Properties.Resources.typesound);
- break;
- case 52:
- case 54:
- case 56:
- case 58:
- case 60:
- case 62:
- case 64:
- case 66:
- case 68:
- case 70:
- case 72:
- case 74:
- case 76:
- this.BackColor = Color.Magenta;
- API.PlaySound(Properties.Resources.typesound);
-
- break;
- case 78:
- case 80:
- case 82:
- case 84:
- case 86:
- case 88:
- case 90:
- case 92:
- case 94:
- this.BackColor = Color.DimGray;
- API.PlaySound(Properties.Resources.typesound);
-
- break;
- case 96:
- lblHijack.BackColor = Color.LightGray;
- break;
- case 97:
- lblHijack.BackColor = Color.DarkGray;
- break;
- case 98:
- lblHijack.BackColor = Color.DimGray;
- break;
- case 99:
- this.BackColor = Color.Black;
- lblHijack.BackColor = Color.Black;
- lblHijack.ForeColor = Color.DimGray;
- break;
- case 100:
- lblHijack.Hide();
- break;
- }
- }
- else {
- hackeffecttimer.Stop();
- }
- hackeffect = hackeffect + 1;
- }
-
- private void btnskip_Click(object sender, EventArgs e)
- {
- conversationcount = 19;
- btnskip.Hide();
- }
- }
-}
diff --git a/source/WindowsFormsApplication1/Gameplay/HijackScreen.resx b/source/WindowsFormsApplication1/Gameplay/HijackScreen.resx
deleted file mode 100644
index 89116b6..0000000
--- a/source/WindowsFormsApplication1/Gameplay/HijackScreen.resx
+++ /dev/null
@@ -1,132 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- 17, 17
-
-
- 167, 17
-
-
- 260, 17
-
-
- 396, 17
-
-
\ No newline at end of file
diff --git a/source/WindowsFormsApplication1/ShiftOS.csproj b/source/WindowsFormsApplication1/ShiftOS.csproj
index 066a32e..9e24979 100644
--- a/source/WindowsFormsApplication1/ShiftOS.csproj
+++ b/source/WindowsFormsApplication1/ShiftOS.csproj
@@ -216,17 +216,17 @@
Graphic_Picker.cs
-
-
+
+
Form
-
+
HackUI.cs
-
+
Form
-
+
HijackScreen.cs
@@ -464,10 +464,10 @@
Graphic_Picker.cs
-
+
HackUI.cs
-
+
HijackScreen.cs