diff --git a/src/ChatCommands.cc b/src/ChatCommands.cc index 07044b6e..75d67bc4 100644 --- a/src/ChatCommands.cc +++ b/src/ChatCommands.cc @@ -205,27 +205,17 @@ static void server_command_dbgid(shared_ptr, shared_ptr, c->prefer_high_lobby_client_id ? "high" : "low"); } -static void server_command_proxygc(shared_ptr, shared_ptr, +static void server_command_patch(shared_ptr s, shared_ptr, shared_ptr c, const std::u16string& args) { - if (args.empty()) { - client_options_cache.delete_key( - string_printf("proxy_remote_guild_card_number:%" PRIX32, c->license->serial_number)); - send_text_message(c, u"Proxy remote Guild\nCard number cleared"); - } else { - uint32_t proxy_remote_guild_card_number = stoll(encode_sjis(args), nullptr, 0); - client_options_cache.replace( - string_printf("proxy_remote_guild_card_number:%" PRIX32, c->license->serial_number), - string_printf("%08" PRIu32, proxy_remote_guild_card_number)); - send_text_message_printf(c, "Proxy remote Guild\nCard number set to\n$C6%" PRIu32, - proxy_remote_guild_card_number); + std::shared_ptr fn; + try { + fn = s->function_code_index->name_to_function.at(encode_sjis(args)); + send_function_call(c, fn); + } catch (const out_of_range&) { + send_text_message(c, u"Invalid patch name"); } } -static void proxy_command_proxygc(shared_ptr, - ProxyServer::LinkedSession& session, const std::u16string& args) { - session.remote_guild_card_number = stoll(encode_sjis(args), nullptr, 0); -} - static void server_command_persist(shared_ptr, shared_ptr l, shared_ptr c, const std::u16string&) { check_privileges(c, Privilege::DEBUG); @@ -990,8 +980,8 @@ static const unordered_map chat_commands({ {u"$minlevel", {server_command_min_level, nullptr, u"Usage:\nmin_level "}}, {u"$next", {server_command_next, proxy_command_next, u"Usage:\nnext"}}, {u"$password", {server_command_password, nullptr, u"Usage:\nlock [password]\nomit password to\nunlock game"}}, + {u"$patch", {server_command_patch, nullptr, u"Usage:\npatch "}}, {u"$persist", {server_command_persist, nullptr, u"Usage:\npersist"}}, - {u"$proxygc", {server_command_proxygc, proxy_command_proxygc, u"Usage:\nproxygc "}}, {u"$rand", {server_command_rand, proxy_command_rand, u"Usage:\nrand [hex seed]\nomit seed to revert\nto default"}}, {u"$secid", {server_command_secid, proxy_command_secid, u"Usage:\nsecid [section ID]\nomit section ID to\nrevert to normal"}}, {u"$silence", {server_command_silence, nullptr, u"Usage:\nsilence "}},