aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS_TheReturn
diff options
context:
space:
mode:
Diffstat (limited to 'ShiftOS_TheReturn')
-rw-r--r--ShiftOS_TheReturn/Commands.cs2
-rw-r--r--ShiftOS_TheReturn/SaveSystem.cs46
-rw-r--r--ShiftOS_TheReturn/ServerManager.cs14
-rw-r--r--ShiftOS_TheReturn/UniteClient.cs24
4 files changed, 85 insertions, 1 deletions
diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs
index 87aacd6..57d1d34 100644
--- a/ShiftOS_TheReturn/Commands.cs
+++ b/ShiftOS_TheReturn/Commands.cs
@@ -283,7 +283,7 @@ namespace ShiftOS.Engine
if (args.ContainsKey("amount"))
try
{
- int codepointsToAdd = Convert.ToInt32(args["amount"].ToString());
+ Int64 codepointsToAdd = Convert.ToInt64(args["amount"].ToString());
SaveSystem.TransferCodepointsFrom("dev", codepointsToAdd);
return true;
}
diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs
index 945869b..c3289ea 100644
--- a/ShiftOS_TheReturn/SaveSystem.cs
+++ b/ShiftOS_TheReturn/SaveSystem.cs
@@ -198,6 +198,52 @@ namespace ShiftOS.Engine
Thread.Sleep(50);
Console.WriteLine("{SYSTEM_INITIATED}");
+ Sysname:
+ bool waitingForNewSysName = false;
+ bool gobacktosysname = false;
+
+ if (string.IsNullOrWhiteSpace(CurrentSave.SystemName))
+ {
+ Infobox.PromptText("Enter a system name", "Your system does not have a name. All systems within the digital society must have a name. Please enter one.", (name)=>
+ {
+ if (string.IsNullOrWhiteSpace(name))
+ Infobox.Show("Invalid name", "Please enter a valid name.", () =>
+ {
+ gobacktosysname = true;
+ waitingForNewSysName = false;
+ });
+ else if (name.Length < 5)
+ Infobox.Show("Value too small.", "Your system name must have at least 5 characters in it.", () =>
+ {
+ gobacktosysname = true;
+ waitingForNewSysName = false;
+ });
+ else
+ {
+ CurrentSave.SystemName = name;
+ if (!string.IsNullOrWhiteSpace(CurrentSave.UniteAuthToken))
+ {
+ var unite = new Unite.UniteClient("http://getshiftos.ml", CurrentSave.UniteAuthToken);
+ unite.SetSysName(name);
+ }
+ SaveSystem.SaveGame();
+ gobacktosysname = false;
+ waitingForNewSysName = false;
+ }
+ });
+
+
+ }
+
+ while (waitingForNewSysName)
+ {
+ Thread.Sleep(10);
+ }
+
+ if (gobacktosysname)
+ {
+ goto Sysname;
+ }
if (CurrentSave.Users == null)
CurrentSave.Users = new List<ClientSave>();
diff --git a/ShiftOS_TheReturn/ServerManager.cs b/ShiftOS_TheReturn/ServerManager.cs
index d356600..0bdfcd9 100644
--- a/ShiftOS_TheReturn/ServerManager.cs
+++ b/ShiftOS_TheReturn/ServerManager.cs
@@ -172,6 +172,10 @@ namespace ShiftOS.Engine
{
Console.WriteLine(msg.Contents);
}
+ else if(msg.Name == "forward")
+ {
+ MessageReceived?.Invoke(JsonConvert.DeserializeObject<ServerMessage>(msg.Contents));
+ }
else if (msg.Name == "Error")
{
var ex = JsonConvert.DeserializeObject<Exception>(msg.Contents);
@@ -239,6 +243,16 @@ namespace ShiftOS.Engine
public static event ServerMessageReceived MessageReceived;
+ public static void Forward(string targetGUID, string v, string message)
+ {
+ var smsg = new ServerMessage
+ {
+ GUID = targetGUID,
+ Name = v,
+ Contents = message
+ };
+ ServerManager.SendMessage("mud_forward", JsonConvert.SerializeObject(smsg));
+ }
}
public delegate void ServerMessageReceived(ServerMessage msg);
diff --git a/ShiftOS_TheReturn/UniteClient.cs b/ShiftOS_TheReturn/UniteClient.cs
index cb08382..1136b5c 100644
--- a/ShiftOS_TheReturn/UniteClient.cs
+++ b/ShiftOS_TheReturn/UniteClient.cs
@@ -4,6 +4,7 @@ using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
+using Newtonsoft.Json;
namespace ShiftOS.Unite
{
@@ -12,6 +13,16 @@ namespace ShiftOS.Unite
public string Token { get; private set; }
public string BaseURL { get; private set; }
+ public string GetDisplayNameId(string id)
+ {
+ return MakeCall("/API/GetDisplayName/" + id);
+ }
+
+ public PongHighscoreModel GetPongHighscores()
+ {
+ return JsonConvert.DeserializeObject<PongHighscoreModel>(MakeCall("/API/GetPongHighscores"));
+ }
+
public UniteClient(string baseurl, string usertoken)
{
BaseURL = baseurl;
@@ -100,4 +111,17 @@ namespace ShiftOS.Unite
MakeCall("/API/SetCodepoints/" + value.ToString());
}
}
+
+ public class PongHighscoreModel
+ {
+ public int Pages { get; set; }
+ public PongHighscore[] Highscores { get; set; }
+ }
+
+ public class PongHighscore
+ {
+ public string UserId { get; set; }
+ public int Level { get; set; }
+ public long CodepointsCashout { get; set; }
+ }
}