aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Server
diff options
context:
space:
mode:
Diffstat (limited to 'ShiftOS.Server')
-rw-r--r--ShiftOS.Server/Core.cs3
-rw-r--r--ShiftOS.Server/Program.cs33
-rw-r--r--ShiftOS.Server/RandomUserGenerator.cs2
-rw-r--r--ShiftOS.Server/SaveManager.cs22
4 files changed, 20 insertions, 40 deletions
diff --git a/ShiftOS.Server/Core.cs b/ShiftOS.Server/Core.cs
index a53a5bc..7bb5b1d 100644
--- a/ShiftOS.Server/Core.cs
+++ b/ShiftOS.Server/Core.cs
@@ -32,7 +32,6 @@ using NetSockets;
using Newtonsoft.Json;
using System.IO;
using static ShiftOS.Server.Program;
-using ShiftOS.Engine
namespace ShiftOS.Server
@@ -181,7 +180,7 @@ namespace ShiftOS.Server
if (sve.EndsWith(".save"))
{
var save = JsonConvert.DeserializeObject<Save>(File.ReadAllText(sve));
- accs.Add($"{ShiftOS.Engine.SaveSytem.CurrentUser.Username}@{save.SystemName}");
+ accs.Add($"{save.Username}@{save.SystemName}");
}
}
diff --git a/ShiftOS.Server/Program.cs b/ShiftOS.Server/Program.cs
index c880321..5170ccd 100644
--- a/ShiftOS.Server/Program.cs
+++ b/ShiftOS.Server/Program.cs
@@ -55,17 +55,6 @@ namespace ShiftOS.Server
public class Program
{
/// <summary>
- /// The admin username.
- /// </summary>
- public static string AdminUsername = "admin";
-
- /// <summary>
- /// The admin password.
- /// </summary>
- public static string AdminPassword = "admin";
-
-
- /// <summary>
/// The server.
/// </summary>
public static NetObjectServer server;
@@ -98,11 +87,16 @@ namespace ShiftOS.Server
{
if (server.IsOnline)
{
- server.DispatchAll(new NetObject("heartbeat", new ServerMessage
+
+ try
{
- Name = "heartbeat",
- GUID = "server"
- }));
+ server.DispatchAll(new NetObject("heartbeat", new ServerMessage
+ {
+ Name = "heartbeat",
+ GUID = "server"
+ }));
+ }
+ catch { }
}
};
if (!Directory.Exists("saves"))
@@ -161,13 +155,7 @@ namespace ShiftOS.Server
Console.WriteLine("FUCK. Something HORRIBLE JUST HAPPENED.");
};
- AppDomain.CurrentDomain.UnhandledException += (o, a) =>
- {
- if(server.IsOnline == true)
- server.Stop();
- System.Diagnostics.Process.Start("ShiftOS.Server.exe");
- };
-
+
server.OnReceived += (o, a) =>
{
var obj = a.Data.Object;
@@ -214,7 +202,6 @@ namespace ShiftOS.Server
task.Wait();
*/
- RandomUserGenerator.StartThread();
while (server.IsOnline)
{
diff --git a/ShiftOS.Server/RandomUserGenerator.cs b/ShiftOS.Server/RandomUserGenerator.cs
index 3a62f9c..6da891d 100644
--- a/ShiftOS.Server/RandomUserGenerator.cs
+++ b/ShiftOS.Server/RandomUserGenerator.cs
@@ -111,7 +111,7 @@ namespace ShiftOS.Server
break;
}
- sve.Codepoints = rnd.Next(startCP, maxAmt);
+ sve.Codepoints = (ulong)rnd.Next(startCP, maxAmt);
//FS treasure generation.
/*
diff --git a/ShiftOS.Server/SaveManager.cs b/ShiftOS.Server/SaveManager.cs
index d81a1a7..baf5b64 100644
--- a/ShiftOS.Server/SaveManager.cs
+++ b/ShiftOS.Server/SaveManager.cs
@@ -207,8 +207,7 @@ namespace ShiftOS.Server
{
var save = JsonConvert.DeserializeObject<Save>(ReadEncFile(savefile));
-
- if (save.UniteAuthToken==token)
+ if (save.UniteAuthToken == token)
{
if (save.ID == new Guid())
{
@@ -216,7 +215,6 @@ namespace ShiftOS.Server
WriteEncFile(savefile, JsonConvert.SerializeObject(save));
}
-
Program.server.DispatchTo(new Guid(guid), new NetObject("mud_savefile", new ServerMessage
{
Name = "mud_savefile",
@@ -228,15 +226,11 @@ namespace ShiftOS.Server
}
catch { }
}
- try
+ Program.server.DispatchTo(new Guid(guid), new NetObject("auth_failed", new ServerMessage
{
- Program.server.DispatchTo(new Guid(guid), new NetObject("auth_failed", new ServerMessage
- {
- Name = "mud_login_denied",
- GUID = "server"
- }));
- }
- catch { }
+ Name = "mud_login_denied",
+ GUID = "server"
+ }));
}
[MudRequest("delete_save", typeof(ClientSave))]
@@ -268,7 +262,7 @@ namespace ShiftOS.Server
{
args["username"] = args["username"].ToString().ToLower();
string userName = args["username"] as string;
- long cpAmount = (long)args["amount"];
+ ulong cpAmount = (ulong)args["amount"];
if (Directory.Exists("saves"))
{
@@ -302,7 +296,7 @@ namespace ShiftOS.Server
args["username"] = args["username"].ToString().ToLower();
string userName = args["username"] as string;
string passw = args["password"] as string;
- int cpAmount = (int)args["amount"];
+ ulong cpAmount = (ulong)args["amount"];
if (Directory.Exists("saves"))
{
@@ -315,7 +309,7 @@ namespace ShiftOS.Server
WriteEncFile(saveFile, JsonConvert.SerializeObject(saveFileContents, Formatting.Indented));
Program.ClientDispatcher.Broadcast("update_your_cp", new {
username = userName,
- amount = -cpAmount
+ amount = -(long)cpAmount
});
Program.ClientDispatcher.DispatchTo("update_your_cp", guid, new
{