Fix NPC chat showing only name without message text

Two bugs in SMSG_MESSAGECHAT parser for MONSTER_SAY/YELL/EMOTE:

1. Sender name included trailing null byte from server (nameLen includes
   null terminator). The embedded null in std::string caused ImGui to
   truncate the concatenated display string at the NPC name, hiding
   " says: <message>" entirely.

2. Missing NamedGuid receiver name for non-player/non-pet targets. When
   the receiver GUID is a creature, the server writes an additional
   SizedCString (target name) that we weren't reading, shifting all
   subsequent field reads.

Also adds MONSTER_WHISPER, MONSTER_PARTY, RAID_BOSS_EMOTE, RAID_BOSS_WHISPER
chat types with proper parsing and display formatting (says/yells/whispers).
This commit is contained in:
Kelsi 2026-03-02 08:31:34 -08:00
parent f1caf8c03e
commit b948720ec3
4 changed files with 41 additions and 6 deletions

View file

@ -1120,9 +1120,18 @@ void GameScreen::renderChatWindow(game::GameHandler& gameHandler) {
} else if (msg.type == game::ChatType::TEXT_EMOTE) {
renderTextWithLinks(tsPrefix + processedMessage, color);
} else if (!msg.senderName.empty()) {
if (msg.type == game::ChatType::MONSTER_SAY || msg.type == game::ChatType::MONSTER_YELL) {
if (msg.type == game::ChatType::MONSTER_SAY || msg.type == game::ChatType::MONSTER_PARTY) {
std::string fullMsg = tsPrefix + msg.senderName + " says: " + processedMessage;
renderTextWithLinks(fullMsg, color);
} else if (msg.type == game::ChatType::MONSTER_YELL) {
std::string fullMsg = tsPrefix + msg.senderName + " yells: " + processedMessage;
renderTextWithLinks(fullMsg, color);
} else if (msg.type == game::ChatType::MONSTER_WHISPER || msg.type == game::ChatType::RAID_BOSS_WHISPER) {
std::string fullMsg = tsPrefix + msg.senderName + " whispers: " + processedMessage;
renderTextWithLinks(fullMsg, color);
} else if (msg.type == game::ChatType::MONSTER_EMOTE || msg.type == game::ChatType::RAID_BOSS_EMOTE) {
std::string fullMsg = tsPrefix + msg.senderName + " " + processedMessage;
renderTextWithLinks(fullMsg, color);
} else if (msg.type == game::ChatType::CHANNEL && !msg.channelName.empty()) {
int chIdx = gameHandler.getChannelIndex(msg.channelName);
std::string chDisplay = chIdx > 0