From 5523388ad485e4a036e18403c700d12262be7e43 Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Sat, 20 Jul 2024 11:58:18 -0700 Subject: [PATCH] disable rare notifs for client drops by default --- src/ReceiveSubcommands.cc | 4 +++- src/ServerState.cc | 1 + src/ServerState.hh | 1 + system/config.example.json | 4 ++++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ReceiveSubcommands.cc b/src/ReceiveSubcommands.cc index de5d1e8b..cc74adbb 100644 --- a/src/ReceiveSubcommands.cc +++ b/src/ReceiveSubcommands.cc @@ -1956,10 +1956,12 @@ static void on_box_or_enemy_item_drop_t(shared_ptr c, uint8_t command, u return; } + bool should_notify = s->rare_notifs_enabled_for_client_drops && (l->drop_mode == Lobby::DropMode::CLIENT); + ItemData item = cmd.item.item; item.decode_for_version(c->version()); l->on_item_id_generated_externally(item.id); - l->add_item(cmd.item.floor, item, cmd.item.x, cmd.item.z, (l->drop_mode == Lobby::DropMode::CLIENT) ? 0x100F : 0x000F); + l->add_item(cmd.item.floor, item, cmd.item.x, cmd.item.z, should_notify ? 0x100F : 0x000F); auto name = s->describe_item(c->version(), item, false); l->log.info("Player %hhu (leader) created floor item %08" PRIX32 " (%s) at %hhu:(%g, %g)", diff --git a/src/ServerState.cc b/src/ServerState.cc index 55989dc3..8614de81 100644 --- a/src/ServerState.cc +++ b/src/ServerState.cc @@ -789,6 +789,7 @@ void ServerState::load_config_early() { this->cheat_mode_behavior = parse_behavior_switch("CheatModeBehavior", BehaviorSwitch::OFF_BY_DEFAULT); this->default_switch_assist_enabled = this->config_json->get_bool("EnableSwitchAssistByDefault", false); this->use_game_creator_section_id = this->config_json->get_bool("UseGameCreatorSectionID", false); + this->rare_notifs_enabled_for_client_drops = this->config_json->get_bool("RareNotificationsEnabledForClientDrops", false); this->default_rare_notifs_enabled_v1_v2 = this->config_json->get_bool("RareNotificationsEnabledByDefault", false); this->default_rare_notifs_enabled_v3_v4 = this->default_rare_notifs_enabled_v1_v2; this->default_rare_notifs_enabled_v1_v2 = this->config_json->get_bool("RareNotificationsEnabledByDefaultV1V2", this->default_rare_notifs_enabled_v1_v2); diff --git a/src/ServerState.hh b/src/ServerState.hh index c458939e..65b2bce8 100644 --- a/src/ServerState.hh +++ b/src/ServerState.hh @@ -134,6 +134,7 @@ struct ServerState : public std::enable_shared_from_this { BehaviorSwitch cheat_mode_behavior = BehaviorSwitch::OFF_BY_DEFAULT; bool default_switch_assist_enabled = false; bool use_game_creator_section_id = false; + bool rare_notifs_enabled_for_client_drops = false; bool default_rare_notifs_enabled_v1_v2 = false; bool default_rare_notifs_enabled_v3_v4 = false; std::unordered_set notify_game_for_item_primary_identifiers_v1_v2; diff --git a/system/config.example.json b/system/config.example.json index 78256bd3..d5cd2fb6 100644 --- a/system/config.example.json +++ b/system/config.example.json @@ -1006,6 +1006,10 @@ "RareNotificationsEnabledByDefaultV1V2": false, "RareNotificationsEnabledByDefaultV3V4": false, + // If this is true, items generated in client drop mode can trigger rare drop + // notifications. By default, they can't. + "RareNotificationsEnabledForClientDrops": false, + // Items for which rare notifications should be broadcast to the game or // entire server. These notifications occur when the item is picked up. They // only are generated from items dropped by boxes and enemies; items dropped