From 5f836711c74289035e9788d9ec3113a5f95ce1ae Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Wed, 13 Jul 2022 23:36:56 -0700 Subject: [PATCH] allow event and ep3 menu song to be specified in config.json --- src/Main.cc | 14 ++++++++++++++ system/config.example.json | 12 ++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/Main.cc b/src/Main.cc index d0473609..1381f835 100644 --- a/src/Main.cc +++ b/src/Main.cc @@ -20,6 +20,7 @@ #include "Server.hh" #include "ServerShell.hh" #include "ServerState.hh" +#include "StaticGameData.hh" #include "Text.hh" using namespace std; @@ -160,6 +161,19 @@ void populate_state_from_config(shared_ptr s, ServerState::RunShellBehavior::ALWAYS : ServerState::RunShellBehavior::NEVER; } catch (const out_of_range&) { } + + try { + auto v = d.at("LobbyEvent"); + uint8_t event = v->is_int() ? v->as_int() : event_for_name(v->as_string()); + s->pre_lobby_event = event; + for (const auto& l : s->all_lobbies()) { + l->event = event; + } + } catch (const out_of_range&) { } + + try { + s->ep3_menu_song = d.at("Episode3MenuSong")->as_int(); + } catch (const out_of_range&) { } } diff --git a/system/config.example.json b/system/config.example.json index cbd9dc54..e80d01c2 100644 --- a/system/config.example.json +++ b/system/config.example.json @@ -186,6 +186,18 @@ // BB users. "WelcomeMessage": "", + // Default lobby event. If set, this sets the holiday event in all lobbies at + // server start time, as well as the pre-lobby holiday event. The event can be + // changed in each lobby independently with the $event command, or in all + // lobbies with the $allevent command. When a game is created, it inherits the + // holiday event from the lobby from which it was created. + // The value for this field can be a string like "xmas" (the values have the + // same meanings as the $event command), or an integer. + // "LobbyEvent": "xmas", + // Episode 3 menu song. If set, Episode 3 clients will hear this song when + // they are at the newserv main menu. If set, this value must be an integer. + // "Episode3MenuSong": 0, + // By default, the server keeps track of items in all games, even for versions // other than Blue Burst. This enables use of the $what command, as well as // protection against item duplication cheats (the cheater is disconnected