From c6ce39623e2de0975420d630ce375ec2853a07dc Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Mon, 1 Jan 2024 11:30:30 -0800 Subject: [PATCH] add config option to enable rare notifs by default --- src/Client.cc | 3 +++ src/ServerState.cc | 1 + src/ServerState.hh | 1 + system/config.example.json | 4 ++++ tests/config.json | 1 + 5 files changed, 10 insertions(+) diff --git a/src/Client.cc b/src/Client.cc index 81a1abb4..8573028d 100644 --- a/src/Client.cc +++ b/src/Client.cc @@ -195,6 +195,9 @@ Client::Client( external_bank_character_index(-1), last_play_time_update(0) { this->config.set_flags_for_version(version, -1); + if (server->get_state()->default_rare_notifs_enabled) { + this->config.set_flag(Flag::RARE_DROP_NOTIFICATIONS_ENABLED); + } this->config.specific_version = default_specific_version_for_version(version, -1); this->last_switch_enabled_command.header.subcommand = 0; diff --git a/src/ServerState.cc b/src/ServerState.cc index c3df9d93..682c2739 100644 --- a/src/ServerState.cc +++ b/src/ServerState.cc @@ -656,6 +656,7 @@ void ServerState::load_config() { this->persistent_game_idle_timeout_usecs = json.get_int("PersistentGameIdleTimeout", this->persistent_game_idle_timeout_usecs); this->cheat_mode_behavior = parse_behavior_switch("CheatModeBehavior", this->cheat_mode_behavior); + this->default_rare_notifs_enabled = json.get_bool("RareNotificationsEnabledByDefault", this->default_rare_notifs_enabled); this->ep3_send_function_call_enabled = json.get_bool("EnableEpisode3SendFunctionCall", this->ep3_send_function_call_enabled); this->catch_handler_exceptions = json.get_bool("CatchHandlerExceptions", this->catch_handler_exceptions); diff --git a/src/ServerState.hh b/src/ServerState.hh index 4ba192fe..cf6839b2 100644 --- a/src/ServerState.hh +++ b/src/ServerState.hh @@ -116,6 +116,7 @@ struct ServerState : public std::enable_shared_from_this { bool hide_download_commands = true; RunShellBehavior run_shell_behavior = RunShellBehavior::DEFAULT; BehaviorSwitch cheat_mode_behavior = BehaviorSwitch::OFF_BY_DEFAULT; + bool default_rare_notifs_enabled = false; std::vector> bb_private_keys; std::shared_ptr function_code_index; std::shared_ptr pc_patch_file_index; diff --git a/system/config.example.json b/system/config.example.json index b517174b..81e34730 100644 --- a/system/config.example.json +++ b/system/config.example.json @@ -775,6 +775,10 @@ // available on the proxy server. "CheatModeBehavior": "OnByDefault", + // Whether to enable rare drop notifications by default. Players can toggle + // this behavior for themselves with the $rarenotifs command. + "RareNotificationsEnabledByDefault": false, + // Whether to enable patches on Episode 3 USA. This functionality depends on // exploiting a bug in Episode 3, and while it seems to work reliably on // Dolphin, it hasn't been tested on a real GameCube. So, newserv doesn't diff --git a/tests/config.json b/tests/config.json index 578712f4..824c66cf 100644 --- a/tests/config.json +++ b/tests/config.json @@ -30,6 +30,7 @@ "DefaultDropModeV4Battle": "SERVER_SHARED", "DefaultDropModeV4Challenge": "SERVER_SHARED", "CheatModeBehavior": "OnByDefault", + "RareNotificationsEnabledByDefault": false, "LocalAddress": "en0", "ExternalAddress": "en0",