From 66b64603a07d1ee30ea608c35fbff6bb803612fb Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Sun, 17 Mar 2024 19:03:24 -0700 Subject: [PATCH] add $sb command --- README.md | 3 ++- src/ChatCommands.cc | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ba01c265..fbe8bf94 100644 --- a/README.md +++ b/README.md @@ -439,7 +439,8 @@ Some commands only work on the game server and not on the proxy server. The chat * `$qsyncall `: Set a quest register's value for everyone in the game. `` should be either rXX (e.g. r60) or fXX (e.g. f60); if the latter, `` is parsed as a floating-point value instead of as an integer. * `$gc` (game server only): Send your own Guild Card to yourself. * `$sc `: Send a command to yourself. - * `$ss ` (proxy server only): Send a command to the remote server. + * `$ss `: Send a command to the remote server (if in a proxy session) or to the game server. + * `$sb `: Send a comamnd to yourself, and to the remote server or game server. * `$meseta ` (game server only; Episode 3 only): Add the given amount to your Meseta total. * `$auction` (Episode 3 only): Bring up the CARD Auction menu, regardless of how many players are in the game or if you have a VIP card. * `$ep3battledebug` (game server only; Episode 3 only): Enable or disable TCard00_Select. If enabled, the game will enter the debug menu when you start a battle. diff --git a/src/ChatCommands.cc b/src/ChatCommands.cc index eea60ec6..1ff1a039 100644 --- a/src/ChatCommands.cc +++ b/src/ChatCommands.cc @@ -747,6 +747,12 @@ static void server_command_send_client(shared_ptr c, const std::string& c->channel.send(data); } +static void server_command_send_server(shared_ptr c, const std::string& args) { + string data = parse_data_string(args); + data.resize((data.size() + 3) & (~3)); + on_command_with_header(c, data); +} + static void proxy_command_send_client(shared_ptr ses, const std::string& args) { string data = parse_data_string(args); data.resize((data.size() + 3) & (~3)); @@ -759,6 +765,16 @@ static void proxy_command_send_server(shared_ptr ses ses->server_channel.send(data); } +static void server_command_send_both(shared_ptr c, const std::string& args) { + server_command_send_client(c, args); + server_command_send_server(c, args); +} + +static void proxy_command_send_both(shared_ptr ses, const std::string& args) { + proxy_command_send_client(ses, args); + proxy_command_send_server(ses, args); +} + //////////////////////////////////////////////////////////////////////////////// // Lobby commands @@ -2242,6 +2258,7 @@ static const unordered_map chat_commands({ {"$save", {server_command_save, nullptr}}, {"$savechar", {server_command_savechar, nullptr}}, {"$saverec", {server_command_saverec, nullptr}}, + {"$sb", {server_command_send_both, proxy_command_send_both}}, {"$sc", {server_command_send_client, proxy_command_send_client}}, {"$secid", {server_command_secid, proxy_command_secid}}, {"$setassist", {server_command_ep3_replace_assist_card, nullptr}}, @@ -2249,7 +2266,7 @@ static const unordered_map chat_commands({ {"$silence", {server_command_silence, nullptr}}, {"$song", {server_command_song, proxy_command_song}}, {"$spec", {server_command_toggle_spectator_flag, nullptr}}, - {"$ss", {nullptr, proxy_command_send_server}}, + {"$ss", {server_command_send_server, proxy_command_send_server}}, {"$stat", {server_command_get_ep3_battle_stat, nullptr}}, {"$surrender", {server_command_surrender, nullptr}}, {"$swa", {server_command_switch_assist, proxy_command_switch_assist}},