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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MSpK6jkyF8ZS5nYXyGwYxA
(cherry picked from commit a945634ba683a465b68f5ee8aed06293c1bb1187)
This commit is contained in:
Claude
2026-07-26 06:47:36 +00:00
committed by Acentech Dev
parent 7a7e63b40e
commit 0aedeb9ce8
4 changed files with 12 additions and 12 deletions

View File

@@ -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,

View File

@@ -4277,7 +4277,7 @@
<Length>4</Length>
<Direction>ClientToServer</Direction>
<SentWhen>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.</SentWhen>
<CausedReaction>The server sends a ChatCommandInfo for each available chat command.</CausedReaction>
<CausedReaction>The server sends an AvailableChatCommand message for each available chat command.</CausedReaction>
<Fields />
</Packet>
</Packets>

View File

@@ -11244,7 +11244,7 @@
<HeaderType>C2HeaderWithSubCode</HeaderType>
<Code>F5</Code>
<SubCode>01</SubCode>
<Name>ChatCommandInfo</Name>
<Name>AvailableChatCommand</Name>
<Direction>ServerToClient</Direction>
<SentWhen>After the client requested the list of available chat commands. One message is sent for each command which is available to the player.</SentWhen>
<CausedReaction>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.</CausedReaction>

View File

@@ -17,12 +17,12 @@ public class ChatCommandPacketTest
/// none of the fields overlaps another one.
/// </summary>
[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.
/// </summary>
[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));
}
}