diff options
| author | Michael <[email protected]> | 2017-03-05 14:36:12 -0500 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-03-05 14:36:27 -0500 |
| commit | f9acb299c8375522dba1ceed14b20cbf0cf58659 (patch) | |
| tree | cdac7145c1caf181febbb942594b1c9a59f509ba /ShiftOS.WinForms/Applications | |
| parent | 99ba9c1f9c7b433b7defd09fdb110522f3a2b4c2 (diff) | |
| download | shiftos_thereturn-f9acb299c8375522dba1ceed14b20cbf0cf58659.tar.gz shiftos_thereturn-f9acb299c8375522dba1ceed14b20cbf0cf58659.tar.bz2 shiftos_thereturn-f9acb299c8375522dba1ceed14b20cbf0cf58659.zip | |
Paid shiftnet subscriptions are in.
You can now subscribe to a shiftnet provider... you just don't get
charged....yet.
Diffstat (limited to 'ShiftOS.WinForms/Applications')
| -rw-r--r-- | ShiftOS.WinForms/Applications/Shiftnet.cs | 45 |
1 files changed, 45 insertions, 0 deletions
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<bool>((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<string> History = new Stack<string>(); public Stack<string> Future = new Stack<string>(); |
