public static void WriteStory(string json) { var thread = new Thread(new ThreadStart(() => { var story = JsonConvert.DeserializeObject <Story>(json); const int TYPESPEED = 45; foreach (var line in story.Lines) { var localized = Localization.Parse(line); if (line.StartsWith("cmd:")) { string[] cmdsplit = line.Replace("cmd:", "").Split(' '); switch (cmdsplit[0]) { case "givecp": SaveSystem.TransferCodepointsFrom(story.Character, Convert.ToInt32(cmdsplit[1])); break; } } else { Console.Write(story.Character + ": "); foreach (var c in localized) { Console.Beep(1024, TYPESPEED); if (c == '\r') { } else if (c == '\n') { Console.WriteLine(); } else { Console.Write(c); } } Console.WriteLine(); Thread.Sleep(1000); } } Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); })); thread.IsBackground = true; thread.Start(); }
public static bool FreeCodepoints(Dictionary <string, object> args) { if (args.ContainsKey("amount")) { try { int codepointsToAdd = Convert.ToInt32(args["amount"].ToString()); SaveSystem.TransferCodepointsFrom("dev", codepointsToAdd); return(true); } catch (Exception ex) { Console.WriteLine("{ERROR}: " + ex.Message); return(true); } } SaveSystem.TransferCodepointsFrom("dev", 1000); return(true); }