From 4c66381b6114f600b97179c221d93176b79b80de Mon Sep 17 00:00:00 2001 From: BraveCaperCat2 <113925022+BraveCaperCat2@users.noreply.github.com> Date: Tue, 28 Jan 2025 00:17:09 +0000 Subject: [PATCH 1/4] Update MotdRequest.cs Create an instance of the random class. --- Server/Messages/MotdRequest.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Server/Messages/MotdRequest.cs b/Server/Messages/MotdRequest.cs index 2556304f..6d72cb87 100644 --- a/Server/Messages/MotdRequest.cs +++ b/Server/Messages/MotdRequest.cs @@ -16,6 +16,8 @@ private static void SendMotdReply(ClientObject client) ServerMessage newMessage = new ServerMessage(); newMessage.type = ServerMessageType.MOTD_REPLY; + Random random = new Random(); + string newMotd = Settings.settingsStore.serverMotd; newMotd = newMotd.Replace("%name%", client.playerName); newMotd = newMotd.Replace(@"\n", Environment.NewLine); From dc85bae4b3cbbfaa454fee6c745f9b47adb5b66c Mon Sep 17 00:00:00 2001 From: BraveCaperCat2 <113925022+BraveCaperCat2@users.noreply.github.com> Date: Tue, 28 Jan 2025 09:43:40 +0000 Subject: [PATCH 2/4] Update Settings.cs Add the Random Bodies setting to configure %randombody% in the server MOTD. --- Server/Settings.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Server/Settings.cs b/Server/Settings.cs index 4b5fd735..2d242fb1 100644 --- a/Server/Settings.cs +++ b/Server/Settings.cs @@ -90,6 +90,8 @@ public class SettingsStore public string consoleIdentifier = "Server"; [Description("Specify the server's MOTD (message of the day).")] public string serverMotd = "Welcome, %name%!"; + [Description("List of bodies used for %randombody% in the server MOTD.")] + public List randomBodies = ["Moho", "Eve", "Gilly", "Mün", "Minmus", "Duna", "Ike", "Jool", "Laythe", "Vall", "Tylo", "Bop", "Pol", "Eeloo"] [Description("Specify the amount of days a screenshot should be considered as expired and deleted. 0 = Disabled")] public double expireScreenshots = 0; [Description("Specify whether to enable compression. Decreases bandwidth usage but increases CPU usage. 0 = Disabled")] @@ -99,4 +101,4 @@ public class SettingsStore [Description("Specify the minimum distance in which vessels can interact with eachother at the launch pad and runway")] public float safetyBubbleDistance = 100.0f; } -} \ No newline at end of file +} From eee8382f320e880460b30c4480fc7df4da8a5ad3 Mon Sep 17 00:00:00 2001 From: BraveCaperCat2 <113925022+BraveCaperCat2@users.noreply.github.com> Date: Tue, 28 Jan 2025 09:51:03 +0000 Subject: [PATCH 3/4] Update Settings.cs Add missing semi colon. --- Server/Settings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Server/Settings.cs b/Server/Settings.cs index 2d242fb1..819853d2 100644 --- a/Server/Settings.cs +++ b/Server/Settings.cs @@ -91,7 +91,7 @@ public class SettingsStore [Description("Specify the server's MOTD (message of the day).")] public string serverMotd = "Welcome, %name%!"; [Description("List of bodies used for %randombody% in the server MOTD.")] - public List randomBodies = ["Moho", "Eve", "Gilly", "Mün", "Minmus", "Duna", "Ike", "Jool", "Laythe", "Vall", "Tylo", "Bop", "Pol", "Eeloo"] + public List randomBodies = ["Moho", "Eve", "Gilly", "Mün", "Minmus", "Duna", "Ike", "Jool", "Laythe", "Vall", "Tylo", "Bop", "Pol", "Eeloo"]; [Description("Specify the amount of days a screenshot should be considered as expired and deleted. 0 = Disabled")] public double expireScreenshots = 0; [Description("Specify whether to enable compression. Decreases bandwidth usage but increases CPU usage. 0 = Disabled")] From 3743a15417a5a3b811d4008000285ca5bb062243 Mon Sep 17 00:00:00 2001 From: BraveCaperCat2 <113925022+BraveCaperCat2@users.noreply.github.com> Date: Tue, 28 Jan 2025 09:51:27 +0000 Subject: [PATCH 4/4] Update MotdRequest.cs Add %randombody% to the MOTD. --- Server/Messages/MotdRequest.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Server/Messages/MotdRequest.cs b/Server/Messages/MotdRequest.cs index 6d72cb87..3df70ea0 100644 --- a/Server/Messages/MotdRequest.cs +++ b/Server/Messages/MotdRequest.cs @@ -17,9 +17,13 @@ private static void SendMotdReply(ClientObject client) newMessage.type = ServerMessageType.MOTD_REPLY; Random random = new Random(); + + List randomBodies = Settings.settingsStore.randomBodies; + string randomBody = randomBodies[random.Next(randomBodies.Count)]; string newMotd = Settings.settingsStore.serverMotd; newMotd = newMotd.Replace("%name%", client.playerName); + newMotd = newMotd.Replace("%randombody%", randomBody); newMotd = newMotd.Replace(@"\n", Environment.NewLine); using (MessageWriter mw = new MessageWriter())