feat(chat): answer the client's minimum chat mode requests

Before private (7), team (8) and local team (10) chat the client asks
the chat server for the minimum chat mode of the channel
(LWOChatComponent::RequestMinimumChatMode; it answers every other
channel itself) and hands the answer to its chat UI. DLU never
answered. Live answered chat mode 0 with the requested channel (74 of
74 team answers in the captures: 53 05 00 39 00 00 00 00 00 08).

The chat server now answers with the lowest chat mode among who reads
the channel (the sender and their online teammates, or the sender and
the recipient), using the GM level as the chat mode as DLU does
everywhere else; the private answer also echoes the recipient's name
and GM level (0 when offline). Inferred: the minimum for GMs (no live
GM sample) and the answer when the recipient is offline.

Check: type in team chat and whisper another player: the messages send
as before and the chat box shows no error; do the same with a GM in
the team.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-29 03:23:20 -05:00
parent 73fbfa840a
commit e2d6c4124b
9 changed files with 239 additions and 0 deletions

View File

@@ -424,6 +424,32 @@ namespace ChatPackets {
VALIDATE_READ(bitStream.Read(playerID));
return true;
}
void RequestMinimumChatMode::Serialize(RakNet::BitStream& bitStream) const {
bitStream.Write(playerID);
bitStream.Write(unknown);
bitStream.Write(chatChannel);
}
bool RequestMinimumChatMode::Deserialize(RakNet::BitStream& bitStream) {
VALIDATE_READ(ReadPlayerHeader(bitStream, playerID, unknown));
VALIDATE_READ(bitStream.Read(chatChannel));
return true;
}
void RequestMinimumChatModePrivate::Serialize(RakNet::BitStream& bitStream) const {
bitStream.Write(playerID);
bitStream.Write(unknown);
bitStream.Write(chatChannel);
bitStream.Write(recipientName);
}
bool RequestMinimumChatModePrivate::Deserialize(RakNet::BitStream& bitStream) {
VALIDATE_READ(ReadPlayerHeader(bitStream, playerID, unknown));
VALIDATE_READ(bitStream.Read(chatChannel));
VALIDATE_READ(bitStream.Read(recipientName));
return true;
}
}
namespace ChatPackets::Client {

View File

@@ -352,6 +352,29 @@ namespace ChatPackets {
bool Deserialize(RakNet::BitStream& bitStream) override;
};
// The lowest chat mode among who would read the player's team chat (chatChannel 8 team, 10 local team)
struct RequestMinimumChatMode : public LUBitStream {
LWOOBJID playerID{};
uint32_t unknown{};
uint8_t chatChannel{};
RequestMinimumChatMode() : LUBitStream(ServiceType::CHAT, MessageType::Chat::REQUEST_MINIMUM_CHAT_MODE) {}
void Serialize(RakNet::BitStream& bitStream) const override;
bool Deserialize(RakNet::BitStream& bitStream) override;
};
// The same for a private message to recipientName (chatChannel 7)
struct RequestMinimumChatModePrivate : public LUBitStream {
LWOOBJID playerID{};
uint32_t unknown{};
uint8_t chatChannel{};
LUWString recipientName;
RequestMinimumChatModePrivate() : LUBitStream(ServiceType::CHAT, MessageType::Chat::REQUEST_MINIMUM_CHAT_MODE_PRIVATE) {}
void Serialize(RakNet::BitStream& bitStream) const override;
bool Deserialize(RakNet::BitStream& bitStream) override;
};
/**
* Chat-service packets the client receives, from the chat server (routed through the player's world) or from its world.
*/

View File

@@ -533,6 +533,32 @@ namespace ClientPackets {
return true;
}
void MinimumChatModeResponse::Serialize(RakNet::BitStream& bitStream) const {
bitStream.Write(chatMode);
bitStream.Write(chatChannel);
}
bool MinimumChatModeResponse::Deserialize(RakNet::BitStream& bitStream) {
VALIDATE_READ(bitStream.Read(chatMode));
VALIDATE_READ(bitStream.Read(chatChannel));
return true;
}
void MinimumChatModeResponsePrivate::Serialize(RakNet::BitStream& bitStream) const {
bitStream.Write(chatMode);
bitStream.Write(chatChannel);
bitStream.Write(recipientName);
bitStream.Write(recipientGMLevel);
}
bool MinimumChatModeResponsePrivate::Deserialize(RakNet::BitStream& bitStream) {
VALIDATE_READ(bitStream.Read(chatMode));
VALIDATE_READ(bitStream.Read(chatChannel));
VALIDATE_READ(bitStream.Read(recipientName));
VALIDATE_READ(bitStream.Read(recipientGMLevel));
return true;
}
void GetFriendsListResponse::Serialize(RakNet::BitStream& bitStream) const {
bitStream.Write(responseCode);
bitStream.Write(packetLength);

View File

@@ -290,6 +290,29 @@ namespace ClientPackets {
* list and team responses, and the team game messages. SendCannedText comes from the world.
*/
namespace ClientPackets {
// The answer to ChatPackets::RequestMinimumChatMode; the client hands both values to its chat UI
// (PacketHandler_MSG_CLIENT_MINIMUM_CHAT_MODE_RESPONSE)
struct MinimumChatModeResponse : public LUBitStream {
uint8_t chatMode{};
uint8_t chatChannel{};
MinimumChatModeResponse() : LUBitStream(ServiceType::CLIENT, MessageType::Client::MINIMUM_CHAT_MODE_RESPONSE) {}
void Serialize(RakNet::BitStream& bitStream) const override;
bool Deserialize(RakNet::BitStream& bitStream) override;
};
// The answer to ChatPackets::RequestMinimumChatModePrivate
struct MinimumChatModeResponsePrivate : public LUBitStream {
uint8_t chatMode{};
uint8_t chatChannel{};
LUWString recipientName;
uint8_t recipientGMLevel{};
MinimumChatModeResponsePrivate() : LUBitStream(ServiceType::CLIENT, MessageType::Client::MINIMUM_CHAT_MODE_RESPONSE_PRIVATE) {}
void Serialize(RakNet::BitStream& bitStream) const override;
bool Deserialize(RakNet::BitStream& bitStream) override;
};
// World -> client: chat is off (0: "Chat is currently disabled.", 1: "Upgrade to a full LEGO Universe
// Membership to chat with other players.")
struct SendCannedText : public LUBitStream {