From 1c0c7c6fa8cbc2c20f4a25457b934c61ffe4ec43 Mon Sep 17 00:00:00 2001 From: AShifter Date: Tue, 7 Mar 2017 18:53:41 -0700 Subject: Added ShiftLotto Added ShiftLotto. It's a new shiftorium upgrade that lets you make (and lose) codepoints FAST. --- ShiftOS.WinForms/Applications/ShiftLotto.cs | 116 ++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 ShiftOS.WinForms/Applications/ShiftLotto.cs (limited to 'ShiftOS.WinForms/Applications/ShiftLotto.cs') diff --git a/ShiftOS.WinForms/Applications/ShiftLotto.cs b/ShiftOS.WinForms/Applications/ShiftLotto.cs new file mode 100644 index 0000000..a070d43 --- /dev/null +++ b/ShiftOS.WinForms/Applications/ShiftLotto.cs @@ -0,0 +1,116 @@ +/* + * MIT License + * + * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +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 +{ + [Launcher("ShiftLotto", true, "al_shiftlotto", "Games")] + [RequiresUpgrade("shiftlotto")] + [WinOpen("shiftlotto")] + public partial class ShiftLotto : UserControl, IShiftOSWindow + { + public ShiftLotto() + { + InitializeComponent(); + } + + public void OnLoad() + { + timer1.Start(); + } + + + public void OnSkinLoad() + { + + } + + public bool OnUnload() + { + return true; + } + + public void OnUpgrade() + { + + } + + // The Dynamic Display + private void timer1_Tick(object sender, EventArgs e) + { + int codePoints = Convert.ToInt32(Math.Round(cpUpDown.Value, 0)); + int difficulty = Convert.ToInt32(Math.Round(difUpDown.Value, 0)); + label5.Text = codePoints * difficulty + " CP"; + label7.Text = "Current CP: " + SaveSystem.CurrentSave.Codepoints.ToString() + " CP"; + } + + private void button1_Click(object sender, EventArgs e) + { + // Convert the NumericUpDown to Int + 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(); + + // 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; + + // Test the random ints + if (guessedNumber == winningNumber) + { + // If you win + + // 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 + + // Remove Codepoints + SaveSystem.TransferCodepointsToVoid(jackpot); + + // Infobox + Infobox.Show("YOU FAILED!", "Sorry! " + jackpot.ToString() + " CP has been removed from your account."); + } + } + } +} \ No newline at end of file -- cgit v1.2.3 From ed26b419631065bd743598a249d58589d2eda646 Mon Sep 17 00:00:00 2001 From: AShifter Date: Tue, 7 Mar 2017 19:36:16 -0700 Subject: Fixed ShiftLotto Fixed a bug in ShiftLotto where the amount of codepoints you had wasn't actually checked. This lead to me having -6732946923443264 Codepoints. Oops. --- .../Applications/ShiftLotto.Designer.cs | 2 +- ShiftOS.WinForms/Applications/ShiftLotto.cs | 64 +++++++++++++--------- 2 files changed, 40 insertions(+), 26 deletions(-) (limited to 'ShiftOS.WinForms/Applications/ShiftLotto.cs') 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 -- cgit v1.2.3 From 369aefc5e81eba25e31d52c1031f3e8ec750cb04 Mon Sep 17 00:00:00 2001 From: AShifter Date: Tue, 7 Mar 2017 20:04:59 -0700 Subject: Added ShiftLotto Icon I added a ShiftLotto Icon (and probably did other stuff) --- .../Applications/ShiftLotto.Designer.cs | 26 ++++++++++++++++++++- ShiftOS.WinForms/Applications/ShiftLotto.cs | 1 + ShiftOS.WinForms/Properties/Resources.Designer.cs | 24 ++++++++++++------- ShiftOS.WinForms/Properties/Resources.resx | 3 +++ ShiftOS.WinForms/ShiftOS.WinForms.csproj | 1 + ShiftOS.WinForms/SystemIcons/iconShiftLotto.png | Bin 0 -> 299 bytes 6 files changed, 45 insertions(+), 10 deletions(-) create mode 100644 ShiftOS.WinForms/SystemIcons/iconShiftLotto.png (limited to 'ShiftOS.WinForms/Applications/ShiftLotto.cs') diff --git a/ShiftOS.WinForms/Applications/ShiftLotto.Designer.cs b/ShiftOS.WinForms/Applications/ShiftLotto.Designer.cs index 653e3db..943322e 100644 --- a/ShiftOS.WinForms/Applications/ShiftLotto.Designer.cs +++ b/ShiftOS.WinForms/Applications/ShiftLotto.Designer.cs @@ -1,4 +1,28 @@ -namespace ShiftOS.WinForms.Applications +/* + * MIT License + * + * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +namespace ShiftOS.WinForms.Applications { partial class ShiftLotto { diff --git a/ShiftOS.WinForms/Applications/ShiftLotto.cs b/ShiftOS.WinForms/Applications/ShiftLotto.cs index cc38582..7acba3e 100644 --- a/ShiftOS.WinForms/Applications/ShiftLotto.cs +++ b/ShiftOS.WinForms/Applications/ShiftLotto.cs @@ -35,6 +35,7 @@ using ShiftOS.Engine; namespace ShiftOS.WinForms.Applications { [Launcher("ShiftLotto", true, "al_shiftlotto", "Games")] + [DefaultIcon("iconShiftLotto")] [RequiresUpgrade("shiftlotto")] [WinOpen("shiftlotto")] public partial class ShiftLotto : UserControl, IShiftOSWindow diff --git a/ShiftOS.WinForms/Properties/Resources.Designer.cs b/ShiftOS.WinForms/Properties/Resources.Designer.cs index 2df6f11..6628f0b 100644 --- a/ShiftOS.WinForms/Properties/Resources.Designer.cs +++ b/ShiftOS.WinForms/Properties/Resources.Designer.cs @@ -729,6 +729,16 @@ namespace ShiftOS.WinForms.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap iconShiftLotto { + get { + object obj = ResourceManager.GetObject("iconShiftLotto", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -923,15 +933,11 @@ namespace ShiftOS.WinForms.Properties { /// Company: "ShiftSoft" /// }, /// { - /// Company: "" - /// }, - /// { - /// - /// }, - /// { - /// - /// }, - ///]. + /// Company: "Shiftcast", + /// Name: "NetXtreme Hyper Edition", + /// CostPerMonth: 1500, + /// DownloadSpeed: 524288, //512 kb/s + /// Description: "It's time to supercharge your Shif [rest of string was truncated]";. /// internal static string ShiftnetServices { get { diff --git a/ShiftOS.WinForms/Properties/Resources.resx b/ShiftOS.WinForms/Properties/Resources.resx index 5100329..bef4f99 100644 --- a/ShiftOS.WinForms/Properties/Resources.resx +++ b/ShiftOS.WinForms/Properties/Resources.resx @@ -475,4 +475,7 @@ ..\Resources\ShiftnetServices.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + + ..\systemicons\iconshiftlotto.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 2c36f6c..3a603db 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -609,6 +609,7 @@ + diff --git a/ShiftOS.WinForms/SystemIcons/iconShiftLotto.png b/ShiftOS.WinForms/SystemIcons/iconShiftLotto.png new file mode 100644 index 0000000..b2a3ad5 Binary files /dev/null and b/ShiftOS.WinForms/SystemIcons/iconShiftLotto.png differ -- cgit v1.2.3 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/Artpad.cs | 1 + ShiftOS.WinForms/Applications/Chat.cs | 1 + ShiftOS.WinForms/Applications/Downloader.cs | 1 + ShiftOS.WinForms/Applications/FormatEditor.cs | 1 + ShiftOS.WinForms/Applications/GraphicPicker.cs | 1 + ShiftOS.WinForms/Applications/MUDControlCentre.cs | 1 + ShiftOS.WinForms/Applications/NameChanger.cs | 1 + ShiftOS.WinForms/Applications/Pong.cs | 1 + ShiftOS.WinForms/Applications/ShiftLetters.cs | 1 + ShiftOS.WinForms/Applications/ShiftLotto.cs | 1 + ShiftOS.WinForms/Applications/ShiftSweeper.cs | 1 + ShiftOS.WinForms/Applications/Shifter.cs | 1 + ShiftOS.WinForms/Applications/Shiftnet.cs | 1 + .../Applications/ShiftoriumFrontend.cs | 1 + ShiftOS.WinForms/HackerCommands.cs | 10 ++++++ ShiftOS.WinForms/WinformsWindowManager.cs | 18 ++++++++++ ShiftOS_TheReturn/AppLauncherDaemon.cs | 20 +++++++++--- ShiftOS_TheReturn/KernelWatchdog.cs | 38 +++++++++++++++++++++- ShiftOS_TheReturn/Scripting.cs | 7 ++-- 19 files changed, 100 insertions(+), 7 deletions(-) (limited to 'ShiftOS.WinForms/Applications/ShiftLotto.cs') diff --git a/ShiftOS.WinForms/Applications/Artpad.cs b/ShiftOS.WinForms/Applications/Artpad.cs index 6c1bc1c..71f7afb 100644 --- a/ShiftOS.WinForms/Applications/Artpad.cs +++ b/ShiftOS.WinForms/Applications/Artpad.cs @@ -41,6 +41,7 @@ using ShiftOS.Engine; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] [Launcher("Artpad", true, "al_artpad", "Graphics")] [RequiresUpgrade("artpad")] [WinOpen("artpad")] diff --git a/ShiftOS.WinForms/Applications/Chat.cs b/ShiftOS.WinForms/Applications/Chat.cs index 06a7873..caf8cd2 100644 --- a/ShiftOS.WinForms/Applications/Chat.cs +++ b/ShiftOS.WinForms/Applications/Chat.cs @@ -36,6 +36,7 @@ using ShiftOS.Engine; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] public partial class Chat : UserControl, IShiftOSWindow { public Chat(string chatId) diff --git a/ShiftOS.WinForms/Applications/Downloader.cs b/ShiftOS.WinForms/Applications/Downloader.cs index da90c6d..1f240bf 100644 --- a/ShiftOS.WinForms/Applications/Downloader.cs +++ b/ShiftOS.WinForms/Applications/Downloader.cs @@ -41,6 +41,7 @@ using System.IO.Compression; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] [Launcher("Downloader", false, null, "Networking")] [DefaultIcon("iconDownloader")] public partial class Downloader : UserControl, IShiftOSWindow diff --git a/ShiftOS.WinForms/Applications/FormatEditor.cs b/ShiftOS.WinForms/Applications/FormatEditor.cs index ef44b47..56b0253 100644 --- a/ShiftOS.WinForms/Applications/FormatEditor.cs +++ b/ShiftOS.WinForms/Applications/FormatEditor.cs @@ -34,6 +34,7 @@ using System.Windows.Forms; using ShiftOS.Engine; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] [Launcher("FormatEditor", true, "al_format_editor", "Games")] [RequiresUpgrade("format_editor")] [WinOpen("formateditor")] diff --git a/ShiftOS.WinForms/Applications/GraphicPicker.cs b/ShiftOS.WinForms/Applications/GraphicPicker.cs index 2dfe7ec..b3dd8bf 100644 --- a/ShiftOS.WinForms/Applications/GraphicPicker.cs +++ b/ShiftOS.WinForms/Applications/GraphicPicker.cs @@ -37,6 +37,7 @@ using ShiftOS.WinForms.Tools; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] [DefaultTitle("Choose graphic")] [DefaultIcon("icongraphicpicker")] public partial class GraphicPicker : UserControl, IShiftOSWindow { 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")] diff --git a/ShiftOS.WinForms/Applications/NameChanger.cs b/ShiftOS.WinForms/Applications/NameChanger.cs index ca76e57..d7c99f7 100644 --- a/ShiftOS.WinForms/Applications/NameChanger.cs +++ b/ShiftOS.WinForms/Applications/NameChanger.cs @@ -38,6 +38,7 @@ using ShiftOS.WinForms.Tools; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] [Launcher("Name Changer", true, "al_name_changer", "Customization")] [RequiresUpgrade("name_changer")] [WinOpen("name_changer")] diff --git a/ShiftOS.WinForms/Applications/Pong.cs b/ShiftOS.WinForms/Applications/Pong.cs index af1e156..157ce8c 100644 --- a/ShiftOS.WinForms/Applications/Pong.cs +++ b/ShiftOS.WinForms/Applications/Pong.cs @@ -37,6 +37,7 @@ using ShiftOS.Objects; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] [Launcher("Pong", true, "al_pong", "Games")] [WinOpen("pong")] [DefaultIcon("iconPong")] diff --git a/ShiftOS.WinForms/Applications/ShiftLetters.cs b/ShiftOS.WinForms/Applications/ShiftLetters.cs index 700df7e..b5e9aa4 100644 --- a/ShiftOS.WinForms/Applications/ShiftLetters.cs +++ b/ShiftOS.WinForms/Applications/ShiftLetters.cs @@ -36,6 +36,7 @@ using System.Windows.Forms; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] [Launcher("ShiftLetters", false, null, "Games")] [RequiresUpgrade("shiftletters")] [WinOpen("shiftletters")] diff --git a/ShiftOS.WinForms/Applications/ShiftLotto.cs b/ShiftOS.WinForms/Applications/ShiftLotto.cs index 7acba3e..33f357f 100644 --- a/ShiftOS.WinForms/Applications/ShiftLotto.cs +++ b/ShiftOS.WinForms/Applications/ShiftLotto.cs @@ -35,6 +35,7 @@ using ShiftOS.Engine; namespace ShiftOS.WinForms.Applications { [Launcher("ShiftLotto", true, "al_shiftlotto", "Games")] + [MultiplayerOnly] [DefaultIcon("iconShiftLotto")] [RequiresUpgrade("shiftlotto")] [WinOpen("shiftlotto")] diff --git a/ShiftOS.WinForms/Applications/ShiftSweeper.cs b/ShiftOS.WinForms/Applications/ShiftSweeper.cs index b13880f..cf6d331 100644 --- a/ShiftOS.WinForms/Applications/ShiftSweeper.cs +++ b/ShiftOS.WinForms/Applications/ShiftSweeper.cs @@ -36,6 +36,7 @@ using ShiftOS.Engine; namespace ShiftOS.WinForms.Applications { [Launcher("ShiftSweeper", true, "al_shiftsweeper", "Games")] [RequiresUpgrade("shiftsweeper")] + [MultiplayerOnly] [WinOpen("shiftsweeper")] [DefaultIcon("iconShiftSweeper")] public partial class ShiftSweeper : UserControl, IShiftOSWindow { diff --git a/ShiftOS.WinForms/Applications/Shifter.cs b/ShiftOS.WinForms/Applications/Shifter.cs index 1adc75a..fe2bf20 100644 --- a/ShiftOS.WinForms/Applications/Shifter.cs +++ b/ShiftOS.WinForms/Applications/Shifter.cs @@ -40,6 +40,7 @@ using ShiftOS.WinForms.Tools; namespace ShiftOS.WinForms.Applications { + [MultiplayerOnly] [Launcher("Shifter", true, "al_shifter", "Customization")] [RequiresUpgrade("shifter")] [WinOpen("shifter")] diff --git a/ShiftOS.WinForms/Applications/Shiftnet.cs b/ShiftOS.WinForms/Applications/Shiftnet.cs index 45f37d4..c1c81d5 100644 --- a/ShiftOS.WinForms/Applications/Shiftnet.cs +++ b/ShiftOS.WinForms/Applications/Shiftnet.cs @@ -38,6 +38,7 @@ using ShiftOS.WinForms.Tools; namespace ShiftOS.WinForms.Applications { [Launcher("Shiftnet", false, null, "Networking")] + [MultiplayerOnly] [DefaultIcon("iconShiftnet")] public partial class Shiftnet : UserControl, IShiftOSWindow { public Shiftnet() { diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs index b3724ae..0580b47 100644 --- a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs +++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs @@ -39,6 +39,7 @@ namespace ShiftOS.WinForms.Applications { [Launcher("Shiftorium", true, "al_shiftorium", "Utilities")] [RequiresUpgrade("shiftorium_gui")] + [MultiplayerOnly] [WinOpen("shiftorium")] [DefaultTitle("Shiftorium")] [DefaultIcon("iconShiftorium")] diff --git a/ShiftOS.WinForms/HackerCommands.cs b/ShiftOS.WinForms/HackerCommands.cs index 52d8568..d9504d3 100644 --- a/ShiftOS.WinForms/HackerCommands.cs +++ b/ShiftOS.WinForms/HackerCommands.cs @@ -668,5 +668,15 @@ namespace ShiftOS.WinForms return true; } + + [Command("experience", description = "Marks a story plot as experienced without triggering the plot.", usage ="{id:}")] + [RequiresArgument("id")] + [RemoteLock] + public static bool Experience(Dictionary args) + { + SaveSystem.CurrentSave.StoriesExperienced.Add(args["id"].ToString()); + SaveSystem.SaveGame(); + return true; + } } } diff --git a/ShiftOS.WinForms/WinformsWindowManager.cs b/ShiftOS.WinForms/WinformsWindowManager.cs index b8f0cae..eeaa6c9 100644 --- a/ShiftOS.WinForms/WinformsWindowManager.cs +++ b/ShiftOS.WinForms/WinformsWindowManager.cs @@ -106,6 +106,24 @@ namespace ShiftOS.WinForms return; } + foreach(var attr in form.GetType().GetCustomAttributes(true)) + { + if(attr is MultiplayerOnlyAttribute) + { + if(KernelWatchdog.MudConnected == false) + { + Infobox.PromptYesNo("Disconnected from MUD", "This application requires a connection to the MUD. Would you like to reconnect?", new Action((answer) => + { + if(answer == true) + { + KernelWatchdog.MudConnected = true; + SetupWindow(form); + } + })); + return; + } + } + } if (!Shiftorium.UpgradeAttributesUnlocked(form.GetType())) { diff --git a/ShiftOS_TheReturn/AppLauncherDaemon.cs b/ShiftOS_TheReturn/AppLauncherDaemon.cs index 7ef34c1..5e3bd72 100644 --- a/ShiftOS_TheReturn/AppLauncherDaemon.cs +++ b/ShiftOS_TheReturn/AppLauncherDaemon.cs @@ -66,12 +66,24 @@ namespace ShiftOS.Engine { foreach (var attr in type.GetCustomAttributes(false)) { - if (attr is LauncherAttribute) + bool isAllowed = true; + if(attr is MultiplayerOnlyAttribute) { - var launch = attr as LauncherAttribute; - if (launch.UpgradeInstalled) + if(KernelWatchdog.MudConnected == false) { - win.Add(new LauncherItem { DisplayData = launch, LaunchType = type }); + isAllowed = false; + + } + } + if (isAllowed == true) + { + if (attr is LauncherAttribute) + { + var launch = attr as LauncherAttribute; + if (launch.UpgradeInstalled) + { + win.Add(new LauncherItem { DisplayData = launch, LaunchType = type }); + } } } } diff --git a/ShiftOS_TheReturn/KernelWatchdog.cs b/ShiftOS_TheReturn/KernelWatchdog.cs index 1b59b25..e69c9ba 100644 --- a/ShiftOS_TheReturn/KernelWatchdog.cs +++ b/ShiftOS_TheReturn/KernelWatchdog.cs @@ -25,8 +25,44 @@ namespace ShiftOS.Engine } } + private static bool _mudConnected = true; + public static bool InKernelMode { get; private set; } - public static bool MudConnected { get; set; } + public static bool MudConnected + { + get + { + return _mudConnected; + } + set + { + if(value == false) + { + foreach(var win in AppearanceManager.OpenForms) + { + foreach(var attr in win.ParentWindow.GetType().GetCustomAttributes(true)) + { + if(attr is MultiplayerOnlyAttribute) + { + ConsoleEx.Bold = true; + ConsoleEx.Underline = false; + ConsoleEx.Italic = true; + ConsoleEx.ForegroundColor = ConsoleColor.Red; + Console.Write("Error:"); + ConsoleEx.Bold = false; + ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow; + Console.WriteLine("Cannot disconnect from multi-user domain because an app that depends on it is open."); + TerminalBackend.PrintPrompt(); + return; + } + } + } + } + + _mudConnected = value; + Desktop.PopulateAppLauncher(); + } + } public static bool IsSafe(Type type) { diff --git a/ShiftOS_TheReturn/Scripting.cs b/ShiftOS_TheReturn/Scripting.cs index bb65dc7..6768efb 100644 --- a/ShiftOS_TheReturn/Scripting.cs +++ b/ShiftOS_TheReturn/Scripting.cs @@ -67,11 +67,14 @@ namespace ShiftOS.Engine.Scripting { ServerManager.MessageReceived += (msg) => { - if(msg.Name == "run") + if (msg.Name == "run") { var cntnts = JsonConvert.DeserializeObject(msg.Contents); var interp = new LuaInterpreter(); - interp.Execute(cntnts.script.ToString()); + Desktop.InvokeOnWorkerThread(() => + { + interp.Execute(cntnts.script.ToString()); + }); } }; } -- cgit v1.2.3 From 5a8cb0cdf76d65e096bd9aeda6ee9c6246a31134 Mon Sep 17 00:00:00 2001 From: AShifter Date: Sat, 11 Mar 2017 09:24:15 -0700 Subject: I don't think Michael liked the ShiftLotto limits so i fixed it - 1 billion limit combined --- ShiftOS.WinForms/Applications/ShiftLotto.Designer.cs | 7 ++++++- ShiftOS.WinForms/Applications/ShiftLotto.cs | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'ShiftOS.WinForms/Applications/ShiftLotto.cs') diff --git a/ShiftOS.WinForms/Applications/ShiftLotto.Designer.cs b/ShiftOS.WinForms/Applications/ShiftLotto.Designer.cs index 943322e..8b43636 100644 --- a/ShiftOS.WinForms/Applications/ShiftLotto.Designer.cs +++ b/ShiftOS.WinForms/Applications/ShiftLotto.Designer.cs @@ -129,7 +129,7 @@ namespace ShiftOS.WinForms.Applications // this.cpUpDown.Location = new System.Drawing.Point(22, 138); this.cpUpDown.Maximum = new decimal(new int[] { - 10000, + 1000000, 0, 0, 0}); @@ -150,6 +150,11 @@ namespace ShiftOS.WinForms.Applications // difUpDown // this.difUpDown.Location = new System.Drawing.Point(299, 138); + this.difUpDown.Maximum = new decimal(new int[] { + 1000, + 0, + 0, + 0}); this.difUpDown.Minimum = new decimal(new int[] { 10, 0, diff --git a/ShiftOS.WinForms/Applications/ShiftLotto.cs b/ShiftOS.WinForms/Applications/ShiftLotto.cs index 7acba3e..4b1c983 100644 --- a/ShiftOS.WinForms/Applications/ShiftLotto.cs +++ b/ShiftOS.WinForms/Applications/ShiftLotto.cs @@ -81,7 +81,7 @@ namespace ShiftOS.WinForms.Applications int codePoints = Convert.ToInt32(Math.Round(cpUpDown.Value, 0)); int difficulty = Convert.ToInt32(Math.Round(difUpDown.Value, 0)); - if (SaveSystem.CurrentSave.Codepoints <= 1) + if (SaveSystem.CurrentSave.Codepoints <= 9) { Infobox.Show("Not enough Codepoints", "You do not have enough Codepoints to use ShiftLotto!"); } @@ -121,6 +121,8 @@ namespace ShiftOS.WinForms.Applications // Remove Codepoints SaveSystem.TransferCodepointsToVoid(jackpot); + + // Infobox Infobox.Show("YOU FAILED!", "Sorry! " + jackpot.ToString() + " CP has been removed from your account."); } -- cgit v1.2.3