Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add %randombody% as a new MOTD parameter. #486

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Server/Messages/MotdRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@ private static void SendMotdReply(ClientObject client)
ServerMessage newMessage = new ServerMessage();
newMessage.type = ServerMessageType.MOTD_REPLY;

Random random = new Random();

List<string> 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())
Expand Down
4 changes: 3 additions & 1 deletion Server/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> 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")]
Expand All @@ -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;
}
}
}