From 30dbf1ecb94ecbc84cb71eba9936ee050d040b64 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 18 Feb 2017 11:19:54 -0500 Subject: Fix bug with client-side for update_your_cp --- ShiftOS_TheReturn/Scripting.cs | 77 ++++++++++++++++++++++++++++++++++++++ ShiftOS_TheReturn/ServerManager.cs | 2 +- 2 files changed, 78 insertions(+), 1 deletion(-) (limited to 'ShiftOS_TheReturn') diff --git a/ShiftOS_TheReturn/Scripting.cs b/ShiftOS_TheReturn/Scripting.cs index c934fc6..9feb203 100644 --- a/ShiftOS_TheReturn/Scripting.cs +++ b/ShiftOS_TheReturn/Scripting.cs @@ -250,6 +250,83 @@ end"); } } } + + [Exposed("infobox")] + public class InfoboxFunctions + { + public void show(string title, string message) + { + Infobox.Show(title, message); + } + + public void question(string title, string message, Action callback) + { + Infobox.PromptYesNo(title, message, callback); + } + + public void input(string title, string message, Action callback) + { + Infobox.PromptText(title, message, callback); + } + } + + [Exposed("fileskimmer")] + public class FileSkimmerFunctions + { + public void openFile(string extensions, Action callback) + { + FileSkimmerBackend.GetFile(extensions.Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries), FileOpenerStyle.Open, callback); + } + + public void saveFile(string extensions, Action callback) + { + FileSkimmerBackend.GetFile(extensions.Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries), FileOpenerStyle.Save, callback); + } + } + + [Exposed("fs")] + public class ShiftFSFunctions + { + public string readAllText(string path) + { + return Utils.ReadAllText(path); + } + + public byte[] readAllBytes(string path) + { + return Utils.ReadAllBytes(path); + } + + public void writeAllText(string path, string contents) + { + Utils.WriteAllText(path, contents); + } + + public void writeAllBytes(string path, byte[] contents) + { + Utils.WriteAllBytes(path, contents); + } + + public bool fileExists(string path) + { + return Utils.FileExists(path); + } + + public bool directoryExists(string path) + { + return Utils.DirectoryExists(path); + } + + public void delete(string path) + { + Utils.Delete(path); + } + + public void createDirectory(string path) + { + Utils.CreateDirectory(path); + } + } public class ExposedAttribute : Attribute diff --git a/ShiftOS_TheReturn/ServerManager.cs b/ShiftOS_TheReturn/ServerManager.cs index aad63ef..7c5b8ef 100644 --- a/ShiftOS_TheReturn/ServerManager.cs +++ b/ShiftOS_TheReturn/ServerManager.cs @@ -131,7 +131,7 @@ namespace ShiftOS.Engine var args = JsonConvert.DeserializeObject>(msg.Contents); if(args["username"] as string == SaveSystem.CurrentSave.Username) { - SaveSystem.CurrentSave.Codepoints += (int)args["amount"]; + SaveSystem.CurrentSave.Codepoints += (long)args["amount"]; Infobox.Show($"MUD Control Centre", $"Someone bought an item in your shop, and they have paid {args["amount"]}, and as such, you have been granted these Codepoints."); SaveSystem.SaveGame(); } -- cgit v1.2.3