Files
DarkflameServer/dChatServer/MinimumChatMode.h
Aaron Kimbrell e2d6c4124b 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>
2026-09-29 03:50:02 -05:00

23 lines
953 B
C++

#ifndef MINIMUMCHATMODE_H
#define MINIMUMCHATMODE_H
#include "eGameMasterLevel.h"
#include <algorithm>
#include <cstdint>
#include <vector>
// The answer to a client's RequestMinimumChatMode: the lowest chat mode of everyone who would read a message in that
// channel. The client asks only for private (7), team (8) and local team (10) chat and answers every other channel
// itself with its own chat mode (LWOChatComponent::RequestMinimumChatMode). A chat mode is what DLU sends as the
// player's chat mode everywhere else: their GM level. Live answered 0 in all 74 captured answers (team chat among
// players who were not GMs); taking the minimum for teams with GMs in them is inferred from the name.
namespace MinimumChatMode {
inline uint8_t Of(const std::vector<eGameMasterLevel>& readers) {
if (readers.empty()) return 0;
return static_cast<uint8_t>(*std::min_element(readers.begin(), readers.end()));
}
}
#endif // MINIMUMCHATMODE_H