aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpfg <[email protected]>2017-03-05 15:10:28 -0800
committerpfg <[email protected]>2017-03-05 15:10:28 -0800
commit4723e0a6045bac02b66c4e3b27c712e17e0f015f (patch)
treef2923156b948e757c42ae5f26a2497280f0bc81a
parent2b3a4f91b2809932c1a938b6ba4633d5606fcecd (diff)
parentf9acb299c8375522dba1ceed14b20cbf0cf58659 (diff)
downloadshiftos_thereturn-4723e0a6045bac02b66c4e3b27c712e17e0f015f.tar.gz
shiftos_thereturn-4723e0a6045bac02b66c4e3b27c712e17e0f015f.tar.bz2
shiftos_thereturn-4723e0a6045bac02b66c4e3b27c712e17e0f015f.zip
Merge branch 'master' of https://github.com/shiftos-game/ShiftOS
-rw-r--r--ShiftOS.Objects/Save.cs2
-rw-r--r--ShiftOS.WinForms/Applications/Shiftnet.cs45
-rw-r--r--ShiftOS.WinForms/Resources/ShiftnetServices.txt1
3 files changed, 48 insertions, 0 deletions
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<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>();
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