From fc55d4feecb64c2bae355cceac93bdac73fe00ea Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 5 Mar 2017 08:02:30 -0500 Subject: hang on, busy making a sad victor tran face --- ShiftOS.WinForms/Resources/ShiftnetServices.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 ShiftOS.WinForms/Resources/ShiftnetServices.txt (limited to 'ShiftOS.WinForms/Resources/ShiftnetServices.txt') diff --git a/ShiftOS.WinForms/Resources/ShiftnetServices.txt b/ShiftOS.WinForms/Resources/ShiftnetServices.txt new file mode 100644 index 0000000..a396849 --- /dev/null +++ b/ShiftOS.WinForms/Resources/ShiftnetServices.txt @@ -0,0 +1,20 @@ +[ + { + Name: "Freebie Solutions", + DownloadSpeed: 256, + CostPerMonth: 0, + Description: "The Shiftnet is a wonderful place full of apps, games, websites and skins for ShiftOS. + +With Freebie Solutions from ShiftSoft, you'll be able to traverse the Shiftnet without any worry about monthly fees.", + Company: "ShiftSoft" + }, + { + Company: "" + }, + { + + }, + { + + }, +] \ No newline at end of file -- cgit v1.2.3 From 308006ff9de8ce34e00d31d39ccffa43d98cba5e Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 5 Mar 2017 10:28:51 -0500 Subject: Add Shiftnet subscription metadata --- ShiftOS.WinForms/Applications/Downloader.cs | 21 +++------------------ ShiftOS.WinForms/Resources/ShiftnetServices.txt | 16 +++++++++++++--- 2 files changed, 16 insertions(+), 21 deletions(-) (limited to 'ShiftOS.WinForms/Resources/ShiftnetServices.txt') diff --git a/ShiftOS.WinForms/Applications/Downloader.cs b/ShiftOS.WinForms/Applications/Downloader.cs index 48a5cfd..da90c6d 100644 --- a/ShiftOS.WinForms/Applications/Downloader.cs +++ b/ShiftOS.WinForms/Applications/Downloader.cs @@ -173,28 +173,13 @@ namespace ShiftOS.WinForms.Applications /// Download speed in bytes. public static int GetDownloadSpeed() { - switch (SaveSystem.CurrentSave.ShiftnetSubscription) - { - case 0: - return 256/*B*/; - case 1: - return 1024 * 1024/*KB*/; - case 2: - return 1024 * 10240/*KB*/; - case 3: - return 1024 * 1024 * 1024/*MB*/; - } - return 256; + return GetAllSubscriptions()[SaveSystem.CurrentSave.ShiftnetSubscription].DownloadSpeed; } - public static IEnumerable GetAllSubscriptions() + public static ShiftOS.Objects.EngineShiftnetSubscription[] GetAllSubscriptions() { //For now we'll have them hard-coded into the client but in future they'll be in the MUD. - - foreach(var sub in JsonConvert.DeserializeObject(Properties.Resources.ShiftnetServices)) - { - yield return sub; - } + return JsonConvert.DeserializeObject(Properties.Resources.ShiftnetServices); } public static void StartDownload(Download down) diff --git a/ShiftOS.WinForms/Resources/ShiftnetServices.txt b/ShiftOS.WinForms/Resources/ShiftnetServices.txt index a396849..e9c04e1 100644 --- a/ShiftOS.WinForms/Resources/ShiftnetServices.txt +++ b/ShiftOS.WinForms/Resources/ShiftnetServices.txt @@ -9,12 +9,22 @@ With Freebie Solutions from ShiftSoft, you'll be able to traverse the Shiftnet w Company: "ShiftSoft" }, { - Company: "" + Company: "Shiftcast", + Name: "NetXtreme Hyper Edition", + CostPerMonth: 1500, + DownloadSpeed: 524288, //512 kb/s + Description: "It's time to supercharge your Shiftnet experience. With all the multimedia available, fast download speeds are a must on the Shiftnet. Start your subscription today for the low price of 1500 Codepoints and become a hyper-traveller today." }, { - + Company: "Plumb Corp.", + Name: "youConnect", + CostPerMonth: 4000, + DownloadSpeed: 262144 }, { - + Company: "theCorp", + Name: "theNet", + CostPerMonth: 2000, + DownloadSpeed: 1048576, }, ] \ No newline at end of file -- cgit v1.2.3 From f3af198849c85a05cb402c1e2471387c7bcb9849 Mon Sep 17 00:00:00 2001 From: Rylan/wowmom98 Date: Sun, 5 Mar 2017 10:38:02 -0500 Subject: Rebalences bc michael doesnt know what he's doing --- ShiftOS.WinForms/Resources/ShiftnetServices.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ShiftOS.WinForms/Resources/ShiftnetServices.txt') diff --git a/ShiftOS.WinForms/Resources/ShiftnetServices.txt b/ShiftOS.WinForms/Resources/ShiftnetServices.txt index e9c04e1..d5b8ab4 100644 --- a/ShiftOS.WinForms/Resources/ShiftnetServices.txt +++ b/ShiftOS.WinForms/Resources/ShiftnetServices.txt @@ -18,13 +18,13 @@ With Freebie Solutions from ShiftSoft, you'll be able to traverse the Shiftnet w { Company: "Plumb Corp.", Name: "youConnect", - CostPerMonth: 4000, - DownloadSpeed: 262144 + CostPerMonth: 6000, + DownloadSpeed: 1048576, //1 mb/s }, { Company: "theCorp", Name: "theNet", - CostPerMonth: 2000, - DownloadSpeed: 1048576, + CostPerMonth: 3000, + DownloadSpeed: 786342, //768 kb/s }, ] \ No newline at end of file -- cgit v1.2.3 From f9acb299c8375522dba1ceed14b20cbf0cf58659 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 5 Mar 2017 14:36:12 -0500 Subject: Paid shiftnet subscriptions are in. You can now subscribe to a shiftnet provider... you just don't get charged....yet. --- ShiftOS.Objects/Save.cs | 2 ++ ShiftOS.WinForms/Applications/Shiftnet.cs | 45 +++++++++++++++++++++++++ ShiftOS.WinForms/Resources/ShiftnetServices.txt | 1 + 3 files changed, 48 insertions(+) (limited to 'ShiftOS.WinForms/Resources/ShiftnetServices.txt') diff --git a/ShiftOS.Objects/Save.cs b/ShiftOS.Objects/Save.cs index 3c7cb39..23c1d0f 100644 --- a/ShiftOS.Objects/Save.cs +++ b/ShiftOS.Objects/Save.cs @@ -65,6 +65,8 @@ namespace ShiftOS.Objects } } + public int LastMonthPaid { get; set; } + public int CountUpgrades() { int count = 0; diff --git a/ShiftOS.WinForms/Applications/Shiftnet.cs b/ShiftOS.WinForms/Applications/Shiftnet.cs index 3da7d6a..22eeec1 100644 --- a/ShiftOS.WinForms/Applications/Shiftnet.cs +++ b/ShiftOS.WinForms/Applications/Shiftnet.cs @@ -122,10 +122,55 @@ namespace ShiftOS.WinForms.Applications { e.Cancel = true; Future.Clear(); + if (Url.StartsWith("runsyscmd/")) + { + ProcessShiftnetCmd(Url.Replace("runsyscmd/", "")); + } + ShiftnetNavigate(Url.ToString()); } } + public void ProcessShiftnetCmd(string cmd) + { + var args = cmd.Split('/'); + switch (args[0]) + { + case "setsnsub": + for(int i = 0; i < DownloadManager.GetAllSubscriptions().Length; i++) + { + if(DownloadManager.GetAllSubscriptions()[i].Name == args[1]) + { + var sub = DownloadManager.GetAllSubscriptions()[i]; + Infobox.PromptYesNo("Shiftnet", $"Are you sure you want to switch your system's Shiftnet subscription to {sub.Name} by {sub.Company}?{Environment.NewLine}{Environment.NewLine}Cost per month: {sub.CostPerMonth} CP{Environment.NewLine}Download speed: {sub.DownloadSpeed} bytes per second", new Action((answer) => + { + if(answer == true) + { + if(SaveSystem.CurrentSave.Codepoints >= sub.CostPerMonth) + { + //Initial fee gets deducted. + SaveSystem.CurrentSave.Codepoints -= sub.CostPerMonth; + //Then we set the subscription. + SaveSystem.CurrentSave.ShiftnetSubscription = i; + //Then we say that we have paid this month. + SaveSystem.CurrentSave.LastMonthPaid = DateTime.Now.Month; + //Then we send our save to the MUD. + SaveSystem.SaveGame(); + + } + else + { + //User can't afford this subscription. + Infobox.Show("Shiftnet - Not enough Codepoints", $"You cannot afford to pay for this subscription at this time. You need {sub.CostPerMonth - SaveSystem.CurrentSave.Codepoints} more Codepoints."); + } + } + })); + } + } + break; + } + } + public Stack History = new Stack(); public Stack Future = new Stack(); diff --git a/ShiftOS.WinForms/Resources/ShiftnetServices.txt b/ShiftOS.WinForms/Resources/ShiftnetServices.txt index d5b8ab4..d8582b6 100644 --- a/ShiftOS.WinForms/Resources/ShiftnetServices.txt +++ b/ShiftOS.WinForms/Resources/ShiftnetServices.txt @@ -26,5 +26,6 @@ With Freebie Solutions from ShiftSoft, you'll be able to traverse the Shiftnet w Name: "theNet", CostPerMonth: 3000, DownloadSpeed: 786342, //768 kb/s + Description: "theNet is not *just* a Shiftnet service provider. It is theGateway to all of theShiftnet and your needs. It is also theValue service provider with theGreatest price and download speed." }, ] \ No newline at end of file -- cgit v1.2.3