aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/Applications
diff options
context:
space:
mode:
authorRylan <[email protected]>2017-03-07 21:37:47 -0500
committerGitHub <[email protected]>2017-03-07 21:37:47 -0500
commitcf15e379d3d29f5289fc80e0bcd6c6de025d17a4 (patch)
treeef30d409fc5cb7ac294a8deadea3be46c4fc8cfc /ShiftOS.WinForms/Applications
parent85882aa5155ab279bbef22d20c54672fbabe272d (diff)
parented26b419631065bd743598a249d58589d2eda646 (diff)
downloadshiftos_thereturn-cf15e379d3d29f5289fc80e0bcd6c6de025d17a4.tar.gz
shiftos_thereturn-cf15e379d3d29f5289fc80e0bcd6c6de025d17a4.tar.bz2
shiftos_thereturn-cf15e379d3d29f5289fc80e0bcd6c6de025d17a4.zip
Merge pull request #105 from AShifter/master
Fixed ShiftLotto
Diffstat (limited to 'ShiftOS.WinForms/Applications')
-rw-r--r--ShiftOS.WinForms/Applications/ShiftLotto.Designer.cs2
-rw-r--r--ShiftOS.WinForms/Applications/ShiftLotto.cs64
2 files changed, 40 insertions, 26 deletions
diff --git a/ShiftOS.WinForms/Applications/ShiftLotto.Designer.cs b/ShiftOS.WinForms/Applications/ShiftLotto.Designer.cs
index 3af5d38..653e3db 100644
--- a/ShiftOS.WinForms/Applications/ShiftLotto.Designer.cs
+++ b/ShiftOS.WinForms/Applications/ShiftLotto.Designer.cs
@@ -105,7 +105,7 @@
//
this.cpUpDown.Location = new System.Drawing.Point(22, 138);
this.cpUpDown.Maximum = new decimal(new int[] {
- 10000000,
+ 10000,
0,
0,
0});
diff --git a/ShiftOS.WinForms/Applications/ShiftLotto.cs b/ShiftOS.WinForms/Applications/ShiftLotto.cs
index a070d43..cc38582 100644
--- a/ShiftOS.WinForms/Applications/ShiftLotto.cs
+++ b/ShiftOS.WinForms/Applications/ShiftLotto.cs
@@ -76,41 +76,55 @@ namespace ShiftOS.WinForms.Applications
private void button1_Click(object sender, EventArgs e)
{
- // Convert the NumericUpDown to Int
+ // Make codePoints and difficulty in this function
int codePoints = Convert.ToInt32(Math.Round(cpUpDown.Value, 0));
int difficulty = Convert.ToInt32(Math.Round(difUpDown.Value, 0));
- // Create Random Ints
- Random rnd = new Random();
+ if (SaveSystem.CurrentSave.Codepoints <= 1)
+ {
+ Infobox.Show("Not enough Codepoints", "You do not have enough Codepoints to use ShiftLotto!");
+ }
+ else
+ {
+ if (SaveSystem.CurrentSave.Codepoints - (codePoints * difficulty) <= 0)
+ {
+ Infobox.Show("Not enough Codepoints", "You do not have enough Codepoints to gamble this amount!");
+ }
+ else
+ {
+ // Create Random Ints
+ Random rnd = new Random();
- // Set their highest possible number to Difficulty
- int guessedNumber = rnd.Next(0, difficulty);
- int winningNumber = rnd.Next(0, difficulty);
+ // Set their highest possible number to Difficulty
+ int guessedNumber = rnd.Next(0, difficulty);
+ int winningNumber = rnd.Next(0, difficulty);
- // Multiply CodePoints * Difficulty
- int jackpot = codePoints * difficulty;
+ // Multiply CodePoints * Difficulty
+ int jackpot = codePoints * difficulty;
- // Test the random ints
- if (guessedNumber == winningNumber)
- {
- // If you win
+ // Test the random ints
+ if (guessedNumber == winningNumber)
+ {
+ // If you win
- // Add Codepoints
- SaveSystem.TransferCodepointsFrom("shiftlotto", jackpot);
+ // Add Codepoints
+ SaveSystem.TransferCodepointsFrom("shiftlotto", jackpot);
- // Infobox
- Infobox.Show("YOU WON!", "Good Job! " + jackpot.ToString() + " CP has been added to your account. ");
- }
- else
- {
- // If you fail
+ // Infobox
+ Infobox.Show("YOU WON!", "Good Job! " + jackpot.ToString() + " CP has been added to your account. ");
+ }
+ else
+ {
+ // If you fail
- // Remove Codepoints
- SaveSystem.TransferCodepointsToVoid(jackpot);
+ // Remove Codepoints
+ SaveSystem.TransferCodepointsToVoid(jackpot);
- // Infobox
- Infobox.Show("YOU FAILED!", "Sorry! " + jackpot.ToString() + " CP has been removed from your account.");
- }
+ // Infobox
+ Infobox.Show("YOU FAILED!", "Sorry! " + jackpot.ToString() + " CP has been removed from your account.");
+ }
+ }
+ }
}
}
} \ No newline at end of file