feat: Asks the name of the shard (#2283)

This commit is contained in:
Kamron Batman 2025-11-29 12:37:09 -08:00 committed by GitHub
parent 6a7d49b679
commit 1f0f272915
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 33 additions and 75 deletions

View file

@ -271,6 +271,12 @@ public static class ServerConfiguration
_settings.Listeners.AddRange(ServerConfigurationPrompts.GetListeners());
}
if (!_settings.Settings.ContainsKey("serverListing.serverName"))
{
updated = true;
_settings.Settings["serverListing.serverName"] = ServerConfigurationPrompts.GetServerName();
}
// We have a known, current expansion, so we can deserialize it from Configuration
if (!ExpansionInfo.LoadConfiguration(out var currentExpansion))
{

View file

@ -7,81 +7,6 @@ namespace Server;
public static class ServerConfigurationPrompts
{
internal static bool GetIsClient7090()
{
if (UOClient.ServerClientVersion != null)
{
return UOClient.ServerClientVersion >= ClientVersion.Version7090;
}
Console.WriteLine("Will you be using a client version 7.0.9.0 or newer?");
do
{
Console.Write("[y] or n> ");
var input = Console.ReadLine();
if (string.IsNullOrWhiteSpace(input) || input.InsensitiveStartsWith("y"))
{
Utility.PushColor(ConsoleColor.Yellow);
Console.WriteLine("Client >= 7.0.9.0 chosen.");
Utility.PopColor();
return true;
}
if (input.InsensitiveStartsWith("n"))
{
Utility.PushColor(ConsoleColor.Yellow);
Console.WriteLine("Client < 7.0.9.0 chosen.");
Utility.PopColor();
return false;
}
Console.Write("Invalid option ");
Utility.PushColor(ConsoleColor.Red);
Console.Write(input);
Utility.PopColor();
Console.WriteLine(". Press y for yes or n for no.");
} while (true);
}
internal static bool GetIsClientPre6000()
{
if (UOClient.ServerClientVersion != null)
{
return UOClient.ServerClientVersion < ClientVersion.Version6000;
}
Console.WriteLine("Will you be using a client version older than 6.0.0.0?");
do
{
Console.Write("y or [n]> ");
var input = Console.ReadLine();
if (string.IsNullOrWhiteSpace(input) || input.InsensitiveStartsWith("n"))
{
Utility.PushColor(ConsoleColor.Yellow);
Console.WriteLine("Client >= 6.0.0.0 chosen.");
Utility.PopColor();
return false;
}
if (input.InsensitiveStartsWith("y"))
{
Utility.PushColor(ConsoleColor.Yellow);
Console.WriteLine("Client < 6.0.0.0 chosen.");
Utility.PopColor();
return true;
}
Console.Write("Invalid option ");
Utility.PushColor(ConsoleColor.Red);
Console.Write(input);
Utility.PopColor();
Console.WriteLine(". Press y for yes or n for no.");
} while (true);
}
internal static List<string> GetDataDirectories()
{
Console.WriteLine("Please enter the absolute path to your ClassicUO or Ultima Online data:");
@ -168,4 +93,31 @@ public static class ServerConfigurationPrompts
} while (true);
return ips;
}
internal static string GetServerName()
{
Console.WriteLine("Please enter the name of your shard:");
string serverName;
do
{
Console.Write("[ModernUO]> ");
serverName = Console.ReadLine();
if (string.IsNullOrWhiteSpace(serverName))
{
serverName = "ModernUO";
}
break;
} while (true);
Console.Write("Server name set to ");
Utility.PushColor(ConsoleColor.Green);
Console.Write(serverName);
Utility.PopColor();
Console.WriteLine(".");
return serverName;
}
}