From 3aaaf0353ef2f055453ebfb24d90cb75b84b793f Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Sat, 30 Dec 2023 15:20:53 -0800 Subject: [PATCH] use player-visible client IDs in $setassist command --- src/ChatCommands.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ChatCommands.cc b/src/ChatCommands.cc index f4166821..988ee31e 100644 --- a/src/ChatCommands.cc +++ b/src/ChatCommands.cc @@ -1785,16 +1785,20 @@ static void server_command_ep3_replace_assist_card(shared_ptr c, const s return; } - uint8_t client_id; + size_t client_id; string card_name; if (isdigit(args[0])) { auto tokens = split(args, ' ', 1); - client_id = stoul(tokens.at(0), nullptr, 0); + client_id = stoul(tokens.at(0), nullptr, 0) - 1; card_name = tokens.at(1); } else { client_id = c->lobby_client_id; card_name = args; } + if (client_id >= 4) { + send_text_message(c, "$C6Invalid client ID"); + return; + } shared_ptr ce; try {