diff --git a/src/ProxyServer.cc b/src/ProxyServer.cc index 8d432810..d9dc8c51 100644 --- a/src/ProxyServer.cc +++ b/src/ProxyServer.cc @@ -304,6 +304,9 @@ ProxyServer::LinkedSession::LinkedSession( newserv_client_config(newserv_client_config), suppress_newserv_commands(true), enable_chat_filter(true), + override_section_id(-1), + override_lobby_event(-1), + override_lobby_number(-1), lobby_players(12), lobby_client_id(0) { memset(&this->next_destination, 0, sizeof(this->next_destination)); @@ -912,7 +915,7 @@ void ProxyServer::LinkedSession::on_server_input() { log(WARNING, "[ProxyServer/%08" PRIX32 "] Lobby join command is incorrect size (expected 0x%zX bytes, received 0x%zX bytes)", this->license->serial_number, expected_size, data.size()); } else { - const auto* cmd = reinterpret_cast(data.data()); + auto* cmd = reinterpret_cast(data.data()); this->lobby_client_id = cmd->client_id; @@ -930,6 +933,13 @@ void ProxyServer::LinkedSession::on_server_input() { this->lobby_players[index].name.c_str()); } } + + if (this->override_lobby_event >= 0) { + cmd->event = this->override_lobby_event; + } + if (this->override_lobby_event >= 0) { + cmd->lobby_number = this->override_lobby_number; + } } break; } @@ -947,7 +957,7 @@ void ProxyServer::LinkedSession::on_server_input() { log(WARNING, "[ProxyServer/%08" PRIX32 "] Game join command is incorrect size (expected 0x%zX bytes, received 0x%zX bytes)", this->license->serial_number, expected_size, data.size()); } else { - const auto* cmd = reinterpret_cast(data.data()); + auto* cmd = reinterpret_cast(data.data()); this->lobby_client_id = cmd->client_id; @@ -963,6 +973,13 @@ void ProxyServer::LinkedSession::on_server_input() { this->lobby_players[x].guild_card_number, this->lobby_players[x].name.c_str()); } + + if (this->override_section_id >= 0) { + cmd->section_id = this->override_section_id; + } + if (this->override_lobby_event >= 0) { + cmd->event = this->override_lobby_event; + } } break; } diff --git a/src/ProxyServer.hh b/src/ProxyServer.hh index e61bbe11..767b1f5d 100644 --- a/src/ProxyServer.hh +++ b/src/ProxyServer.hh @@ -50,6 +50,9 @@ public: ClientConfig newserv_client_config; bool suppress_newserv_commands; bool enable_chat_filter; + int16_t override_section_id; + int16_t override_lobby_event; + int16_t override_lobby_number; struct LobbyPlayer { uint32_t guild_card_number; diff --git a/src/ServerShell.cc b/src/ServerShell.cc index 2a30be2f..6f01ed36 100644 --- a/src/ServerShell.cc +++ b/src/ServerShell.cc @@ -97,6 +97,18 @@ Proxy commands (these will only work when exactly one client is connected):\n\ Send a lobby event update to yourself.\n\ warp \n\ Send yourself to a specific area.\n\ + set-section-id [section-id]\n\ + Override the section ID for games you create or join. This affects the\n\ + active drop chart if you are the leader of the game and the server doesn't\n\ + override drops entirely. If no argument is given, clears the override.\n\ + set-event [event]\n\ + Override the lobby event for all lobbies and games you join. This applies\n\ + only to you; other players do not see this override. If no argument is\n\ + given, clears the override.\n\ + set-lobby-number [number]\n\ + Override the lobby type for all lobbies you join. This applies only to you;\n\ + other players do not see this override. If no argument is given, clears the\n\ + override.\n\ set-chat-filter \n\ Enable or disable chat filtering (enabled by default). Chat filtering\n\ applies newserv\'s standard character replacements to chat messages (for\n\ @@ -323,6 +335,30 @@ Proxy commands (these will only work when exactly one client is connected):\n\ session->send_to_end(data, true); + } else if (command_name == "set-section-id") { + auto session = this->get_proxy_session(); + if (command_args.empty()) { + session->override_section_id = -1; + } else { + session->override_section_id = section_id_for_name(command_args); + } + + } else if (command_name == "set-event") { + auto session = this->get_proxy_session(); + if (command_args.empty()) { + session->override_lobby_event = -1; + } else { + session->override_lobby_event = event_for_name(command_args); + } + + } else if (command_name == "set-lobby-number") { + auto session = this->get_proxy_session(); + if (command_args.empty()) { + session->override_lobby_number = -1; + } else { + session->override_lobby_number = lobby_type_for_name(command_args); + } + } else if (command_name == "set-chat-filter") { auto session = this->get_proxy_session();