From a9754b7df28795b6bb2c5cfe04c1b38b19fb0d05 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 10 Mar 2017 12:29:28 -0500 Subject: Lock certain apps away when system offline. --- ShiftOS.WinForms/Applications/MUDControlCentre.cs | 1 + 1 file changed, 1 insertion(+) (limited to 'ShiftOS.WinForms/Applications/MUDControlCentre.cs') diff --git a/ShiftOS.WinForms/Applications/MUDControlCentre.cs b/ShiftOS.WinForms/Applications/MUDControlCentre.cs index 02fe868..e2668bd 100644 --- a/ShiftOS.WinForms/Applications/MUDControlCentre.cs +++ b/ShiftOS.WinForms/Applications/MUDControlCentre.cs @@ -38,6 +38,7 @@ using ShiftOS.WinForms.Tools; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] [RequiresUpgrade("mud_fundamentals")] [Launcher("MUD Control Centre", true, "al_mud_control_centre", "Networking")] [WinOpen("mud_control_centre")] -- cgit v1.2.3 From 2ac1033c2dcd0e70114ab9ee5c7bd129bff6c1fa Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 9 Apr 2017 15:56:14 -0400 Subject: Legion story work (SPOILERS!) --- ShiftOS.Objects/Reputation.cs | 21 ++- .../Applications/Installer.Designer.cs | 104 +++++++++++++ ShiftOS.WinForms/Applications/Installer.cs | 150 ++++++++++++++++++ ShiftOS.WinForms/Applications/Installer.resx | 120 +++++++++++++++ .../Applications/MUDControlCentre.Designer.cs | 88 +++++++++++ ShiftOS.WinForms/Applications/MUDControlCentre.cs | 54 ++++++- ShiftOS.WinForms/Controls/TerminalBox.cs | 1 - ShiftOS.WinForms/ShiftOS.WinForms.csproj | 10 ++ ShiftOS.WinForms/Stories/LegionStory.cs | 169 +++++++++++++++++++++ 9 files changed, 707 insertions(+), 10 deletions(-) create mode 100644 ShiftOS.WinForms/Applications/Installer.Designer.cs create mode 100644 ShiftOS.WinForms/Applications/Installer.cs create mode 100644 ShiftOS.WinForms/Applications/Installer.resx create mode 100644 ShiftOS.WinForms/Stories/LegionStory.cs (limited to 'ShiftOS.WinForms/Applications/MUDControlCentre.cs') diff --git a/ShiftOS.Objects/Reputation.cs b/ShiftOS.Objects/Reputation.cs index 32bb911..0ddea0a 100644 --- a/ShiftOS.Objects/Reputation.cs +++ b/ShiftOS.Objects/Reputation.cs @@ -23,38 +23,43 @@ namespace ShiftOS.Objects public enum UserClass { + /// + /// The user has no class. + /// + None = 0, + /// /// Skinners, otherwise known as "Shifters" due to their excessive use of the Shifter application, like to customize ShiftOS to look like other operating systems or even have an entirely different UI. They gain heaps of codepoints from it, and like to sell their skins for even more Codepoints. /// - Skinner, + Skinner = 1, /// /// Hackers are notorious for taking down large groups and individuals of which have many useful documents and Codepoints on their system. Hackers enjoy the rush of typing malicious commands into their terminals and seeing how they affect their target. /// - Hacker, + Hacker = 2, /// /// Much like hackers, investigators are skilled with a terminal and breaching systems, but they don't do it directly for monetary gain. They will search a target's system for any files and clues that may lead to them being guilty of a crime within the digital society. Unlike Hackers, Investigators mostly have higher reputations in society, and go after those with lower reputations. /// - Investigator, + Investigator = 3, /// /// Explorers like to venture the vast regions of the multi-user domain and Shiftnet looking for secrets, hidden tools and software, and finding the hidden truths behind their screen. Explorers don't always know how to hack, but if it involves finding a secret about ShiftOS, they will do it. They typically do not have malicious intent. /// - Explorer, + Explorer = 4, /// /// Safety Activists are skilled with exploitation and hacking, but they only go after the worst there is in the multi-user domain. Crime rings, large hacker groups, you name it. Their primary goal is keeping the multi-user domain safe. /// - SafetyActivist, + SafetyActivist = 5, /// /// Penetration testers go hand-in-hand with Safety Activists. They go after the good guys, but rather than attacking them, they alert them that an exploit was found in their service and that this exploit should be fixed. They are a gray subject though - you never know if you are dealing with a genuine pen-tester or a hacker skilled with social engineering. Be careful. /// - PenetrationTester, + PenetrationTester = 6, /// /// Collectors go well with Explorers - however, Collectors are the ones who open shops. They like to find rare objects and sell them for Codepoints. /// - Collector, + Collector = 7, /// /// Programmers are the ones who write applications and services for ShiftOS and the multi-user domain. Depending on the code that they write, they can be seen as either morally wrong sentiences or morally correct sentiences, it's up to their decisions. /// - Programmer + Programmer = 8 } } diff --git a/ShiftOS.WinForms/Applications/Installer.Designer.cs b/ShiftOS.WinForms/Applications/Installer.Designer.cs new file mode 100644 index 0000000..8b4ae81 --- /dev/null +++ b/ShiftOS.WinForms/Applications/Installer.Designer.cs @@ -0,0 +1,104 @@ +namespace ShiftOS.WinForms.Applications +{ + partial class Installer + { + /// + /// 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 Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.lbtitle = new System.Windows.Forms.Label(); + this.pnlselectfile = new System.Windows.Forms.Panel(); + this.pginstall = new ShiftOS.WinForms.Controls.ShiftedProgressBar(); + this.lbprogress = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // lbtitle + // + this.lbtitle.AutoSize = true; + this.lbtitle.Location = new System.Drawing.Point(14, 13); + this.lbtitle.Name = "lbtitle"; + this.lbtitle.Size = new System.Drawing.Size(155, 13); + this.lbtitle.TabIndex = 0; + this.lbtitle.Tag = "header2"; + this.lbtitle.Text = "Installing MUD Control Centre..."; + // + // pnlselectfile + // + this.pnlselectfile.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.pnlselectfile.Location = new System.Drawing.Point(17, 48); + this.pnlselectfile.Name = "pnlselectfile"; + this.pnlselectfile.Size = new System.Drawing.Size(414, 85); + this.pnlselectfile.TabIndex = 1; + this.pnlselectfile.VisibleChanged += new System.EventHandler(this.pnlselectfile_VisibleChanged); + // + // pginstall + // + this.pginstall.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.pginstall.BlockSize = 5; + this.pginstall.Location = new System.Drawing.Point(17, 161); + this.pginstall.Maximum = 100; + this.pginstall.Name = "pginstall"; + this.pginstall.Size = new System.Drawing.Size(414, 23); + this.pginstall.Style = System.Windows.Forms.ProgressBarStyle.Continuous; + this.pginstall.TabIndex = 2; + this.pginstall.Text = "shiftedProgressBar1"; + this.pginstall.Value = 0; + // + // lbprogress + // + this.lbprogress.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.lbprogress.AutoSize = true; + this.lbprogress.Location = new System.Drawing.Point(17, 140); + this.lbprogress.Name = "lbprogress"; + this.lbprogress.Size = new System.Drawing.Size(35, 13); + this.lbprogress.TabIndex = 3; + this.lbprogress.Text = "label1"; + // + // Installer + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.lbprogress); + this.Controls.Add(this.pginstall); + this.Controls.Add(this.pnlselectfile); + this.Controls.Add(this.lbtitle); + this.Name = "Installer"; + this.Size = new System.Drawing.Size(447, 203); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label lbtitle; + private System.Windows.Forms.Panel pnlselectfile; + private Controls.ShiftedProgressBar pginstall; + private System.Windows.Forms.Label lbprogress; + } +} diff --git a/ShiftOS.WinForms/Applications/Installer.cs b/ShiftOS.WinForms/Applications/Installer.cs new file mode 100644 index 0000000..1b5521e --- /dev/null +++ b/ShiftOS.WinForms/Applications/Installer.cs @@ -0,0 +1,150 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using ShiftOS.Engine; + +namespace ShiftOS.WinForms.Applications +{ + public partial class Installer : UserControl, IShiftOSWindow + { + public Installer() + { + InitializeComponent(); + lbtitle.Text = "Select file"; + } + + public void InitiateInstall(Installation install) + { + pnlselectfile.Hide(); + install.ProgressReported += (p) => + { + this.Invoke(new Action(() => + { + pginstall.Value = p; + })); + }; + install.StatusReported += (s) => + { + this.Invoke(new Action(() => + { + lbprogress.Text = s; + })); + }; + install.InstallCompleted += () => + { + this.Invoke(new Action(() => + { + lbtitle.Text = "Select file"; + pnlselectfile.Show(); + })); + isInstalling = false; + InstallCompleted?.Invoke(); + }; + isInstalling = true; + install.Install(); + } + + public void OnLoad() + { + } + + private bool isInstalling = false; + + public void OnSkinLoad() + { + } + + public bool OnUnload() + { + return !isInstalling; //Don't close if an install is running. + } + + public void OnUpgrade() + { + + } + + private void pnlselectfile_VisibleChanged(object sender, EventArgs e) + { + if(this.ParentForm != null) + { + this.ParentForm.Height = (pnlselectfile.Visible == true) ? this.ParentForm.Height + pnlselectfile.Height : this.ParentForm.Height - pnlselectfile.Height; + } + } + public event Action InstallCompleted; + } + + public abstract class Installation + { + /// + /// The display name of the installation. + /// + public string Name { get; set; } + + /// + /// Occurs when the installation updates its status. + /// + public event Action StatusReported; + /// + /// Occurs when the installation updates its progress percentage. + /// + public event Action ProgressReported; + /// + /// Occurs when the installation completes. + /// + public event Action InstallCompleted; + + /// + /// Start the installation. + /// + public void Install() + { + var t = new System.Threading.Thread(() => + { + ProgressReported?.Invoke(0); + StatusReported?.Invoke(""); + Run(); + ProgressReported?.Invoke(100); + StatusReported?.Invoke("Installation completed."); + InstallCompleted?.Invoke(); + }); + t.IsBackground = true; + t.Start(); + } + + /// + /// Sets the install progress percentage. + /// + /// The installation percentage. + protected void SetProgress(int value) + { + if (value < 0 || value > 100) + throw new ArgumentOutOfRangeException("value", "A percentage is typically between 0 and 100.... derp..."); + ProgressReported?.Invoke(value); + } + + /// + /// Sets the install status text. + /// + /// Text to display as status. + protected void SetStatus(string status) + { + StatusReported?.Invoke(status); + } + + /// + /// User-defined code to run during install. Once this code is ran, the installation is complete. + /// + protected abstract void Run(); + } + + + + +} diff --git a/ShiftOS.WinForms/Applications/Installer.resx b/ShiftOS.WinForms/Applications/Installer.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/Applications/Installer.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/ShiftOS.WinForms/Applications/MUDControlCentre.Designer.cs b/ShiftOS.WinForms/Applications/MUDControlCentre.Designer.cs index ba4c4f1..e2c0af3 100644 --- a/ShiftOS.WinForms/Applications/MUDControlCentre.Designer.cs +++ b/ShiftOS.WinForms/Applications/MUDControlCentre.Designer.cs @@ -144,6 +144,12 @@ namespace ShiftOS.WinForms.Applications this.you_memos = new System.Windows.Forms.Panel(); this.flmemos = new System.Windows.Forms.FlowLayoutPanel(); this.label3 = new System.Windows.Forms.Label(); + this.pnlclasses = new System.Windows.Forms.Panel(); + this.lbclasstitle = new System.Windows.Forms.Label(); + this.lbclassdesc = new System.Windows.Forms.Label(); + this.lbclasses = new System.Windows.Forms.ListBox(); + this.flowLayoutPanel6 = new System.Windows.Forms.FlowLayoutPanel(); + this.btnchooseclass = new System.Windows.Forms.Button(); this.menuStrip1.SuspendLayout(); this.toolStripContainer1.ContentPanel.SuspendLayout(); this.toolStripContainer1.TopToolStripPanel.SuspendLayout(); @@ -172,6 +178,8 @@ namespace ShiftOS.WinForms.Applications this.panel3.SuspendLayout(); this.flowLayoutPanel2.SuspendLayout(); this.you_memos.SuspendLayout(); + this.pnlclasses.SuspendLayout(); + this.flowLayoutPanel6.SuspendLayout(); this.SuspendLayout(); // // menuStrip1 @@ -301,6 +309,7 @@ namespace ShiftOS.WinForms.Applications // // toolStripContainer1.ContentPanel // + this.toolStripContainer1.ContentPanel.Controls.Add(this.pnlclasses); this.toolStripContainer1.ContentPanel.Controls.Add(this.you_systemstatus); this.toolStripContainer1.ContentPanel.Controls.Add(this.shop_all); this.toolStripContainer1.ContentPanel.Controls.Add(this.shop_view); @@ -1182,6 +1191,75 @@ namespace ShiftOS.WinForms.Applications this.label3.Tag = "header1"; this.label3.Text = "Memos"; // + // pnlclasses + // + this.pnlclasses.Controls.Add(this.flowLayoutPanel6); + this.pnlclasses.Controls.Add(this.lbclasses); + this.pnlclasses.Controls.Add(this.lbclassdesc); + this.pnlclasses.Controls.Add(this.lbclasstitle); + this.pnlclasses.Dock = System.Windows.Forms.DockStyle.Fill; + this.pnlclasses.Location = new System.Drawing.Point(0, 0); + this.pnlclasses.Name = "pnlclasses"; + this.pnlclasses.Size = new System.Drawing.Size(756, 464); + this.pnlclasses.TabIndex = 3; + // + // lbclasstitle + // + this.lbclasstitle.AutoSize = true; + this.lbclasstitle.Dock = System.Windows.Forms.DockStyle.Top; + this.lbclasstitle.Location = new System.Drawing.Point(0, 0); + this.lbclasstitle.Name = "lbclasstitle"; + this.lbclasstitle.Padding = new System.Windows.Forms.Padding(10); + this.lbclasstitle.Size = new System.Drawing.Size(82, 33); + this.lbclasstitle.TabIndex = 0; + this.lbclasstitle.Tag = "header1"; + this.lbclasstitle.Text = "Join a class"; + // + // lbclassdesc + // + this.lbclassdesc.AutoSize = true; + this.lbclassdesc.Dock = System.Windows.Forms.DockStyle.Top; + this.lbclassdesc.Location = new System.Drawing.Point(0, 33); + this.lbclassdesc.Name = "lbclassdesc"; + this.lbclassdesc.Padding = new System.Windows.Forms.Padding(10); + this.lbclassdesc.Size = new System.Drawing.Size(727, 33); + this.lbclassdesc.TabIndex = 1; + this.lbclassdesc.Text = "A class is a way for the multi-user domain to better understand you. It defines w" + + "ho you are as a sentient being, what you do, what you like, and so on."; + // + // lbclasses + // + this.lbclasses.Dock = System.Windows.Forms.DockStyle.Fill; + this.lbclasses.FormattingEnabled = true; + this.lbclasses.Location = new System.Drawing.Point(0, 66); + this.lbclasses.Name = "lbclasses"; + this.lbclasses.Size = new System.Drawing.Size(756, 398); + this.lbclasses.TabIndex = 2; + // + // flowLayoutPanel6 + // + this.flowLayoutPanel6.AutoSize = true; + this.flowLayoutPanel6.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.flowLayoutPanel6.Controls.Add(this.btnchooseclass); + this.flowLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Bottom; + this.flowLayoutPanel6.Location = new System.Drawing.Point(0, 415); + this.flowLayoutPanel6.Name = "flowLayoutPanel6"; + this.flowLayoutPanel6.Padding = new System.Windows.Forms.Padding(10); + this.flowLayoutPanel6.Size = new System.Drawing.Size(756, 49); + this.flowLayoutPanel6.TabIndex = 3; + // + // btnchooseclass + // + this.btnchooseclass.AutoSize = true; + this.btnchooseclass.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnchooseclass.Location = new System.Drawing.Point(13, 13); + this.btnchooseclass.Name = "btnchooseclass"; + this.btnchooseclass.Size = new System.Drawing.Size(53, 23); + this.btnchooseclass.TabIndex = 0; + this.btnchooseclass.Text = "Choose"; + this.btnchooseclass.UseVisualStyleBackColor = true; + this.btnchooseclass.Click += new System.EventHandler(this.btnchooseclass_Click); + // // MUDControlCentre // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1242,6 +1320,10 @@ namespace ShiftOS.WinForms.Applications this.flowLayoutPanel2.PerformLayout(); this.you_memos.ResumeLayout(false); this.you_memos.PerformLayout(); + this.pnlclasses.ResumeLayout(false); + this.pnlclasses.PerformLayout(); + this.flowLayoutPanel6.ResumeLayout(false); + this.flowLayoutPanel6.PerformLayout(); this.ResumeLayout(false); } @@ -1339,5 +1421,11 @@ namespace ShiftOS.WinForms.Applications private System.Windows.Forms.ToolStripMenuItem chatToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem joinAChatToolStripMenuItem; private System.Windows.Forms.Button btndeletesave; + private System.Windows.Forms.Panel pnlclasses; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel6; + private System.Windows.Forms.Button btnchooseclass; + private System.Windows.Forms.ListBox lbclasses; + private System.Windows.Forms.Label lbclassdesc; + private System.Windows.Forms.Label lbclasstitle; } } diff --git a/ShiftOS.WinForms/Applications/MUDControlCentre.cs b/ShiftOS.WinForms/Applications/MUDControlCentre.cs index e2668bd..5a51f48 100644 --- a/ShiftOS.WinForms/Applications/MUDControlCentre.cs +++ b/ShiftOS.WinForms/Applications/MUDControlCentre.cs @@ -39,7 +39,7 @@ using ShiftOS.WinForms.Tools; namespace ShiftOS.WinForms.Applications { [MultiplayerOnly] - [RequiresUpgrade("mud_fundamentals")] + [RequiresUpgrade("mud_control_centre")] [Launcher("MUD Control Centre", true, "al_mud_control_centre", "Networking")] [WinOpen("mud_control_centre")] [DefaultIcon("iconSysinfo")] @@ -177,6 +177,42 @@ namespace ShiftOS.WinForms.Applications }; } + + + internal void ShowClasses() + { + var descriptions = new Dictionary { + + { UserClass.Skinner, "Skinners, otherwise known as \"Shifters\" due to their excessive use of the Shifter application, like to customize ShiftOS to look like other operating systems or even have an entirely different UI. They gain heaps of codepoints from it, and like to sell their skins for even more Codepoints." }, + { UserClass.Hacker, "Hackers are notorious for taking down large groups and individuals of which have many useful documents and Codepoints on their system. Hackers enjoy the rush of typing malicious commands into their terminals and seeing how they affect their target." }, + { UserClass.Investigator, "Much like hackers, investigators are skilled with a terminal and breaching systems, but they don't do it directly for monetary gain. They will search a target's system for any files and clues that may lead to them being guilty of a crime within the digital society. Unlike Hackers, Investigators mostly have higher reputations in society, and go after those with lower reputations."}, + { UserClass.Explorer, "Explorers like to venture the vast regions of the multi-user domain and Shiftnet looking for secrets, hidden tools and software, and finding the hidden truths behind their screen. Explorers don't always know how to hack, but if it involves finding a secret about ShiftOS, they will do it. They typically do not have malicious intent."}, + { UserClass.SafetyActivist, "Safety Activists are skilled with exploitation and hacking, but they only go after the worst there is in the multi-user domain. Crime rings, large hacker groups, you name it. Their primary goal is keeping the multi-user domain safe." }, + { UserClass.PenetrationTester, "Penetration testers go hand-in-hand with Safety Activists. They go after the good guys, but rather than attacking them, they alert them that an exploit was found in their service and that this exploit should be fixed. They are a gray subject though - you never know if you are dealing with a genuine pen-tester or a hacker skilled with social engineering. Be careful." }, + { UserClass.Collector, "Collectors go well with Explorers - however, Collectors are the ones who open shops. They like to find rare objects and sell them for Codepoints." }, + {UserClass.Programmer, "Programmers are the ones who write applications and services for ShiftOS and the multi-user domain. Depending on the code that they write, they can be seen as either morally wrong sentiences or morally correct sentiences, it's up to their decisions." }, + + }; + + lbclasses.Items.Clear(); + lbclasses.SelectedIndexChanged += (o, a) => + { + newClass = (UserClass)Enum.Parse(typeof(UserClass), lbclasses.SelectedItem.ToString()); + lbclassdesc.Text = descriptions[newClass]; + lbclasstitle.Text = newClass.ToString(); + }; + foreach (var kv in descriptions) + { + lbclasses.Items.Add(kv.Key.ToString()); + + } + menuStrip1.Hide(); + pnlclasses.Show(); + pnlclasses.BringToFront(); + } + + UserClass newClass = UserClass.None; + public void ListAllChats(Channel[] channels) { shop_all.BringToFront(); @@ -890,5 +926,21 @@ Current legions: {legionname}"; } }); } + + public event Action ClassChanged; + + private void btnchooseclass_Click(object sender, EventArgs e) + { + if(newClass != UserClass.None) + { + SaveSystem.CurrentSave.Class = newClass; + SaveSystem.SaveGame(); + ClassChanged?.Invoke(); + menuStrip1.Show(); + pnlclasses.SendToBack(); + this.SetupSystemStatus(); + return; + } + } } } diff --git a/ShiftOS.WinForms/Controls/TerminalBox.cs b/ShiftOS.WinForms/Controls/TerminalBox.cs index bc2bcc0..df820f7 100644 --- a/ShiftOS.WinForms/Controls/TerminalBox.cs +++ b/ShiftOS.WinForms/Controls/TerminalBox.cs @@ -64,7 +64,6 @@ namespace ShiftOS.WinForms.Controls public void Write(string text) { this.HideSelection = true; - this.Select(this.TextLength, 0); this.SelectionFont = ConstructFont(); this.SelectionColor = ControlManager.ConvertColor(ConsoleEx.ForegroundColor); this.SelectionBackColor = ControlManager.ConvertColor(ConsoleEx.BackgroundColor); diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index ca0001e..95612ef 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -131,6 +131,12 @@ GraphicPicker.cs + + UserControl + + + Installer.cs + UserControl @@ -279,6 +285,7 @@ + @@ -336,6 +343,9 @@ GraphicPicker.cs + + Installer.cs + ShiftLetters.cs diff --git a/ShiftOS.WinForms/Stories/LegionStory.cs b/ShiftOS.WinForms/Stories/LegionStory.cs new file mode 100644 index 0000000..424c54b --- /dev/null +++ b/ShiftOS.WinForms/Stories/LegionStory.cs @@ -0,0 +1,169 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using ShiftOS.Engine; + +namespace ShiftOS.WinForms.Stories +{ + public static class LegionStory + { + private static void WriteLine(string text, bool showCharacterName=true) + { + Console.WriteLine(); + if (showCharacterName == true) + { + ConsoleEx.Bold = true; + ConsoleEx.ForegroundColor = ConsoleColor.DarkMagenta; + Console.Write("DevX"); + Console.ForegroundColor = ConsoleColor.White; + Console.Write("@"); + ConsoleEx.ForegroundColor = ConsoleColor.Yellow; + Console.Write("mud: "); + } + ConsoleEx.ForegroundColor = ConsoleColor.Gray; + ConsoleEx.Bold = false; + + foreach (var c in text) + { + Desktop.InvokeOnWorkerThread(() => + { + Console.Write(c); + }); + Thread.Sleep(75); + } + Thread.Sleep(1000); + } + + public static bool terminalOpen() + { + foreach(var win in AppearanceManager.OpenForms) + { + if (win.ParentWindow is Applications.Terminal) + return true; + } + return false; + } + + [Story("mud_control_centre")] + public static void MCC_Placeholder() + { + //What a way to create unbuyable, engine-managed Shiftorium Upgrades... :P + } + + [Story("devx_legions")] + public static void DevXLegionStory() + { + bool waiting = false; + //Used for DevX dialogue. + //Used for legion selection. + var mud = new Applications.MUDControlCentre(); + //For installing the MCC + var installer = new Applications.Installer(); + installer.InstallCompleted += () => + { + Desktop.InvokeOnWorkerThread(() => + { + AppearanceManager.Close(installer); + }); + waiting = false; + }; + + if (!terminalOpen()) + { + var term = new Applications.Terminal(); + AppearanceManager.SetupWindow(term); + } + + var t = new Thread(() => + { + WriteLine("DevX@mud - user connecting to your system.", false); + Thread.Sleep(2000); + WriteLine($"Hello, {SaveSystem.CurrentSave.Username}. It's been a while."); + WriteLine("My intelligence suggests you've installed all GUI-based Shiftorium upgrades."); + WriteLine("Bet you're liking ShiftOS now that the terminal isn't the only way you can control it."); + WriteLine("Well, now it's time to introduce your next task."); + WriteLine("In the multi-user domain, each user has a reputation value associated with them."); + WriteLine("Right now, you have a reputation of 0, Neutral."); + WriteLine("This means that nobody has an opinion on you, yet."); + WriteLine("What a good time to make your presence known?"); + WriteLine("I have an application for you to try, that will help you out in the multi-user domain, and help you make yourself famous."); + WriteLine("In the digital society, you can't survive long as a lone sentience. You must kongregate with a group, and these groups are called \"legions\"."); + WriteLine("This application will assist you in finding one. A legion is a group of sentiences who carry out actions together. They're like... a pack of wolves, or a family, if you will."); + WriteLine("They share Codepoints, documents, applications, and other things with each other."); + WriteLine("And they all have their own goals."); + WriteLine("Up until now, you've been blindly following my directions, with the goal of upgrading ShiftOS. Now, it's time for you to join a legion, and fulfill their goals, to become known within the digital society."); + + WriteLine("You'll do all of this through the MUD Control Centre."); + WriteLine("I'll set it up on your system now."); + //Set up an Installer. + waiting = true; + Desktop.InvokeOnWorkerThread(() => + { + AppearanceManager.SetupWindow(installer); + installer.InitiateInstall(new MCCInstallation()); + }); + while (waiting == true) + Thread.Sleep(25); + + WriteLine("There, it's all installed, so let's get you set up with a legion, shall we?"); + Desktop.InvokeOnWorkerThread(() => + { + AppearanceManager.SetupWindow(mud); + mud.ShowClasses(); + mud.ClassChanged += () => + { + waiting = false; + }; + }); + WriteLine("First, select a class. A class will help define your personality within the multi-user domain. It'll determine the best legions for you."); + waiting = true; + while (waiting == true) + Thread.Sleep(25); + TerminalBackend.PrefixEnabled = true; + TerminalBackend.PrintPrompt(); + }); + t.IsBackground = true; + t.Start(); + + TerminalBackend.PrefixEnabled = false; + } + + public class MCCInstallation : Applications.Installation + { + protected override void Run() + { + SetStatus("Beginning installation..."); + Thread.Sleep(1270); + SetProgress(10); + SetStatus("Installing base application..."); + for(int i = 0; i < 45; i++) + { + Thread.Sleep(25); + SetProgress(10 + i); + } + SetStatus("Configuring system..."); + //First, we initialize the user's legion value. + SaveSystem.CurrentSave.CurrentLegions = new List(); + Thread.Sleep(250); + SetProgress(65); + //Now we initialize their shop value. + SaveSystem.CurrentSave.MyShop = null; + Thread.Sleep(200); + SetProgress(75); + //Now for their reputation... + SaveSystem.CurrentSave.RawReputation = 0.000; + Thread.Sleep(250); + SetProgress(90); + //Now their class. + SaveSystem.CurrentSave.Class = Objects.UserClass.None; + Thread.Sleep(200); + Story.Start("mud_control_centre"); + SaveSystem.SaveGame(); + SetProgress(100); + } + } + } +} -- cgit v1.2.3 From 700a6a95cf2ca623aa6c0a780d2dc7003f4994f2 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 9 Apr 2017 19:33:34 -0400 Subject: Finish the MUD Control Centre story --- ShiftOS.WinForms/Applications/MUDControlCentre.cs | 11 ++++++++ ShiftOS.WinForms/Stories/LegionStory.cs | 33 +++++++++++++++++++++++ ShiftOS_TheReturn/Commands.cs | 8 ++++-- 3 files changed, 50 insertions(+), 2 deletions(-) (limited to 'ShiftOS.WinForms/Applications/MUDControlCentre.cs') diff --git a/ShiftOS.WinForms/Applications/MUDControlCentre.cs b/ShiftOS.WinForms/Applications/MUDControlCentre.cs index 5a51f48..b8ba5f3 100644 --- a/ShiftOS.WinForms/Applications/MUDControlCentre.cs +++ b/ShiftOS.WinForms/Applications/MUDControlCentre.cs @@ -569,6 +569,8 @@ System version: {SaveSystem.CurrentSave.MajorVersion}.{SaveSystem.CurrentSave.Mi Shared scripts: {scripts} +Reputation: {SaveSystem.CurrentSave.RawReputation} ({SaveSystem.CurrentSave.Reputation}) + Current legions: {legionname}"; } @@ -640,6 +642,11 @@ Current legions: {legionname}"; ServerManager.SendMessage("legion_get_all", ""); } + public void ShowLegionSelector() + { + ServerManager.SendMessage("legion_get_all", ""); + } + private void btnjoinlegion_Click(object sender, EventArgs e) { string shortname = lblegiontitle.Text.Split(']')[0].Remove(0, 1); @@ -648,8 +655,12 @@ Current legions: {legionname}"; SaveSystem.SaveGame(); ServerManager.SendMessage("user_get_legion", JsonConvert.SerializeObject(SaveSystem.CurrentSave)); + LegionChanged?.Invoke(); + } + public event Action LegionChanged; + private void btnleavelegion_Click(object sender, EventArgs e) { string shortname = lblegiontitle.Text.Split(']')[0].Remove(0, 1); diff --git a/ShiftOS.WinForms/Stories/LegionStory.cs b/ShiftOS.WinForms/Stories/LegionStory.cs index 424c54b..00c7544 100644 --- a/ShiftOS.WinForms/Stories/LegionStory.cs +++ b/ShiftOS.WinForms/Stories/LegionStory.cs @@ -122,6 +122,39 @@ namespace ShiftOS.WinForms.Stories waiting = true; while (waiting == true) Thread.Sleep(25); + WriteLine($"Your class has been selected. You are a(n) {SaveSystem.CurrentSave.Class}."); + WriteLine("On this screen, you can see a detailed view of your status within the digital society."); + WriteLine("You'll see this screen everytime you start the MUD Control Centre."); + WriteLine("Like the sos.status command, it shows your Codepoints, the upgrades you've bought and the upgrades available, but it also shows your reputation, legion, shops, and various other details."); + WriteLine("Right now, you are not in any legions. This is about to change."); + WriteLine("I will open the Legion Selector for you. The best legions will be shown at the top of the list."); + WriteLine("Pay attention to their Perdominent Class and their Collective Reputation values. These values will indicate how morally correct the legion is, and may affect your personal reputation."); + Desktop.InvokeOnWorkerThread(() => + { + mud.ShowLegionSelector(); + mud.LegionChanged += () => + { + waiting = false; + }; + }); + waiting = true; + while (waiting == true) + Thread.Sleep(25); + WriteLine($"So, you've joined the [{SaveSystem.CurrentSave.CurrentLegions[0]}] legion."); + WriteLine("Now you can see a more detailed view of the legion - who's inside, how many Codepoints the legion has, and you can also join their private chat."); + WriteLine("It's up to you what you do next. Get acquianted with your new team. I've gotta go work on something."); + WriteLine("I will contact you as you become more well-known."); + WriteLine("OH, one more thing."); + WriteLine("You're probably wondering about your reputation. Well, right now you have a Neutral reputation."); + WriteLine("This means, of course, that people don't have an opinion on you. They don't really know you exist."); + WriteLine("As you start performing large-scale operations within the digital society, your reputation will raise or lower gradually depending on how morally correct that action was."); + WriteLine("For example, if you start performing criminal actions, your reputation will start to drop, and people will start to distrust you."); + WriteLine("And if your rep drops too far, the MUD Safety Task Force, and other safety activists may start going after you and trying to take you off the MUD."); + WriteLine("However, if you perform morally-correct actions, your reputation will rise, and more people will trust you with more sensitive data and operations."); + WriteLine("Be careful though, if you have too high of a reputation, lower-rep groups will try to attack you."); + WriteLine("And, I'd be careful of Investigators. If they suspect anything bad about you, they'll do whatever they can to prove you guilty and dramatically decrease your reputation."); + WriteLine("Anyways, I've got some other sentiences I need to... have a little...word...with. Keep on shifting."); + WriteLine("--user has disconnected from your system.--", false); TerminalBackend.PrefixEnabled = true; TerminalBackend.PrintPrompt(); }); diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs index 3cd1640..0257f11 100644 --- a/ShiftOS_TheReturn/Commands.cs +++ b/ShiftOS_TheReturn/Commands.cs @@ -480,11 +480,15 @@ namespace ShiftOS.Engine [Command("status")] public static bool Status() { - Console.WriteLine($@"ShiftOS version {Assembly.GetExecutingAssembly().GetName().Version.ToString()} + string status = $@"ShiftOS version {Assembly.GetExecutingAssembly().GetName().Version.ToString()} Codepoints: {SaveSystem.CurrentSave.Codepoints} Upgrades: {SaveSystem.CurrentSave.CountUpgrades()} installed, - {Shiftorium.GetAvailable().Length} available"); + {Shiftorium.GetAvailable().Length} available"; + + if (Shiftorium.UpgradeInstalled("mud_control_centre")) + status += Environment.NewLine + $"Reputation: {SaveSystem.CurrentSave.RawReputation} ({SaveSystem.CurrentSave.Reputation})"; + Console.WriteLine(status); return true; } } -- cgit v1.2.3 From fde832b35763443afdc57dc8a5d82fb3bb25009b Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 27 May 2017 12:11:36 -0400 Subject: simplesrc refurbishment --- ShiftOS.Objects/ChatRoom.cs | 16 +++ ShiftOS.Objects/ShiftOS.Objects.csproj | 1 + ShiftOS.WinForms/Applications/Chat.Designer.cs | 97 +++++++++++++ ShiftOS.WinForms/Applications/Chat.cs | 161 +++++++++++++--------- ShiftOS.WinForms/Applications/MUDControlCentre.cs | 3 +- ShiftOS_TheReturn/Story.cs | 7 +- 6 files changed, 220 insertions(+), 65 deletions(-) create mode 100644 ShiftOS.Objects/ChatRoom.cs (limited to 'ShiftOS.WinForms/Applications/MUDControlCentre.cs') diff --git a/ShiftOS.Objects/ChatRoom.cs b/ShiftOS.Objects/ChatRoom.cs new file mode 100644 index 0000000..e4c89ce --- /dev/null +++ b/ShiftOS.Objects/ChatRoom.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ShiftOS.Objects +{ + public class ChatRoom + { + public string Id { get; set; } + public string Name { get; set; } + + public List Messages { get; set; } + } +} diff --git a/ShiftOS.Objects/ShiftOS.Objects.csproj b/ShiftOS.Objects/ShiftOS.Objects.csproj index 3c36d8c..9ed8c3b 100644 --- a/ShiftOS.Objects/ShiftOS.Objects.csproj +++ b/ShiftOS.Objects/ShiftOS.Objects.csproj @@ -45,6 +45,7 @@ + diff --git a/ShiftOS.WinForms/Applications/Chat.Designer.cs b/ShiftOS.WinForms/Applications/Chat.Designer.cs index d4b7211..d51b732 100644 --- a/ShiftOS.WinForms/Applications/Chat.Designer.cs +++ b/ShiftOS.WinForms/Applications/Chat.Designer.cs @@ -61,13 +61,23 @@ namespace ShiftOS.WinForms.Applications this.tsbottombar = new System.Windows.Forms.ToolStrip(); this.txtuserinput = new System.Windows.Forms.ToolStripTextBox(); this.btnsend = new System.Windows.Forms.ToolStripButton(); + this.pnlstart = new System.Windows.Forms.Panel(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.txtchatid = new System.Windows.Forms.TextBox(); + this.btnjoin = new System.Windows.Forms.Button(); this.panel1.SuspendLayout(); this.toolStrip1.SuspendLayout(); this.tsbottombar.SuspendLayout(); + this.pnlstart.SuspendLayout(); + this.flowLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // // panel1 // + this.panel1.Controls.Add(this.pnlstart); this.panel1.Controls.Add(this.rtbchat); this.panel1.Controls.Add(this.toolStrip1); this.panel1.Controls.Add(this.tsbottombar); @@ -141,6 +151,82 @@ namespace ShiftOS.WinForms.Applications this.btnsend.Text = "Send"; this.btnsend.Click += new System.EventHandler(this.btnsend_Click); // + // pnlstart + // + this.pnlstart.Controls.Add(this.flowLayoutPanel1); + this.pnlstart.Controls.Add(this.label3); + this.pnlstart.Controls.Add(this.label2); + this.pnlstart.Controls.Add(this.label1); + this.pnlstart.Dock = System.Windows.Forms.DockStyle.Fill; + this.pnlstart.Location = new System.Drawing.Point(0, 25); + this.pnlstart.Name = "pnlstart"; + this.pnlstart.Size = new System.Drawing.Size(633, 268); + this.pnlstart.TabIndex = 4; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Dock = System.Windows.Forms.DockStyle.Top; + this.label1.Location = new System.Drawing.Point(0, 0); + this.label1.Name = "label1"; + this.label1.Padding = new System.Windows.Forms.Padding(10); + this.label1.Size = new System.Drawing.Size(143, 33); + this.label1.TabIndex = 0; + this.label1.Tag = "header1"; + this.label1.Text = "Welcome to SimpleSRC!"; + // + // label2 + // + this.label2.Dock = System.Windows.Forms.DockStyle.Top; + this.label2.Location = new System.Drawing.Point(0, 33); + this.label2.Name = "label2"; + this.label2.Padding = new System.Windows.Forms.Padding(10); + this.label2.Size = new System.Drawing.Size(633, 52); + this.label2.TabIndex = 1; + this.label2.Text = "SimpleSRC is a simple chat program that utilises the ShiftOS Relay Chat protocol." + + " All you have to do is enter a chat code or system name, and SimpleSRC will try " + + "to initiate a chat for you."; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Dock = System.Windows.Forms.DockStyle.Top; + this.label3.Location = new System.Drawing.Point(0, 85); + this.label3.Name = "label3"; + this.label3.Padding = new System.Windows.Forms.Padding(10); + this.label3.Size = new System.Drawing.Size(79, 33); + this.label3.TabIndex = 2; + this.label3.Tag = "header3"; + this.label3.Text = "Join a chat"; + // + // flowLayoutPanel1 + // + this.flowLayoutPanel1.AutoSize = true; + this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.flowLayoutPanel1.Controls.Add(this.txtchatid); + this.flowLayoutPanel1.Controls.Add(this.btnjoin); + this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Top; + this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 118); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(633, 29); + this.flowLayoutPanel1.TabIndex = 3; + // + // txtchatid + // + this.txtchatid.Location = new System.Drawing.Point(3, 3); + this.txtchatid.Name = "txtchatid"; + this.txtchatid.Size = new System.Drawing.Size(192, 20); + this.txtchatid.TabIndex = 0; + // + // btnjoin + // + this.btnjoin.Location = new System.Drawing.Point(201, 3); + this.btnjoin.Name = "btnjoin"; + this.btnjoin.Size = new System.Drawing.Size(75, 23); + this.btnjoin.TabIndex = 1; + this.btnjoin.Text = "Join"; + this.btnjoin.UseVisualStyleBackColor = true; + // // Chat // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -154,6 +240,10 @@ namespace ShiftOS.WinForms.Applications this.toolStrip1.PerformLayout(); this.tsbottombar.ResumeLayout(false); this.tsbottombar.PerformLayout(); + this.pnlstart.ResumeLayout(false); + this.pnlstart.PerformLayout(); + this.flowLayoutPanel1.ResumeLayout(false); + this.flowLayoutPanel1.PerformLayout(); this.ResumeLayout(false); } @@ -168,5 +258,12 @@ namespace ShiftOS.WinForms.Applications private System.Windows.Forms.ToolStrip tsbottombar; private System.Windows.Forms.ToolStripTextBox txtuserinput; private System.Windows.Forms.ToolStripButton btnsend; + private System.Windows.Forms.Panel pnlstart; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.TextBox txtchatid; + private System.Windows.Forms.Button btnjoin; } } diff --git a/ShiftOS.WinForms/Applications/Chat.cs b/ShiftOS.WinForms/Applications/Chat.cs index caf8cd2..e150b1a 100644 --- a/ShiftOS.WinForms/Applications/Chat.cs +++ b/ShiftOS.WinForms/Applications/Chat.cs @@ -33,75 +33,26 @@ using System.Threading.Tasks; using System.Windows.Forms; using Newtonsoft.Json; using ShiftOS.Engine; +using System.Threading; namespace ShiftOS.WinForms.Applications { [MultiplayerOnly] + [WinOpen("simplesrc")] + [Launcher("SimpleSRC Client", false, null, "Networking")] + [DefaultTitle("SimpleSRC Client")] public partial class Chat : UserControl, IShiftOSWindow { - public Chat(string chatId) + public Chat() { InitializeComponent(); - id = chatId; - ServerManager.MessageReceived += (msg) => - { - if (msg.Name == "chat_msgreceived") - { - try - { - this.Invoke(new Action(() => - { - try - { - var args = JsonConvert.DeserializeObject>(msg.Contents); - var cmsg = new ShiftOS.Objects.ChatMessage(args["Username"] as string, args["SystemName"] as string, args["Message"] as string, args["Channel"] as string); - if (id == cmsg.Channel) - rtbchat.AppendText($"[{cmsg.Username}@{cmsg.SystemName}]: {cmsg.Message}{Environment.NewLine}"); - } - catch (Exception ex) - { - rtbchat.AppendText($"[system@multiuserdomain] Exception thrown by client: {ex}"); - } - })); - } - catch { } - } - else if(msg.Name == "chatlog") - { - try - { - this.Invoke(new Action(() => - { - rtbchat.AppendText(msg.Contents); - })); - } - catch { } - } - }; } - public void SendMessage(string msg) - { - if (!string.IsNullOrWhiteSpace(msg)) - { - rtbchat.AppendText($"[{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}] {msg}{Environment.NewLine}"); - - ServerManager.SendMessage("chat_send", JsonConvert.SerializeObject(new ShiftOS.Objects.ChatMessage(SaveSystem.CurrentSave.Username, SaveSystem.CurrentSave.SystemName, msg, id))); - } - else - { - rtbchat.AppendText($"[sys@multiuserdomain] You can't send blank messages. (only you can see this)"); - } - } - - - private string id = ""; - public void OnLoad() { - ServerManager.SendMessage("chat_getlog", JsonConvert.SerializeObject(new ShiftOS.Objects.ChatLogRequest(id, 50))); - - SendMessage("User has joined the chat."); + AllInstances.Add(this); + if (!string.IsNullOrWhiteSpace(ChatID)) + pnlstart.SendToBack(); RefreshUserInput(); } @@ -112,8 +63,8 @@ namespace ShiftOS.WinForms.Applications public bool OnUnload() { - SendMessage("User has left the chat."); - id = null; + AllInstances.Remove(this); + ChatID = null; return true; } @@ -146,15 +97,101 @@ namespace ShiftOS.WinForms.Applications { rtbchat.SelectionStart = rtbchat.Text.Length; rtbchat.ScrollToCaret(); - tschatid.Text = id; - tsuserdata.Text = $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}"; + tschatid.Text = ChatID; + AppearanceManager.SetWindowTitle(this, tschatid.Text + " - SimpleSRC Client"); + tsuserdata.Text = $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}"; RefreshUserInput(); } + public static readonly List AllInstances = new List(); + + public static void SendMessage(string user, string destination, string msg) + { + foreach(var chat in AllInstances) + { + chat.PostMessage(user, destination, msg); + } + } + + public string ChatID = ""; + + public void PostMessage(string user, string destination, string message) + { + if (ChatID == destination) + { + this.Invoke(new Action(() => + { + rtbchat.SelectionFont = new Font(rtbchat.Font, FontStyle.Bold); + rtbchat.AppendText($"[{user}] "); + rtbchat.SelectionFont = rtbchat.Font; + rtbchat.AppendText(message); + rtbchat.AppendText(Environment.NewLine + Environment.NewLine); + })); + } + } + private void btnsend_Click(object sender, EventArgs e) { - SendMessage(txtuserinput.Text); + //Update ALL chat windows with this message if they're connected to this chat. + SendMessage($"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}", ChatID, txtuserinput.Text); txtuserinput.Text = ""; } + + [Story("story_thefennfamily")] + public static void Story_TheFennFamily() + { + bool complete = false; + Infobox.Show("SimpleSRC", "A direct message has been sent to you on SimpleSRC from user \"maureenfenn@trisys\".", () => + { + string ch = "maureenfenn@trisys"; + var c = new Chat(); + c.ChatID = ch; + AppearanceManager.SetupWindow(c); + string you = $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}"; + + var t = new Thread(() => + { + SendMessage(you, ch, "User has joined the chat."); + Thread.Sleep(2000); + SendMessage(ch, ch, "Hello, " + you + ". My name is Maureen. Maureen Fenn."); + Thread.Sleep(2500); + SendMessage(ch, ch, "I am the author of the various Tri applications you may see on Appscape."); + Thread.Sleep(2000); + SendMessage(ch, ch, "I need your help with something..."); + Thread.Sleep(2500); + SendMessage(ch, ch, "Firstly, a little backstory. There was a time in ShiftOS when none of us were connected."); + Thread.Sleep(2500); + SendMessage(ch, ch, "There wasn't a Digital Society, we didn't have chat applications or anything..."); + Thread.Sleep(2000); + SendMessage(ch, ch, "All we had was the Shiftnet."); + Thread.Sleep(2500); + SendMessage(ch, ch, "However, in 2016, something happened called the \"connected revolution\". It was like, the invention of the Internet - it was huge for the world of ShiftOS."); + Thread.Sleep(2500); + SendMessage(ch, ch, "Before this, the only way you could earn Codepoints was through playing games in ShiftOS."); + Thread.Sleep(2500); + SendMessage(ch, ch, "I was the one who coded those games, and I would put them on a Shiftnet website that you can still access today, shiftnet/main/shiftgames."); + Thread.Sleep(2500); + SendMessage(ch, ch, "But when the Connected Revolution took place, things got difficult. My son, Nalyr Fenn, was born, and people stopped using my software and instead moved on to hacking eachother and stealing peoples' Codepoints."); + Thread.Sleep(2500); + SendMessage(ch, ch, "When Nalyr's sentience levels reached near human - i.e, he grew up, we decided to start TriOffice. It was a huge success, thanks to Aiden Nirh, the guy who runs Appscape."); + Thread.Sleep(2500); + SendMessage(ch, ch, "However... a few months ago he cut contact with us and we stopped receiving Codepoints from TriOffice."); + Thread.Sleep(2500); + SendMessage(ch, ch, "I'm running low - I can't afford to keep my system running much longer. You have to help!"); + Thread.Sleep(2500); + SendMessage(ch, ch, "Perhaps, you could breach Aiden's server and look for clues as to why he's against us? I'll reward you with the last Codepoints I have."); + Thread.Sleep(2500); + SendMessage(you, ch, "Alright, I'm in - but I don't know where to begin..."); + Thread.Sleep(2500); + SendMessage(ch, ch, "A little birdie tells me you know about the RTS exploits going around... Try using that on Aiden's server. You can find his systemname on Appscape under \"Contact Us.\" He has a mailserver on Appscape - and also has RTS on the same server."); + Thread.Sleep(2500); + SendMessage(ch, ch, "Good luck... My life depends on you!"); + }); + t.IsBackground = true; + t.Start(); + }); + while (!complete) + Thread.Sleep(10); + } } } diff --git a/ShiftOS.WinForms/Applications/MUDControlCentre.cs b/ShiftOS.WinForms/Applications/MUDControlCentre.cs index b8ba5f3..ab89ffd 100644 --- a/ShiftOS.WinForms/Applications/MUDControlCentre.cs +++ b/ShiftOS.WinForms/Applications/MUDControlCentre.cs @@ -274,9 +274,10 @@ namespace ShiftOS.WinForms.Applications } + [Obsolete("MUD control center is dying! KILL IT!")] public void OpenChat(string id) { - AppearanceManager.SetupWindow(new Chat(id)); +// AppearanceManager.SetupWindow(new Chat(id)); } private Shop editingShop = null; diff --git a/ShiftOS_TheReturn/Story.cs b/ShiftOS_TheReturn/Story.cs index bcee49c..d62dae4 100644 --- a/ShiftOS_TheReturn/Story.cs +++ b/ShiftOS_TheReturn/Story.cs @@ -66,8 +66,11 @@ namespace ShiftOS.Engine var story = attrib as StoryAttribute; if(story.StoryID == stid) { - mth.Invoke(null, null); - SaveSystem.CurrentSave.StoriesExperienced.Add(stid); + new Thread(() => + { + mth.Invoke(null, null); + SaveSystem.CurrentSave.StoriesExperienced.Add(stid); + }).Start(); return; } } -- cgit v1.2.3 From c7ba7d733c756d196f98dd4533289a1ef4db715f Mon Sep 17 00:00:00 2001 From: Rylan/wowmom98 Date: Sun, 28 May 2017 14:44:08 -0400 Subject: un obsoleting --- ShiftOS.Server/Core.cs | 3 ++- ShiftOS.WinForms/Applications/MUDControlCentre.cs | 16 ++++++++-------- ShiftOS.WinForms/Applications/Skin Loader.cs | 2 +- ShiftOS.WinForms/HackerCommands.cs | 8 ++++---- ShiftOS.WinForms/Oobe.cs | 2 +- ShiftOS.WinForms/Stories/LegionStory.cs | 2 +- ShiftOS_TheReturn/Commands.cs | 2 +- ShiftOS_TheReturn/Scripting.cs | 2 +- ShiftOS_TheReturn/ServerManager.cs | 4 ++-- ShiftOS_TheReturn/TerminalBackend.cs | 8 ++++---- 10 files changed, 25 insertions(+), 24 deletions(-) (limited to 'ShiftOS.WinForms/Applications/MUDControlCentre.cs') diff --git a/ShiftOS.Server/Core.cs b/ShiftOS.Server/Core.cs index 7bb5b1d..a53a5bc 100644 --- a/ShiftOS.Server/Core.cs +++ b/ShiftOS.Server/Core.cs @@ -32,6 +32,7 @@ using NetSockets; using Newtonsoft.Json; using System.IO; using static ShiftOS.Server.Program; +using ShiftOS.Engine namespace ShiftOS.Server @@ -180,7 +181,7 @@ namespace ShiftOS.Server if (sve.EndsWith(".save")) { var save = JsonConvert.DeserializeObject(File.ReadAllText(sve)); - accs.Add($"{save.Username}@{save.SystemName}"); + accs.Add($"{ShiftOS.Engine.SaveSytem.CurrentUser.Username}@{save.SystemName}"); } } diff --git a/ShiftOS.WinForms/Applications/MUDControlCentre.cs b/ShiftOS.WinForms/Applications/MUDControlCentre.cs index ab89ffd..97212e7 100644 --- a/ShiftOS.WinForms/Applications/MUDControlCentre.cs +++ b/ShiftOS.WinForms/Applications/MUDControlCentre.cs @@ -100,7 +100,7 @@ namespace ShiftOS.WinForms.Applications { ServerManager.SendMessage("shop_removeowned", JsonConvert.SerializeObject(new { - username = SaveSystem.CurrentSave.Username + username = SaveSystem.CurrentUser.Username })); ShowCreateShop(); } @@ -290,7 +290,7 @@ namespace ShiftOS.WinForms.Applications creatingShop = true; editingShop.Name = "My shop"; editingShop.Description = "My shop has lots of awesome items. You should buy from my shop."; - editingShop.Owner = SaveSystem.CurrentSave.Username; + editingShop.Owner = SaveSystem.CurrentUser.Username; editingShop.Items = new List(); shop_editor.BringToFront(); PopulateShopEditor(); @@ -402,7 +402,7 @@ namespace ShiftOS.WinForms.Applications lbprice.Text = $"Cost: {item.Cost} CP"; btnbuy.Show(); }; - if(shop.Owner == SaveSystem.CurrentSave.Username) + if(shop.Owner == SaveSystem.CurrentUser.Username) { btneditshop.Show(); } @@ -560,7 +560,7 @@ namespace ShiftOS.WinForms.Applications you_systemstatus.BringToFront(); - lblsysstatus.Text = $@"Username: {SaveSystem.CurrentSave.Username} + lblsysstatus.Text = $@"Username: {SaveSystem.CurrentUser.Username} System name: {SaveSystem.CurrentSave.SystemName} Codepoints: {SaveSystem.CurrentSave.Codepoints} @@ -591,7 +591,7 @@ Current legions: {legionname}"; private void tsMemos_Click(object sender, EventArgs e) { ServerManager.SendMessage("get_memos_for_user", $@"{{ - username: ""{SaveSystem.CurrentSave.Username}"" + username: ""{SaveSystem.CurrentUser.Username}"" }}"); you_memos.BringToFront(); } @@ -812,7 +812,7 @@ Current legions: {legionname}"; { ServerManager.SendMessage("user_shop_check", JsonConvert.SerializeObject(new { - username = SaveSystem.CurrentSave.Username + username = SaveSystem.CurrentUser.Username })); } @@ -895,7 +895,7 @@ Current legions: {legionname}"; private void myShopToolStripMenuItem_Click(object sender, EventArgs e) { - ServerManager.SendMessage("user_get_shop", SaveSystem.CurrentSave.Username); + ServerManager.SendMessage("user_get_shop", SaveSystem.CurrentUser.Username); } private void btneditshop_Click(object sender, EventArgs e) @@ -923,7 +923,7 @@ Current legions: {legionname}"; { ServerManager.SendMessage("delete_save", JsonConvert.SerializeObject(new ClientSave { - Username = SaveSystem.CurrentSave.Username, + Username = SaveSystem.CurrentUser.Username, Password = SaveSystem.CurrentSave.Password })); diff --git a/ShiftOS.WinForms/Applications/Skin Loader.cs b/ShiftOS.WinForms/Applications/Skin Loader.cs index 90b05a1..e4f0597 100644 --- a/ShiftOS.WinForms/Applications/Skin Loader.cs +++ b/ShiftOS.WinForms/Applications/Skin Loader.cs @@ -306,7 +306,7 @@ namespace ShiftOS.WinForms.Applications System.IO.Directory.CreateDirectory(Paths.SharedFolder + "\\skins"); } - string path = Paths.SharedFolder + "\\skins\\" + SaveSystem.CurrentSave.Username + "-" + fname; + string path = Paths.SharedFolder + "\\skins\\" + SaveSystem.CurrentUser.Username + "-" + fname; System.IO.File.WriteAllText(path, JsonConvert.SerializeObject(LoadedSkin)); }))); diff --git a/ShiftOS.WinForms/HackerCommands.cs b/ShiftOS.WinForms/HackerCommands.cs index 86981f4..47b486d 100644 --- a/ShiftOS.WinForms/HackerCommands.cs +++ b/ShiftOS.WinForms/HackerCommands.cs @@ -107,7 +107,7 @@ namespace ShiftOS.WinForms Thread.Sleep(2000); writeSlow($"Hello there, fellow multi-user domain user."); writeSlow("My name, as you can tell, is hacker101."); - writeSlow("And yours must be... don't say it... it's " + SaveSystem.CurrentSave.Username + "@" + SaveSystem.CurrentSave.SystemName + ", right?"); + writeSlow("And yours must be... don't say it... it's " + SaveSystem.CurrentUser.Username + "@" + SaveSystem.CurrentSave.SystemName + ", right?"); writeSlow("Of course it is."); writeSlow("And I bet you 10,000 Codepoints that you have... " + SaveSystem.CurrentSave.Codepoints.ToString() + " Codepoints."); writeSlow("Oh, and how much upgrades have you installed since you first started using ShiftOS?"); @@ -135,7 +135,7 @@ namespace ShiftOS.WinForms Console.Write(" ..done"); TerminalBackend.InStory = false; TerminalBackend.PrefixEnabled = true; - Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); + Console.Write($"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); StartHackerTutorial(); TerminalBackend.PrefixEnabled = true; TerminalBackend.PrintPrompt(); @@ -454,7 +454,7 @@ namespace ShiftOS.WinForms var sve = JsonConvert.DeserializeObject(msg.Contents); if(sve.Password == pass) { - Console.WriteLine("Username: " + sve.Username); + Console.WriteLine("Username: " + SaveSystem.CurrentUser.Username); Console.WriteLine("Password: " + sve.Password); Console.WriteLine("System name: " + sve.SystemName); Console.WriteLine(); @@ -531,7 +531,7 @@ namespace ShiftOS.WinForms } sve.Codepoints -= amount; - SaveSystem.TransferCodepointsFrom(sve.Username, amount); + SaveSystem.TransferCodepointsFrom(SaveSystem.CurrentUser.Username, amount); ServerManager.SendMessage("mud_save_allow_dead", JsonConvert.SerializeObject(sve)); SaveSystem.SaveGame(); } diff --git a/ShiftOS.WinForms/Oobe.cs b/ShiftOS.WinForms/Oobe.cs index 9182b4b..90395a7 100644 --- a/ShiftOS.WinForms/Oobe.cs +++ b/ShiftOS.WinForms/Oobe.cs @@ -302,7 +302,7 @@ namespace ShiftOS.WinForms var client = new UniteClient("http://getshiftos.ml", token); var sve = new Save(); - sve.Username = client.GetEmail(); + SaveSystem.CurrentUser.Username = client.GetEmail(); sve.Password = Guid.NewGuid().ToString(); sve.SystemName = client.GetSysName(); sve.UniteAuthToken = token; diff --git a/ShiftOS.WinForms/Stories/LegionStory.cs b/ShiftOS.WinForms/Stories/LegionStory.cs index 53d55fb..433ad2d 100644 --- a/ShiftOS.WinForms/Stories/LegionStory.cs +++ b/ShiftOS.WinForms/Stories/LegionStory.cs @@ -142,7 +142,7 @@ namespace ShiftOS.WinForms.Stories { WriteLine("DevX@mud - user connecting to your system.", false); Thread.Sleep(2000); - WriteLine($"Hello, {SaveSystem.CurrentSave.Username}. It's been a while."); + WriteLine($"Hello, {SaveSystem.CurrentUser.Username}. It's been a while."); WriteLine("My intelligence suggests you've installed all GUI-based Shiftorium upgrades."); WriteLine("Bet you're liking ShiftOS now that the terminal isn't the only way you can control it."); WriteLine("Well, now it's time to introduce your next task."); diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs index 96e5af5..b97cd1d 100644 --- a/ShiftOS_TheReturn/Commands.cs +++ b/ShiftOS_TheReturn/Commands.cs @@ -95,7 +95,7 @@ namespace ShiftOS.Engine { TerminalBackend.IsForwardingConsoleWrites = forwarding; TerminalBackend.ForwardGUID = (forwarding == true) ? fGuid : null; - Console.WriteLine($"{SaveSystem.CurrentSave.Username} says \"{result}\"."); + Console.WriteLine($"{SaveSystem.CurrentUser.Username} says \"{result}\"."); TerminalBackend.IsForwardingConsoleWrites = false; }; Desktop.InvokeOnWorkerThread(new Action(() => diff --git a/ShiftOS_TheReturn/Scripting.cs b/ShiftOS_TheReturn/Scripting.cs index dd5acfd..61c6676 100644 --- a/ShiftOS_TheReturn/Scripting.cs +++ b/ShiftOS_TheReturn/Scripting.cs @@ -312,7 +312,7 @@ end"); { Console.WriteLine(""); Lua(lua); - Console.WriteLine($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); + Console.WriteLine($"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); } catch (Exception e) { diff --git a/ShiftOS_TheReturn/ServerManager.cs b/ShiftOS_TheReturn/ServerManager.cs index f0acaa2..abb674d 100644 --- a/ShiftOS_TheReturn/ServerManager.cs +++ b/ShiftOS_TheReturn/ServerManager.cs @@ -148,7 +148,7 @@ Ping: {ServerManager.DigitalSocietyPing} ms switch(msg.Name) { case "getguid_fromserver": - if(SaveSystem.CurrentSave.Username == msg.Contents) + if(SaveSystem.CurrentUser.Username == msg.Contents) { client.Send(new NetObject("yes_i_am", new ServerMessage { @@ -244,7 +244,7 @@ Ping: {ServerManager.DigitalSocietyPing} ms else if(msg.Name == "update_your_cp") { var args = JsonConvert.DeserializeObject>(msg.Contents); - if(args["username"] as string == SaveSystem.CurrentSave.Username) + if(args["username"] as string == SaveSystem.CurrentUser.Username) { SaveSystem.CurrentSave.Codepoints += (long)args["amount"]; Desktop.InvokeOnWorkerThread(new Action(() => diff --git a/ShiftOS_TheReturn/TerminalBackend.cs b/ShiftOS_TheReturn/TerminalBackend.cs index 1c024eb..6104927 100644 --- a/ShiftOS_TheReturn/TerminalBackend.cs +++ b/ShiftOS_TheReturn/TerminalBackend.cs @@ -581,7 +581,7 @@ namespace ShiftOS.Engine if (TerminalBackend.PrefixEnabled) { - text3 = text4.Remove(0, $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ".Length); + text3 = text4.Remove(0, $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ".Length); } IsForwardingConsoleWrites = true; if (TerminalBackend.InStory == false) @@ -590,7 +590,7 @@ namespace ShiftOS.Engine } if (TerminalBackend.PrefixEnabled) { - Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); + Console.Write($"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); } IsForwardingConsoleWrites = false; } @@ -605,7 +605,7 @@ namespace ShiftOS.Engine string pass = a["password"] as string; string sys = a["sysname"] as string; string guid = msg.GUID; - if (SaveSystem.CurrentSave.Username == uName && SaveSystem.CurrentSave.Password == pass && CurrentSave.SystemName == sys) + if (SaveSystem.CurrentUser.Username == uName && SaveSystem.CurrentSave.Password == pass && CurrentSave.SystemName == sys) { ForwardGUID = guid; ServerManager.SendMessage("trm_handshake_accept", $@"{{ @@ -615,7 +615,7 @@ namespace ShiftOS.Engine IsForwardingConsoleWrites = true; InvokeCommand("sos.status"); - Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); + Console.Write($"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); IsForwardingConsoleWrites = false; } } -- cgit v1.2.3