Skip to content

Commit ed85d1f

Browse files
authored
Added an option to track shiny sounds without notifications. (#854)
* Add saving every X resets * Added an option to track shiny sounds without notifications. * Should be not equal * Update Record Video discription
1 parent 03d747c commit ed85d1f

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

SerialPrograms/Source/PokemonLZA/Options/PokemonLZA_ShinyDetectedAction.cpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@ ShinySoundDetectedActionOption::ShinySoundDetectedActionOption(
3030
{
3131
{ShinySoundDetectedAction::STOP_PROGRAM, "stop", "Stop program and go Home. Send notification."},
3232
{ShinySoundDetectedAction::NOTIFY_ON_FIRST_ONLY, "notify-first", "Keep running. Notify on first shiny sound only."},
33+
{ShinySoundDetectedAction::NO_NOTIFICATIONS, "no-notifications", "Keep running. Track shiny sounds without sending notifications."},
3334
// {ShinySoundDetectedAction::NOTIFY_ON_ALL, "notify-all", "Keep running. Notify on all shiny sounds."},
3435
},
3536
LockMode::UNLOCK_WHILE_RUNNING,
3637
default_action
3738
)
3839
, TAKE_VIDEO(
39-
"<b>Take Video:</b>",
40+
"<b>Take Video:</b><br>"
41+
"Records the first shiny sound using the switch capture button.<br>",
4042
LockMode::UNLOCK_WHILE_RUNNING,
4143
true
4244
)
@@ -84,12 +86,18 @@ bool ShinySoundDetectedActionOption::on_shiny_sound(
8486
return false;
8587
}
8688

89+
if (action == ShinySoundDetectedAction::NO_NOTIFICATIONS && current_count > 1) {
90+
return false;
91+
}
92+
8793
if (TAKE_VIDEO){
8894
context.wait_for(SCREENSHOT_DELAY);
8995
pbf_press_button(context, BUTTON_CAPTURE, 2 * TICKS_PER_SECOND, 0);
9096
}
9197

92-
send_shiny_sound_notification(env, stream, error_coefficient);
98+
if (action != ShinySoundDetectedAction::NO_NOTIFICATIONS) {
99+
send_shiny_sound_notification(env, stream, error_coefficient);
100+
}
93101

94102
return action == ShinySoundDetectedAction::STOP_PROGRAM;
95103
}
@@ -141,7 +149,13 @@ bool ShinySoundHandler::on_shiny_sound(
141149
return false;
142150
}
143151

144-
m_option.send_shiny_sound_notification(env, stream, error_coefficient);
152+
if (action == ShinySoundDetectedAction::NO_NOTIFICATIONS && current_count > 1){
153+
return false;
154+
}
155+
156+
if (action != ShinySoundDetectedAction::NO_NOTIFICATIONS){
157+
m_option.send_shiny_sound_notification(env, stream, error_coefficient);
158+
}
145159

146160
if (m_pending_video.load(std::memory_order_acquire)){
147161
stream.log("Back-to-back shiny sounds. Suppressing video.", COLOR_RED);

SerialPrograms/Source/PokemonLZA/Options/PokemonLZA_ShinyDetectedAction.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ enum class ShinySoundDetectedAction{
2727
STOP_PROGRAM, // stop program at first detected shiny sound
2828
NOTIFY_ON_FIRST_ONLY, // notify user only on the first shiny sound, keep running the program
2929
NOTIFY_ON_ALL, // notify on all shiny sounds, keep running the program
30+
NO_NOTIFICATIONS // no notifications, still track shiny sounds
3031
};
3132

3233

0 commit comments

Comments
 (0)