From 51c13b8462781472e865c4e247e55d9d9bc8c79a Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Sat, 5 Nov 2022 00:19:32 -0700 Subject: [PATCH] fix proxy chat commands in ep3 spectator teams --- src/ProxyCommands.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ProxyCommands.cc b/src/ProxyCommands.cc index 597c511f..88a74a29 100644 --- a/src/ProxyCommands.cc +++ b/src/ProxyCommands.cc @@ -1243,9 +1243,15 @@ static HandlerResult C_06(shared_ptr s, return HandlerResult::Type::SUPPRESS; } - bool is_command = (text[0] == '$' || (text[0] == '\t' && text[1] != 'C' && text[2] == '$')); + // On Episode 3, spectator chats begin with an @ character + bool is_command = (text[0] == '$') || + (text[0] == '@' && text[1] == '$') || + (text[0] == '\t' && text[1] != 'C' && text[2] == '$') || + (text[0] == '@' && text[1] == '\t' && text[2] != 'C' && text[3] == '$'); if (is_command) { - text = text.substr((text[0] == '$') ? 0 : 2); + size_t offset = text[0] == '@' ? 1 : 0; + offset += text[offset] == '$' ? 0 : 2; + text = text.substr(offset); if (text.size() >= 2 && text[1] == '$') { send_chat_message(session.server_channel, text.substr(1)); return HandlerResult::Type::SUPPRESS;