From 0aedeb9ce8fc9781c966b5bd53a4ba6f6105b465 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 26 Jul 2026 06:47:36 +0000 Subject: [PATCH] Rename the message so it doesn't collide with the description class The message and the class which describes a chat command in the game logic were both named ChatCommandInfo. A view plugin needs both, so the name was ambiguous there and its method didn't match the interface any more. Name the message AvailableChatCommand: it carries one command which is available to the player, which also reads well next to the request. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01MSpK6jkyF8ZS5nYXyGwYxA (cherry picked from commit a945634ba683a465b68f5ee8aed06293c1bb1187) --- .../RemoteView/ChatCommandListViewPlugIn.cs | 4 ++-- .../ClientToServer/ClientToServerPackets.xml | 2 +- .../ServerToClient/ServerToClientPackets.xml | 2 +- .../ChatCommandPacketTest.cs | 16 ++++++++-------- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/GameServer/RemoteView/ChatCommandListViewPlugIn.cs b/src/GameServer/RemoteView/ChatCommandListViewPlugIn.cs index 1c93027..b444137 100644 --- a/src/GameServer/RemoteView/ChatCommandListViewPlugIn.cs +++ b/src/GameServer/RemoteView/ChatCommandListViewPlugIn.cs @@ -55,9 +55,9 @@ public class ChatCommandListViewPlugIn : IChatCommandListViewPlugIn int Write() { - var size = ChatCommandInfoRef.GetRequiredSize(parameters.Count); + var size = AvailableChatCommandRef.GetRequiredSize(parameters.Count); var span = connection.Output.GetSpan(size)[..size]; - var packet = new ChatCommandInfoRef(span) + var packet = new AvailableChatCommandRef(span) { Index = index, Count = count, diff --git a/src/Network/Packets/ClientToServer/ClientToServerPackets.xml b/src/Network/Packets/ClientToServer/ClientToServerPackets.xml index 1cc0c02..da44ebc 100644 --- a/src/Network/Packets/ClientToServer/ClientToServerPackets.xml +++ b/src/Network/Packets/ClientToServer/ClientToServerPackets.xml @@ -4277,7 +4277,7 @@ 4 ClientToServer A client which supports a user interface for chat commands requests the list of commands which are available to the player. It's usually sent after the character entered the game world. - The server sends a ChatCommandInfo for each available chat command. + The server sends an AvailableChatCommand message for each available chat command. diff --git a/src/Network/Packets/ServerToClient/ServerToClientPackets.xml b/src/Network/Packets/ServerToClient/ServerToClientPackets.xml index 5ee31db..fcc6233 100644 --- a/src/Network/Packets/ServerToClient/ServerToClientPackets.xml +++ b/src/Network/Packets/ServerToClient/ServerToClientPackets.xml @@ -11244,7 +11244,7 @@ C2HeaderWithSubCode F5 01 - ChatCommandInfo + AvailableChatCommand ServerToClient After the client requested the list of available chat commands. One message is sent for each command which is available to the player. The client adds the command to its list of known commands, so that it can offer them to the player without requiring him to know or type them. diff --git a/tests/MUnique.OpenMU.Tests/ChatCommandPacketTest.cs b/tests/MUnique.OpenMU.Tests/ChatCommandPacketTest.cs index effb27d..e561b61 100644 --- a/tests/MUnique.OpenMU.Tests/ChatCommandPacketTest.cs +++ b/tests/MUnique.OpenMU.Tests/ChatCommandPacketTest.cs @@ -17,12 +17,12 @@ public class ChatCommandPacketTest /// none of the fields overlaps another one. /// [Test] - public void ChatCommandInfoKeepsItsValues() + public void AvailableChatCommandKeepsItsValues() { const int parameterCount = 3; - var data = new byte[ChatCommandInfoRef.GetRequiredSize(parameterCount)]; + var data = new byte[AvailableChatCommandRef.GetRequiredSize(parameterCount)]; - var written = new ChatCommandInfoRef(data) + var written = new AvailableChatCommandRef(data) { Index = 7, Count = 42, @@ -50,7 +50,7 @@ public class ChatCommandPacketTest skill.ShortName = "sk"; skill.Type = ChatCommandParameterType.Boolean; - var read = new ChatCommandInfoRef(data); + var read = new AvailableChatCommandRef(data); Assert.That(read.Header.Code, Is.EqualTo(0xF5)); Assert.That(read.Header.SubCode, Is.EqualTo(0x01)); @@ -81,11 +81,11 @@ public class ChatCommandPacketTest /// don't overlap the fields before them. /// [Test] - public void ChatCommandInfoSizeDependsOnParameterCount() + public void AvailableChatCommandSizeDependsOnParameterCount() { - var withoutParameters = ChatCommandInfoRef.GetRequiredSize(0); - var withOneParameter = ChatCommandInfoRef.GetRequiredSize(1); + var withoutParameters = AvailableChatCommandRef.GetRequiredSize(0); + var withOneParameter = AvailableChatCommandRef.GetRequiredSize(1); - Assert.That(withOneParameter - withoutParameters, Is.EqualTo(ChatCommandInfo.ChatCommandParameter.Length)); + Assert.That(withOneParameter - withoutParameters, Is.EqualTo(AvailableChatCommand.ChatCommandParameter.Length)); } }