diff options
Diffstat (limited to 'ShiftOS_TheReturn')
| -rw-r--r-- | ShiftOS_TheReturn/Scripting.cs | 77 | ||||
| -rw-r--r-- | ShiftOS_TheReturn/ServerManager.cs | 2 |
2 files changed, 78 insertions, 1 deletions
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<bool> callback) + { + Infobox.PromptYesNo(title, message, callback); + } + + public void input(string title, string message, Action<string> callback) + { + Infobox.PromptText(title, message, callback); + } + } + + [Exposed("fileskimmer")] + public class FileSkimmerFunctions + { + public void openFile(string extensions, Action<string> callback) + { + FileSkimmerBackend.GetFile(extensions.Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries), FileOpenerStyle.Open, callback); + } + + public void saveFile(string extensions, Action<string> 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<Dictionary<string, object>>(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(); } |
