From 4ec3f892476ca28a0d68b210e7679260452b4be7 Mon Sep 17 00:00:00 2001 From: "[11EJ11]" Date: Tue, 11 Feb 2025 13:06:24 +1300 Subject: [PATCH 1/8] Add game lobby lobby name validator Add game lobby name change command --- ClientCore/CnCNet5/NameValidator.cs | 35 ++++++++++++++++++- .../Multiplayer/CnCNet/GameCreationWindow.cs | 16 ++++----- .../Multiplayer/GameLobby/CnCNetGameLobby.cs | 31 ++++++++++++++++ DXMainClient/Online/Channel.cs | 2 +- 4 files changed, 73 insertions(+), 11 deletions(-) diff --git a/ClientCore/CnCNet5/NameValidator.cs b/ClientCore/CnCNet5/NameValidator.cs index c0dfa731f..503600411 100644 --- a/ClientCore/CnCNet5/NameValidator.cs +++ b/ClientCore/CnCNet5/NameValidator.cs @@ -60,8 +60,41 @@ public static string GetValidOfflineName(string name) if (validName.Length > ClientConfiguration.Instance.MaxNameLength) return validName.Substring(0, ClientConfiguration.Instance.MaxNameLength); - + return validName; } + + /// + /// Checks if a lobby name is valid for CnCNet. + /// + /// Game lobby name. + /// Null if the lobby name is valid, otherwise a string that tells + /// what is wrong with the name. + public static string IsLobbyNameValid(string lobbyName) + { + + if (string.IsNullOrEmpty(lobbyName)) + { + return "Please enter a lobby name.".L10N("Client:Main:GameNameMissing"); + } + + char[] disallowedCharacters = { ',', ';' }; + if (lobbyName.IndexOfAny(disallowedCharacters) != -1) + { + return "Lobby name contains disallowed characters.".L10N("Client:Main:GameNameDisallowedChars"); + } + + if (lobbyName.Length > 23) + { + return "Lobby name is too long.".L10N("Client:Main:GameNameTooLong"); + } + + if (new ProfanityFilter().IsOffensive(lobbyName)) + { + return "Please enter a less offensive game name.".L10N("Client:Main:GameNameOffensiveText"); + } + + return null; + } } } diff --git a/DXMainClient/DXGUI/Multiplayer/CnCNet/GameCreationWindow.cs b/DXMainClient/DXGUI/Multiplayer/CnCNet/GameCreationWindow.cs index 1bcc189d3..7958254ee 100644 --- a/DXMainClient/DXGUI/Multiplayer/CnCNet/GameCreationWindow.cs +++ b/DXMainClient/DXGUI/Multiplayer/CnCNet/GameCreationWindow.cs @@ -8,6 +8,7 @@ using Rampastring.XNAUI.XNAControls; using System; using System.IO; +using ClientCore.CnCNet5; namespace DTAClient.DXGUI.Multiplayer.CnCNet { @@ -239,17 +240,14 @@ private void BtnLoadMPGame_LeftClick(object sender, EventArgs e) private void BtnCreateGame_LeftClick(object sender, EventArgs e) { - string gameName = tbGameName.Text.Replace(";", string.Empty); - if (string.IsNullOrEmpty(gameName)) - { - return; - } + var lobbyName = tbGameName.Text; + var lobbyNameValid = NameValidator.IsLobbyNameValid(lobbyName); - if (new ProfanityFilter().IsOffensive(gameName)) + if (!string.IsNullOrEmpty(lobbyNameValid)) { - XNAMessageBox.Show(WindowManager, "Offensive game name".L10N("Client:Main:GameNameOffensiveTitle"), - "Please enter a less offensive game name.".L10N("Client:Main:GameNameOffensiveText")); + XNAMessageBox.Show(WindowManager, "Invalid lobby name".L10N("Client:Main:GameNameInvalid"), + lobbyNameValid); return; } @@ -259,7 +257,7 @@ private void BtnCreateGame_LeftClick(object sender, EventArgs e) } GameCreated?.Invoke(this, - new GameCreationEventArgs(gameName,int.Parse(ddMaxPlayers.SelectedItem.Text), + new GameCreationEventArgs(lobbyName, int.Parse(ddMaxPlayers.SelectedItem.Text), tbPassword.Text,tunnelHandler.Tunnels[lbTunnelList.SelectedIndex], ddSkillLevel.SelectedIndex) ); diff --git a/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs b/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs index 892fde5b1..237e6c7c1 100644 --- a/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs +++ b/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs @@ -37,6 +37,7 @@ public class CnCNetGameLobby : MultiplayerGameLobby private const string MAP_SHARING_DOWNLOAD_REQUEST = "MAPOK"; private const string MAP_SHARING_UPLOAD_REQUEST = "MAPREQ"; private const string MAP_SHARING_DISABLED_MESSAGE = "MAPSDISABLED"; + private const string LOBBY_NAME_CHANGED = "LNC"; private const string CHEAT_DETECTED_MESSAGE = "CD"; private const string DICE_ROLL_MESSAGE = "DR"; private const string CHANGE_TUNNEL_SERVER_MESSAGE = "CHTNL"; @@ -87,6 +88,7 @@ PrivateMessagingWindow pmWindow new StringCommandHandler("MM", CheaterNotification), new StringCommandHandler(DICE_ROLL_MESSAGE, HandleDiceRollResult), new NoParamCommandHandler(CHEAT_DETECTED_MESSAGE, HandleCheatDetectedMessage), + new NoParamCommandHandler(LOBBY_NAME_CHANGED, HandleLobbyNameChangeMessage), new StringCommandHandler(CHANGE_TUNNEL_SERVER_MESSAGE, HandleTunnelServerChangeMessage) }; @@ -97,6 +99,8 @@ PrivateMessagingWindow pmWindow AddChatBoxCommand(new ChatBoxCommand("TUNNELINFO", "View tunnel server information".L10N("Client:Main:TunnelInfoCommand"), false, PrintTunnelServerInformation)); + AddChatBoxCommand(new ChatBoxCommand("LOBBYNAME", + "Change a game lobby's name".L10N("Client:Main:ChangeLobbyNameCommand"), true, s => ChangeLobbyName(s))); AddChatBoxCommand(new ChatBoxCommand("CHANGETUNNEL", "Change the used CnCNet tunnel server (game host only)".L10N("Client:Main:ChangeTunnelCommand"), true, (s) => ShowTunnelSelectionWindow("Select tunnel server:".L10N("Client:Main:SelectTunnelServerCommand")))); @@ -1561,6 +1565,9 @@ protected override void BanPlayer(int playerIndex) private void HandleCheatDetectedMessage(string sender) => AddNotice(string.Format("{0} has modified game files during the client session. They are likely attempting to cheat!".L10N("Client:Main:PlayerModifyFileCheat"), sender), Color.Red); + private void HandleLobbyNameChangeMessage(string sender) => + AddNotice("The game host has changed the lobby name.".L10N("Client:Main:LobbyNameChanged")); + private void HandleTunnelServerChangeMessage(string sender, string tunnelAddressAndPort) { if (sender != hostName) @@ -1882,6 +1889,30 @@ private void DownloadMapByIdCommand(string parameters) #region Game broadcasting logic + /// + /// Handles changing the lobby UIName + /// + /// The new name for the lobby. + private void ChangeLobbyName(string lobbyName) + { + var lobbyNameValid = NameValidator.IsLobbyNameValid(lobbyName); + + if (!string.IsNullOrEmpty(lobbyNameValid)) + { + XNAMessageBox.Show(WindowManager, "Invalid lobby name".L10N("Client:Main:GameNameInvalid"), + lobbyNameValid); + return; + } + + //update the name and broadcast to everyone + channel.UIName = lobbyName; + AccelerateGameBroadcasting(); + + //inform the players in the room + channel.SendCTCPMessage(LOBBY_NAME_CHANGED, QueuedMessageType.SYSTEM_MESSAGE, priority: 9); + AddNotice(String.Format("Lobby name changed to {0}.".L10N("Client:Main:LobbyNameChanged"),lobbyName)); + } + /// /// Lowers the time until the next game broadcasting message. /// diff --git a/DXMainClient/Online/Channel.cs b/DXMainClient/Online/Channel.cs index 88b304f4f..1c08c02ab 100644 --- a/DXMainClient/Online/Channel.cs +++ b/DXMainClient/Online/Channel.cs @@ -63,7 +63,7 @@ public Channel(string uiName, string channelName, bool persistent, bool isChatCh #region Public members - public string UIName { get; } + public string UIName { get; set; } public string ChannelName { get; } From c8d648eab6be2c05492e9beaab78725376e245f2 Mon Sep 17 00:00:00 2001 From: "[11EJ11]" Date: Tue, 11 Feb 2025 14:27:54 +1300 Subject: [PATCH 2/8] Update channel UIName on player's side --- .../DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs b/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs index 237e6c7c1..c1fdd7336 100644 --- a/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs +++ b/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs @@ -88,7 +88,7 @@ PrivateMessagingWindow pmWindow new StringCommandHandler("MM", CheaterNotification), new StringCommandHandler(DICE_ROLL_MESSAGE, HandleDiceRollResult), new NoParamCommandHandler(CHEAT_DETECTED_MESSAGE, HandleCheatDetectedMessage), - new NoParamCommandHandler(LOBBY_NAME_CHANGED, HandleLobbyNameChangeMessage), + new StringCommandHandler(LOBBY_NAME_CHANGED, HandleLobbyNameChangeMessage), new StringCommandHandler(CHANGE_TUNNEL_SERVER_MESSAGE, HandleTunnelServerChangeMessage) }; @@ -1565,8 +1565,11 @@ protected override void BanPlayer(int playerIndex) private void HandleCheatDetectedMessage(string sender) => AddNotice(string.Format("{0} has modified game files during the client session. They are likely attempting to cheat!".L10N("Client:Main:PlayerModifyFileCheat"), sender), Color.Red); - private void HandleLobbyNameChangeMessage(string sender) => - AddNotice("The game host has changed the lobby name.".L10N("Client:Main:LobbyNameChanged")); + private void HandleLobbyNameChangeMessage(string sender, string newLobbyName) + { + AddNotice(String.Format("The game host has changed the lobby name to {0}".L10N("Client:Main:LobbyNameChanged"), newLobbyName)); + channel.UIName = newLobbyName; + } private void HandleTunnelServerChangeMessage(string sender, string tunnelAddressAndPort) { @@ -1909,7 +1912,7 @@ private void ChangeLobbyName(string lobbyName) AccelerateGameBroadcasting(); //inform the players in the room - channel.SendCTCPMessage(LOBBY_NAME_CHANGED, QueuedMessageType.SYSTEM_MESSAGE, priority: 9); + channel.SendCTCPMessage(LOBBY_NAME_CHANGED + " " + lobbyName, QueuedMessageType.SYSTEM_MESSAGE, priority: 9); AddNotice(String.Format("Lobby name changed to {0}.".L10N("Client:Main:LobbyNameChanged"),lobbyName)); } From 01fa1135abd5fdb4ad7d796f8323ced242b4256b Mon Sep 17 00:00:00 2001 From: "[11EJ11]" Date: Tue, 11 Feb 2025 14:33:04 +1300 Subject: [PATCH 3/8] Fix L10N duplicate --- DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs b/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs index c1fdd7336..c31c7dcfe 100644 --- a/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs +++ b/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs @@ -1567,7 +1567,7 @@ private void HandleCheatDetectedMessage(string sender) => private void HandleLobbyNameChangeMessage(string sender, string newLobbyName) { - AddNotice(String.Format("The game host has changed the lobby name to {0}".L10N("Client:Main:LobbyNameChanged"), newLobbyName)); + AddNotice(String.Format("The game host has changed the lobby name to {0}".L10N("Client:Main:HostLobbyNameChanged"), newLobbyName)); channel.UIName = newLobbyName; } From 3764fafea071f0f6b7ab4f064926adc9e4835123 Mon Sep 17 00:00:00 2001 From: "[11EJ11]" Date: Thu, 13 Feb 2025 08:20:30 +1300 Subject: [PATCH 4/8] Change "lobby name" references to "game name" Add example to chatbox command list --- ClientCore/CnCNet5/NameValidator.cs | 22 ++++++------- .../Multiplayer/CnCNet/GameCreationWindow.cs | 12 +++---- .../Multiplayer/GameLobby/CnCNetGameLobby.cs | 32 +++++++++---------- 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/ClientCore/CnCNet5/NameValidator.cs b/ClientCore/CnCNet5/NameValidator.cs index 503600411..9b0f0d432 100644 --- a/ClientCore/CnCNet5/NameValidator.cs +++ b/ClientCore/CnCNet5/NameValidator.cs @@ -65,31 +65,31 @@ public static string GetValidOfflineName(string name) } /// - /// Checks if a lobby name is valid for CnCNet. + /// Checks if a game name is valid for CnCNet. /// - /// Game lobby name. - /// Null if the lobby name is valid, otherwise a string that tells + /// Game lobby name. + /// Null if the game name is valid, otherwise a string that tells /// what is wrong with the name. - public static string IsLobbyNameValid(string lobbyName) + public static string IsGameNameValid(string gameName) { - if (string.IsNullOrEmpty(lobbyName)) + if (string.IsNullOrEmpty(gameName)) { - return "Please enter a lobby name.".L10N("Client:Main:GameNameMissing"); + return "Please enter a game name.".L10N("Client:Main:GameNameMissing"); } char[] disallowedCharacters = { ',', ';' }; - if (lobbyName.IndexOfAny(disallowedCharacters) != -1) + if (gameName.IndexOfAny(disallowedCharacters) != -1) { - return "Lobby name contains disallowed characters.".L10N("Client:Main:GameNameDisallowedChars"); + return "Game name contains disallowed characters.".L10N("Client:Main:GameNameDisallowedChars"); } - if (lobbyName.Length > 23) + if (gameName.Length > 23) { - return "Lobby name is too long.".L10N("Client:Main:GameNameTooLong"); + return "Game name is too long.".L10N("Client:Main:GameNameTooLong"); } - if (new ProfanityFilter().IsOffensive(lobbyName)) + if (new ProfanityFilter().IsOffensive(gameName)) { return "Please enter a less offensive game name.".L10N("Client:Main:GameNameOffensiveText"); } diff --git a/DXMainClient/DXGUI/Multiplayer/CnCNet/GameCreationWindow.cs b/DXMainClient/DXGUI/Multiplayer/CnCNet/GameCreationWindow.cs index 7958254ee..a89373c05 100644 --- a/DXMainClient/DXGUI/Multiplayer/CnCNet/GameCreationWindow.cs +++ b/DXMainClient/DXGUI/Multiplayer/CnCNet/GameCreationWindow.cs @@ -241,13 +241,13 @@ private void BtnLoadMPGame_LeftClick(object sender, EventArgs e) private void BtnCreateGame_LeftClick(object sender, EventArgs e) { - var lobbyName = tbGameName.Text; - var lobbyNameValid = NameValidator.IsLobbyNameValid(lobbyName); + var gameName = tbGameName.Text; + var gameNameValid = NameValidator.IsGameNameValid(gameName); - if (!string.IsNullOrEmpty(lobbyNameValid)) + if (!string.IsNullOrEmpty(gameNameValid)) { - XNAMessageBox.Show(WindowManager, "Invalid lobby name".L10N("Client:Main:GameNameInvalid"), - lobbyNameValid); + XNAMessageBox.Show(WindowManager, "Invalid game name.".L10N("Client:Main:GameNameInvalid"), + gameNameValid); return; } @@ -257,7 +257,7 @@ private void BtnCreateGame_LeftClick(object sender, EventArgs e) } GameCreated?.Invoke(this, - new GameCreationEventArgs(lobbyName, int.Parse(ddMaxPlayers.SelectedItem.Text), + new GameCreationEventArgs(gameName, int.Parse(ddMaxPlayers.SelectedItem.Text), tbPassword.Text,tunnelHandler.Tunnels[lbTunnelList.SelectedIndex], ddSkillLevel.SelectedIndex) ); diff --git a/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs b/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs index c31c7dcfe..d8f4efec5 100644 --- a/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs +++ b/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs @@ -37,7 +37,7 @@ public class CnCNetGameLobby : MultiplayerGameLobby private const string MAP_SHARING_DOWNLOAD_REQUEST = "MAPOK"; private const string MAP_SHARING_UPLOAD_REQUEST = "MAPREQ"; private const string MAP_SHARING_DISABLED_MESSAGE = "MAPSDISABLED"; - private const string LOBBY_NAME_CHANGED = "LNC"; + private const string GAME_NAME_CHANGED = "GNC"; private const string CHEAT_DETECTED_MESSAGE = "CD"; private const string DICE_ROLL_MESSAGE = "DR"; private const string CHANGE_TUNNEL_SERVER_MESSAGE = "CHTNL"; @@ -88,7 +88,7 @@ PrivateMessagingWindow pmWindow new StringCommandHandler("MM", CheaterNotification), new StringCommandHandler(DICE_ROLL_MESSAGE, HandleDiceRollResult), new NoParamCommandHandler(CHEAT_DETECTED_MESSAGE, HandleCheatDetectedMessage), - new StringCommandHandler(LOBBY_NAME_CHANGED, HandleLobbyNameChangeMessage), + new StringCommandHandler(GAME_NAME_CHANGED, HandleGameNameChangeMessage), new StringCommandHandler(CHANGE_TUNNEL_SERVER_MESSAGE, HandleTunnelServerChangeMessage) }; @@ -99,8 +99,8 @@ PrivateMessagingWindow pmWindow AddChatBoxCommand(new ChatBoxCommand("TUNNELINFO", "View tunnel server information".L10N("Client:Main:TunnelInfoCommand"), false, PrintTunnelServerInformation)); - AddChatBoxCommand(new ChatBoxCommand("LOBBYNAME", - "Change a game lobby's name".L10N("Client:Main:ChangeLobbyNameCommand"), true, s => ChangeLobbyName(s))); + AddChatBoxCommand(new ChatBoxCommand("GAMENAME", + "Change a game's lobby name (game host only).\nExample: \"/gamename 2v2 3v3\"".L10N("Client:Main:ChangeGameNameCommand"), true, s => ChangeGameName(s))); AddChatBoxCommand(new ChatBoxCommand("CHANGETUNNEL", "Change the used CnCNet tunnel server (game host only)".L10N("Client:Main:ChangeTunnelCommand"), true, (s) => ShowTunnelSelectionWindow("Select tunnel server:".L10N("Client:Main:SelectTunnelServerCommand")))); @@ -1565,10 +1565,10 @@ protected override void BanPlayer(int playerIndex) private void HandleCheatDetectedMessage(string sender) => AddNotice(string.Format("{0} has modified game files during the client session. They are likely attempting to cheat!".L10N("Client:Main:PlayerModifyFileCheat"), sender), Color.Red); - private void HandleLobbyNameChangeMessage(string sender, string newLobbyName) + private void HandleGameNameChangeMessage(string sender, string newGameName) { - AddNotice(String.Format("The game host has changed the lobby name to {0}".L10N("Client:Main:HostLobbyNameChanged"), newLobbyName)); - channel.UIName = newLobbyName; + AddNotice(String.Format("The game host has changed the game name to {0}".L10N("Client:Main:HostGameNameChanged"), newGameName)); + channel.UIName = newGameName; } private void HandleTunnelServerChangeMessage(string sender, string tunnelAddressAndPort) @@ -1895,25 +1895,25 @@ private void DownloadMapByIdCommand(string parameters) /// /// Handles changing the lobby UIName /// - /// The new name for the lobby. - private void ChangeLobbyName(string lobbyName) + /// The new name for the hosted game. + private void ChangeGameName(string gameName) { - var lobbyNameValid = NameValidator.IsLobbyNameValid(lobbyName); + var gameNameValid = NameValidator.IsGameNameValid(gameName); - if (!string.IsNullOrEmpty(lobbyNameValid)) + if (!string.IsNullOrEmpty(gameNameValid)) { - XNAMessageBox.Show(WindowManager, "Invalid lobby name".L10N("Client:Main:GameNameInvalid"), - lobbyNameValid); + XNAMessageBox.Show(WindowManager, "Invalid game name.".L10N("Client:Main:GameNameInvalid"), + gameNameValid); return; } //update the name and broadcast to everyone - channel.UIName = lobbyName; + channel.UIName = gameName; AccelerateGameBroadcasting(); //inform the players in the room - channel.SendCTCPMessage(LOBBY_NAME_CHANGED + " " + lobbyName, QueuedMessageType.SYSTEM_MESSAGE, priority: 9); - AddNotice(String.Format("Lobby name changed to {0}.".L10N("Client:Main:LobbyNameChanged"),lobbyName)); + channel.SendCTCPMessage(GAME_NAME_CHANGED + " " + gameName, QueuedMessageType.SYSTEM_MESSAGE, priority: 9); + AddNotice(String.Format("Game name changed to {0}.".L10N("Client:Main:GameNameChanged"), gameName)); } /// From a684bb49ef02cf66c75fb0daf0245a89ea092844 Mon Sep 17 00:00:00 2001 From: "[11EJ11]" Date: Thu, 13 Feb 2025 08:40:56 +1300 Subject: [PATCH 5/8] Minor fixups --- DXMainClient/DXGUI/Multiplayer/CnCNet/GameCreationWindow.cs | 2 +- DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DXMainClient/DXGUI/Multiplayer/CnCNet/GameCreationWindow.cs b/DXMainClient/DXGUI/Multiplayer/CnCNet/GameCreationWindow.cs index a89373c05..154287337 100644 --- a/DXMainClient/DXGUI/Multiplayer/CnCNet/GameCreationWindow.cs +++ b/DXMainClient/DXGUI/Multiplayer/CnCNet/GameCreationWindow.cs @@ -246,7 +246,7 @@ private void BtnCreateGame_LeftClick(object sender, EventArgs e) if (!string.IsNullOrEmpty(gameNameValid)) { - XNAMessageBox.Show(WindowManager, "Invalid game name.".L10N("Client:Main:GameNameInvalid"), + XNAMessageBox.Show(WindowManager, "Invalid game name".L10N("Client:Main:GameNameInvalid"), gameNameValid); return; } diff --git a/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs b/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs index d8f4efec5..b5fb01957 100644 --- a/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs +++ b/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs @@ -100,7 +100,7 @@ PrivateMessagingWindow pmWindow AddChatBoxCommand(new ChatBoxCommand("TUNNELINFO", "View tunnel server information".L10N("Client:Main:TunnelInfoCommand"), false, PrintTunnelServerInformation)); AddChatBoxCommand(new ChatBoxCommand("GAMENAME", - "Change a game's lobby name (game host only).\nExample: \"/gamename 2v2 3v3\"".L10N("Client:Main:ChangeGameNameCommand"), true, s => ChangeGameName(s))); + "Change a game's name (game host only).\nExample: \"/gamename 2v2 3v3\"".L10N("Client:Main:ChangeGameNameCommand"), true, s => ChangeGameName(s))); AddChatBoxCommand(new ChatBoxCommand("CHANGETUNNEL", "Change the used CnCNet tunnel server (game host only)".L10N("Client:Main:ChangeTunnelCommand"), true, (s) => ShowTunnelSelectionWindow("Select tunnel server:".L10N("Client:Main:SelectTunnelServerCommand")))); @@ -1902,7 +1902,7 @@ private void ChangeGameName(string gameName) if (!string.IsNullOrEmpty(gameNameValid)) { - XNAMessageBox.Show(WindowManager, "Invalid game name.".L10N("Client:Main:GameNameInvalid"), + XNAMessageBox.Show(WindowManager, "Invalid game name".L10N("Client:Main:GameNameInvalid"), gameNameValid); return; } From 42705b3b77bcd83a9d6507639bda423abc84790b Mon Sep 17 00:00:00 2001 From: 11EJDE11 Date: Thu, 13 Feb 2025 09:04:13 +1300 Subject: [PATCH 6/8] Update NameValidator.cs --- ClientCore/CnCNet5/NameValidator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ClientCore/CnCNet5/NameValidator.cs b/ClientCore/CnCNet5/NameValidator.cs index 9b0f0d432..5a5ed9957 100644 --- a/ClientCore/CnCNet5/NameValidator.cs +++ b/ClientCore/CnCNet5/NameValidator.cs @@ -67,7 +67,7 @@ public static string GetValidOfflineName(string name) /// /// Checks if a game name is valid for CnCNet. /// - /// Game lobby name. + /// Game name. /// Null if the game name is valid, otherwise a string that tells /// what is wrong with the name. public static string IsGameNameValid(string gameName) From ae617ebd6de6900b84bee2d3aa3aa0141afa817a Mon Sep 17 00:00:00 2001 From: 11EJDE11 Date: Thu, 13 Feb 2025 09:05:31 +1300 Subject: [PATCH 7/8] Update CnCNetGameLobby.cs --- DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs b/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs index b5fb01957..78810a3c2 100644 --- a/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs +++ b/DXMainClient/DXGUI/Multiplayer/GameLobby/CnCNetGameLobby.cs @@ -1893,7 +1893,7 @@ private void DownloadMapByIdCommand(string parameters) #region Game broadcasting logic /// - /// Handles changing the lobby UIName + /// Handles changing the UIName /// /// The new name for the hosted game. private void ChangeGameName(string gameName) From cbeb7e3fa6128b4bef58383ec090afc379e28909 Mon Sep 17 00:00:00 2001 From: 11EJDE11 Date: Fri, 14 Feb 2025 20:50:42 +1300 Subject: [PATCH 8/8] Update NameValidator.cs --- ClientCore/CnCNet5/NameValidator.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ClientCore/CnCNet5/NameValidator.cs b/ClientCore/CnCNet5/NameValidator.cs index 5a5ed9957..9ac7a6177 100644 --- a/ClientCore/CnCNet5/NameValidator.cs +++ b/ClientCore/CnCNet5/NameValidator.cs @@ -75,23 +75,23 @@ public static string IsGameNameValid(string gameName) if (string.IsNullOrEmpty(gameName)) { - return "Please enter a game name.".L10N("Client:Main:GameNameMissing"); + return "Please enter a game name.".L10N("Client:ClientCore:GameNameMissing"); } char[] disallowedCharacters = { ',', ';' }; if (gameName.IndexOfAny(disallowedCharacters) != -1) { - return "Game name contains disallowed characters.".L10N("Client:Main:GameNameDisallowedChars"); + return "Game name contains disallowed characters.".L10N("Client:ClientCore:GameNameDisallowedChars"); } if (gameName.Length > 23) { - return "Game name is too long.".L10N("Client:Main:GameNameTooLong"); + return "Game name is too long.".L10N("Client:ClientCore:GameNameTooLong"); } if (new ProfanityFilter().IsOffensive(gameName)) { - return "Please enter a less offensive game name.".L10N("Client:Main:GameNameOffensiveText"); + return "Please enter a less offensive game name.".L10N("Client:ClientCore:GameNameOffensiveText"); } return null;