From d64aa4c92bd9b730b6404c88971f22efff97a405 Mon Sep 17 00:00:00 2001 From: kichithewolf Date: Wed, 11 Jun 2025 12:29:54 -0400 Subject: [PATCH 1/4] BBQ farmer: reset date after skipping --- .../Farming/PokemonSV_BlueberryCatchPhoto.cpp | 10 +++++++ .../Farming/PokemonSV_BlueberryQuests.cpp | 30 +++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryCatchPhoto.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryCatchPhoto.cpp index a211bea835..445c03515d 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryCatchPhoto.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryCatchPhoto.cpp @@ -918,6 +918,16 @@ void quest_catch( pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0); resume_game_from_home(console, context); + //Wait a bit and then fix the time to prevent running out of years + pbf_wait(context, 250); + context.wait_for_all_requests(); + pbf_press_button(context, BUTTON_HOME, 80ms, GameSettings::instance().GAME_TO_HOME_DELAY1); + home_to_date_time(console, context, false); + pbf_press_button(context, BUTTON_A, 20, 105); + pbf_press_button(context, BUTTON_A, 20, 105); + pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0); + resume_game_from_home(console, context); + //Heal up and then reset position again. OverworldWatcher done_healing(console.logger(), COLOR_BLUE); pbf_move_left_joystick(context, 128, 0, 100, 20); diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryQuests.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryQuests.cpp index cd8946e356..4cbc6307eb 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryQuests.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryQuests.cpp @@ -707,6 +707,16 @@ void quest_tera_self_defeat( pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0); resume_game_from_home(console, context); + //Wait a bit and then fix the time to prevent running out of years + pbf_wait(context, 250); + context.wait_for_all_requests(); + pbf_press_button(context, BUTTON_HOME, 80ms, GameSettings::instance().GAME_TO_HOME_DELAY1); + home_to_date_time(console, context, false); + pbf_press_button(context, BUTTON_A, 20, 105); + pbf_press_button(context, BUTTON_A, 20, 105); + pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0); + resume_game_from_home(console, context); + //Heal up and then reset position again. OverworldWatcher done_healing(console.logger(), COLOR_BLUE); pbf_move_left_joystick(context, 128, 0, 100, 20); @@ -843,6 +853,16 @@ void quest_sneak_up( pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0); resume_game_from_home(console, context); context.wait_for_all_requests(); + + //Wait a bit and then fix the time to prevent running out of years + pbf_wait(context, 250); + context.wait_for_all_requests(); + pbf_press_button(context, BUTTON_HOME, 80ms, GameSettings::instance().GAME_TO_HOME_DELAY1); + home_to_date_time(console, context, false); + pbf_press_button(context, BUTTON_A, 20, 105); + pbf_press_button(context, BUTTON_A, 20, 105); + pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0); + resume_game_from_home(console, context); } void quest_wild_tera( @@ -917,6 +937,16 @@ void quest_wild_tera( pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0); resume_game_from_home(console, context); + //Wait a bit and then fix the time to prevent running out of years + pbf_wait(context, 250); + context.wait_for_all_requests(); + pbf_press_button(context, BUTTON_HOME, 80ms, GameSettings::instance().GAME_TO_HOME_DELAY1); + home_to_date_time(console, context, false); + pbf_press_button(context, BUTTON_A, 20, 105); + pbf_press_button(context, BUTTON_A, 20, 105); + pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0); + resume_game_from_home(console, context); + //Heal up and then reset position again. OverworldWatcher done_healing(console.logger(), COLOR_BLUE); pbf_move_left_joystick(context, 128, 0, 100, 20); From 88da1f615dcd50c9218b1025729e3769e1bb3a42 Mon Sep 17 00:00:00 2001 From: kichithewolf Date: Wed, 11 Jun 2025 14:32:02 -0400 Subject: [PATCH 2/4] move fix to after each batch is done, some sw2 fixes --- .../Farming/PokemonSV_BBQSoloFarmer.cpp | 25 ++++++-- .../Farming/PokemonSV_BlueberryCatchPhoto.cpp | 10 ---- .../Farming/PokemonSV_BlueberryQuests.cpp | 57 +++++++------------ 3 files changed, 41 insertions(+), 51 deletions(-) diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BBQSoloFarmer.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BBQSoloFarmer.cpp index 53e73fef6d..d93cfeb767 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BBQSoloFarmer.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BBQSoloFarmer.cpp @@ -71,10 +71,15 @@ BBQSoloFarmer::BBQSoloFarmer() void BBQSoloFarmer::program(SingleSwitchProgramEnvironment& env, ProControllerContext& context){ assert_16_9_720p_min(env.logger(), env.console); BBQSoloFarmer_Descriptor::Stats& stats = env.current_stats(); + + //Make sure console type is set + if (env.console.state().console_type() == ConsoleType::Unknown) { + throw UserSetupError(env.console, "Console Type (Switch 1 or 2) must be specified."); + } //Fly to plaza - open_map_from_overworld(env.program_info(), env.console, context); - fly_to_overworld_from_map(env.program_info(), env.console, context); + //open_map_from_overworld(env.program_info(), env.console, context); + //fly_to_overworld_from_map(env.program_info(), env.console, context); std::vector quest_list; //all quests std::vector quests_to_do; //do-able quests @@ -82,13 +87,13 @@ void BBQSoloFarmer::program(SingleSwitchProgramEnvironment& env, ProControllerCo uint64_t num_completed_quests = 0; //Test a specific quest - /* - BBQuests test_quest = BBQuests::catch_bug; + + BBQuests test_quest = BBQuests::tera_raid; bool questTest = process_and_do_quest(env, env.console, context, BBQ_OPTIONS, test_quest, eggs_hatched); if (questTest){ env.log("Finished quest."); } - */ + while (num_completed_quests < BBQ_OPTIONS.NUM_QUESTS){ if (BBQ_OPTIONS.OUT_OF_EGGS == BBQOption::OOEggs::Stop && eggs_hatched >= BBQ_OPTIONS.NUM_EGGS){ @@ -131,6 +136,16 @@ void BBQSoloFarmer::program(SingleSwitchProgramEnvironment& env, ProControllerCo //Clear out the todo list quests_to_do.clear(); + //Fix the time to prevent running out of years + pbf_wait(context, 250); + context.wait_for_all_requests(); + pbf_press_button(context, BUTTON_HOME, 80ms, GameSettings::instance().GAME_TO_HOME_DELAY1); + home_to_date_time(console, context, false); + pbf_press_button(context, BUTTON_A, 20, 105); + pbf_press_button(context, BUTTON_A, 20, 105); + pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0); + resume_game_from_home(console, context); + uint64_t temp_save_num_option = BBQ_OPTIONS.SAVE_NUM_QUESTS; if (temp_save_num_option != 0 && num_completed_quests % temp_save_num_option == 0){ env.log("Saving and resetting."); diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryCatchPhoto.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryCatchPhoto.cpp index 445c03515d..a211bea835 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryCatchPhoto.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryCatchPhoto.cpp @@ -918,16 +918,6 @@ void quest_catch( pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0); resume_game_from_home(console, context); - //Wait a bit and then fix the time to prevent running out of years - pbf_wait(context, 250); - context.wait_for_all_requests(); - pbf_press_button(context, BUTTON_HOME, 80ms, GameSettings::instance().GAME_TO_HOME_DELAY1); - home_to_date_time(console, context, false); - pbf_press_button(context, BUTTON_A, 20, 105); - pbf_press_button(context, BUTTON_A, 20, 105); - pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0); - resume_game_from_home(console, context); - //Heal up and then reset position again. OverworldWatcher done_healing(console.logger(), COLOR_BLUE); pbf_move_left_joystick(context, 128, 0, 100, 20); diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryQuests.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryQuests.cpp index 4cbc6307eb..9252915183 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryQuests.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryQuests.cpp @@ -658,7 +658,12 @@ void quest_tera_self_defeat( pbf_press_button(context, BUTTON_L | BUTTON_PLUS, 20, 105); //Drop on top of Kleavor (plenty of Scyther in the area as well) - jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 1000, 1650, 300); + if (console.state().console_type() == ConsoleType::Switch1) { + jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 1000, 1650, 300); + } + else { //All switch 2s + jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 1000, 1600, 300); + } ssf_press_button(context, BUTTON_ZR, 0, 200); ssf_press_button(context, BUTTON_ZL, 100, 50); @@ -707,16 +712,6 @@ void quest_tera_self_defeat( pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0); resume_game_from_home(console, context); - //Wait a bit and then fix the time to prevent running out of years - pbf_wait(context, 250); - context.wait_for_all_requests(); - pbf_press_button(context, BUTTON_HOME, 80ms, GameSettings::instance().GAME_TO_HOME_DELAY1); - home_to_date_time(console, context, false); - pbf_press_button(context, BUTTON_A, 20, 105); - pbf_press_button(context, BUTTON_A, 20, 105); - pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0); - resume_game_from_home(console, context); - //Heal up and then reset position again. OverworldWatcher done_healing(console.logger(), COLOR_BLUE); pbf_move_left_joystick(context, 128, 0, 100, 20); @@ -763,8 +758,12 @@ void quest_sneak_up( pbf_press_button(context, BUTTON_L, 20, 50); pbf_move_left_joystick(context, 128, 0, 100, 50); - pbf_move_left_joystick(context, 0, 0, 20, 50); - pbf_press_button(context, BUTTON_L, 20, 50); + + //Turn slightly for switch 1 + if (console.state().console_type() == ConsoleType::Switch1) { + pbf_move_left_joystick(context, 0, 0, 20, 50); + pbf_press_button(context, BUTTON_L, 20, 50); + } ssf_press_button(context, BUTTON_ZR, 0, 200); ssf_press_button(context, BUTTON_ZL, 100, 50); @@ -853,16 +852,6 @@ void quest_sneak_up( pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0); resume_game_from_home(console, context); context.wait_for_all_requests(); - - //Wait a bit and then fix the time to prevent running out of years - pbf_wait(context, 250); - context.wait_for_all_requests(); - pbf_press_button(context, BUTTON_HOME, 80ms, GameSettings::instance().GAME_TO_HOME_DELAY1); - home_to_date_time(console, context, false); - pbf_press_button(context, BUTTON_A, 20, 105); - pbf_press_button(context, BUTTON_A, 20, 105); - pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0); - resume_game_from_home(console, context); } void quest_wild_tera( @@ -887,9 +876,15 @@ void quest_wild_tera( //Skarmory is likely to attack but sometimes there is a different pokemon pbf_press_button(context, BUTTON_PLUS, 20, 105); - pbf_move_left_joystick(context, 50, 0, 20, 105); - pbf_press_button(context, BUTTON_L, 20, 50); - pbf_move_left_joystick(context, 128, 0, 100, 50); + if (console.state().console_type() == ConsoleType::Switch1) { + pbf_move_left_joystick(context, 50, 0, 20, 105); + pbf_press_button(context, BUTTON_L, 20, 50); + pbf_move_left_joystick(context, 128, 0, 100, 50); + } + else { //Switch 2 + pbf_move_left_joystick(context, 20, 0, 20, 105); + pbf_press_button(context, BUTTON_L, 20, 50); + } ssf_press_button(context, BUTTON_ZR, 0, 200); ssf_press_button(context, BUTTON_ZL, 100, 50); @@ -937,16 +932,6 @@ void quest_wild_tera( pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0); resume_game_from_home(console, context); - //Wait a bit and then fix the time to prevent running out of years - pbf_wait(context, 250); - context.wait_for_all_requests(); - pbf_press_button(context, BUTTON_HOME, 80ms, GameSettings::instance().GAME_TO_HOME_DELAY1); - home_to_date_time(console, context, false); - pbf_press_button(context, BUTTON_A, 20, 105); - pbf_press_button(context, BUTTON_A, 20, 105); - pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0); - resume_game_from_home(console, context); - //Heal up and then reset position again. OverworldWatcher done_healing(console.logger(), COLOR_BLUE); pbf_move_left_joystick(context, 128, 0, 100, 20); From 6ea8f8de5b10ede2f6ebf38394e16714b7b59852 Mon Sep 17 00:00:00 2001 From: kichithewolf Date: Wed, 11 Jun 2025 15:31:02 -0400 Subject: [PATCH 3/4] stream to console, some more fixes --- .../Farming/PokemonSV_BBQSoloFarmer.cpp | 6 +- .../Farming/PokemonSV_BlueberryCatchPhoto.cpp | 329 +++++++++--------- .../Farming/PokemonSV_BlueberryCatchPhoto.h | 12 +- .../Farming/PokemonSV_BlueberryQuests.cpp | 6 +- 4 files changed, 181 insertions(+), 172 deletions(-) diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BBQSoloFarmer.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BBQSoloFarmer.cpp index d93cfeb767..f9418abd81 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BBQSoloFarmer.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BBQSoloFarmer.cpp @@ -88,7 +88,7 @@ void BBQSoloFarmer::program(SingleSwitchProgramEnvironment& env, ProControllerCo //Test a specific quest - BBQuests test_quest = BBQuests::tera_raid; + BBQuests test_quest = BBQuests::catch_any; bool questTest = process_and_do_quest(env, env.console, context, BBQ_OPTIONS, test_quest, eggs_hatched); if (questTest){ env.log("Finished quest."); @@ -140,11 +140,11 @@ void BBQSoloFarmer::program(SingleSwitchProgramEnvironment& env, ProControllerCo pbf_wait(context, 250); context.wait_for_all_requests(); pbf_press_button(context, BUTTON_HOME, 80ms, GameSettings::instance().GAME_TO_HOME_DELAY1); - home_to_date_time(console, context, false); + home_to_date_time(env.console, context, false); pbf_press_button(context, BUTTON_A, 20, 105); pbf_press_button(context, BUTTON_A, 20, 105); pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0); - resume_game_from_home(console, context); + resume_game_from_home(env.console, context); uint64_t temp_save_num_option = BBQ_OPTIONS.SAVE_NUM_QUESTS; if (temp_save_num_option != 0 && num_completed_quests % temp_save_num_option == 0){ diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryCatchPhoto.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryCatchPhoto.cpp index a211bea835..f4071f9fa9 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryCatchPhoto.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryCatchPhoto.cpp @@ -38,7 +38,7 @@ namespace PokemonSV{ CameraAngle quest_photo_navi( const ProgramInfo& info, - VideoStream& stream, ProControllerContext& context, + ConsoleHandle& console, ProControllerContext& context, const BBQOption& BBQ_OPTIONS, BBQuests current_quest ){ @@ -47,10 +47,10 @@ CameraAngle quest_photo_navi( //Navigate to target switch (current_quest){ case BBQuests::photo_fly: case BBQuests::photo_psychic: - stream.log("Photo: In-flight/Psychic"); + console.log("Photo: In-flight/Psychic"); //Polar Rest Area - targeting Duosion fixed spawn - central_to_polar_rest(info, stream, context); + central_to_polar_rest(info, console, context); pbf_press_button(context, BUTTON_L, 10, 50); pbf_move_left_joystick(context, 128, 0, 230, 20); @@ -58,10 +58,10 @@ CameraAngle quest_photo_navi( break; case BBQuests::photo_swim: case BBQuests::photo_water: case BBQuests::photo_polar: - stream.log("Photo: Swimming/Water/Polar"); + console.log("Photo: Swimming/Water/Polar"); //Polar Outdoor Classroom 1 - fixed Horsea - central_to_polar_class1(info, stream, context); + central_to_polar_class1(info, console, context); pbf_wait(context, 200); context.wait_for_all_requests(); @@ -73,10 +73,10 @@ CameraAngle quest_photo_navi( break; case BBQuests::photo_coastal: case BBQuests::photo_grass: case BBQuests::photo_dragon: - stream.log("Photo: Coastal/Grass/Dragon"); + console.log("Photo: Coastal/Grass/Dragon"); //Coastal Plaza - Exeggutor-A - central_to_coastal_plaza(info, stream, context); + central_to_coastal_plaza(info, console, context); pbf_move_left_joystick(context, 0, 115, 400, 20); @@ -97,29 +97,29 @@ CameraAngle quest_photo_navi( break; case BBQuests::photo_canyon: case BBQuests::photo_ghost: case BBQuests::photo_ground: - stream.log("Photo: Canyon/Ghost/Ground"); + console.log("Photo: Canyon/Ghost/Ground"); //Canyon Plaza - Golett - central_to_canyon_plaza(info, stream, context); + central_to_canyon_plaza(info, console, context); pbf_move_left_joystick(context, 210, 128, 10, 20); pbf_press_button(context, BUTTON_L | BUTTON_PLUS, 20, 105); - jump_glide_fly(stream, context, BBQ_OPTIONS.INVERTED_FLIGHT, 600, 250, 400); + jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 600, 250, 400); pbf_press_button(context, BUTTON_L | BUTTON_PLUS, 20, 105); break; case BBQuests::photo_savanna: case BBQuests::photo_normal: case BBQuests::photo_fire: - stream.log("Photo: Normal/Fire"); + console.log("Photo: Normal/Fire"); //Savanna Plaza - Pride Rock - central_to_savanna_plaza(info, stream, context); + central_to_savanna_plaza(info, console, context); pbf_move_left_joystick(context, 220, 255, 10, 20); pbf_press_button(context, BUTTON_L | BUTTON_PLUS, 20, 105); - jump_glide_fly(stream, context, BBQ_OPTIONS.INVERTED_FLIGHT, 600, 400, 400); + jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 600, 400, 400); pbf_press_button(context, BUTTON_PLUS, 20, 105); pbf_move_left_joystick(context, 255, 128, 20, 50); @@ -130,30 +130,30 @@ CameraAngle quest_photo_navi( break; case BBQuests::photo_bug: case BBQuests::photo_rock: - stream.log("Photo: Bug/Rock"); + console.log("Photo: Bug/Rock"); //Kleavor - central_to_canyon_plaza(info, stream, context); + central_to_canyon_plaza(info, console, context); pbf_move_left_joystick(context, 205, 64, 20, 105); pbf_press_button(context, BUTTON_L | BUTTON_PLUS, 20, 105); - jump_glide_fly(stream, context, BBQ_OPTIONS.INVERTED_FLIGHT, 1000, 1500, 300); + jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 1000, 1500, 300); pbf_press_button(context, BUTTON_L | BUTTON_PLUS, 20, 105); break; case BBQuests::photo_fairy: - stream.log("Photo: Fairy"); + console.log("Photo: Fairy"); //Snubbull - Central plaza - open_map_from_overworld(info, stream, context); - fly_to_overworld_from_map(info, stream, context); + open_map_from_overworld(info, console, context); + fly_to_overworld_from_map(info, console, context); pbf_move_left_joystick(context, 0, 80, 10, 20); pbf_press_button(context, BUTTON_L | BUTTON_PLUS, 20, 105); - jump_glide_fly(stream, context, BBQ_OPTIONS.INVERTED_FLIGHT, 2000, 1500, 200); + jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 2000, 1500, 200); pbf_press_button(context, BUTTON_PLUS, 20, 105); @@ -163,16 +163,16 @@ CameraAngle quest_photo_navi( angle = CameraAngle::down; break; case BBQuests::photo_ice: - stream.log("Photo: Ice"); + console.log("Photo: Ice"); //Snover - Start at central plaza, fly north-ish - open_map_from_overworld(info, stream, context); - fly_to_overworld_from_map(info, stream, context); + open_map_from_overworld(info, console, context); + fly_to_overworld_from_map(info, console, context); pbf_move_left_joystick(context, 0, 0, 10, 20); pbf_press_button(context, BUTTON_L | BUTTON_PLUS, 20, 105); - jump_glide_fly(stream, context, BBQ_OPTIONS.INVERTED_FLIGHT, 1100, 1700, 200); + jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 1100, 1700, 200); pbf_press_button(context, BUTTON_PLUS, 20, 105); pbf_move_left_joystick(context, 0, 128, 20, 50); @@ -180,10 +180,10 @@ CameraAngle quest_photo_navi( break; case BBQuests::photo_flying: case BBQuests::photo_dark: - stream.log("Photo: Dark/Flying"); + console.log("Photo: Dark/Flying"); //Vullaby/Mandibuzz - central_to_savanna_plaza(info, stream, context); + central_to_savanna_plaza(info, console, context); pbf_move_left_joystick(context, 255, 0, 10, 20); pbf_press_button(context, BUTTON_L | BUTTON_PLUS, 20, 105); @@ -198,10 +198,10 @@ CameraAngle quest_photo_navi( angle = CameraAngle::down; break; case BBQuests::photo_electric: - stream.log("Photo: Electric"); + console.log("Photo: Electric"); //Electabuzz - central_to_canyon_rest(info, stream, context); + central_to_canyon_rest(info, console, context); pbf_move_left_joystick(context, 255, 255, 10, 20); pbf_press_button(context, BUTTON_L, 20, 50); @@ -209,33 +209,36 @@ CameraAngle quest_photo_navi( break; case BBQuests::photo_fighting: - stream.log("Photo: Fighting"); + console.log("Photo: Fighting"); //Hitmontop (TERA ICE) - Canyon Plaza or Classroom - central_to_canyon_plaza(info, stream, context); + central_to_canyon_plaza(info, console, context); pbf_move_left_joystick(context, 0, 128, 400, 20); pbf_press_button(context, BUTTON_L, 10, 50); pbf_move_left_joystick(context, 0, 100, 20, 50); pbf_press_button(context, BUTTON_L | BUTTON_PLUS, 20, 105); - jump_glide_fly(stream, context, BBQ_OPTIONS.INVERTED_FLIGHT, 200, 500, 800); + jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 200, 500, 800); pbf_press_button(context, BUTTON_PLUS, 20, 100); context.wait_for_all_requests(); break; case BBQuests::photo_poison: - stream.log("Photo: Poison"); + console.log("Photo: Poison"); //Muk-A - area a bit laggy but consistently so - central_to_coastal_plaza(info, stream, context); + central_to_coastal_plaza(info, console, context); pbf_move_left_joystick(context, 0, 128, 20, 50); pbf_press_button(context, BUTTON_L | BUTTON_PLUS, 20, 105); - jump_glide_fly(stream, context, BBQ_OPTIONS.INVERTED_FLIGHT, 1000, 1400, 300); + if (console.state().console_type() == ConsoleType::Switch1) { + jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 1000, 1400, 300); + } else { //Switch 2 + jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 1000, 1300, 300); + } pbf_press_button(context, BUTTON_PLUS, 20, 105); - pbf_move_left_joystick(context, 128, 0, 150, 50); pbf_move_left_joystick(context, 180, 0, 20, 50); pbf_wait(context, 200); //Give it time to spawn/load. @@ -245,14 +248,19 @@ CameraAngle quest_photo_navi( break; case BBQuests::photo_steel: - stream.log("Photo: Steel"); + console.log("Photo: Steel"); //Dugtrio-A - area a bit laggy but should work most of the time - central_to_coastal_plaza(info, stream, context); + central_to_coastal_plaza(info, console, context); pbf_move_left_joystick(context, 0, 128, 20, 50); pbf_press_button(context, BUTTON_L | BUTTON_PLUS, 20, 105); - jump_glide_fly(stream, context, BBQ_OPTIONS.INVERTED_FLIGHT, 200, 575, 200); + + if (console.state().console_type() == ConsoleType::Switch1) { + jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 200, 575, 200); + } else { //Switch 2 + jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 200, 500, 200); + } pbf_press_button(context, BUTTON_PLUS, 20, 105); pbf_move_left_joystick(context, 0, 128, 20, 50); @@ -263,7 +271,7 @@ CameraAngle quest_photo_navi( OperationFailedException::fire( ErrorReport::SEND_ERROR_REPORT, "Invalid photo quest.", - stream + console ); break; } @@ -273,7 +281,7 @@ CameraAngle quest_photo_navi( void quest_photo( const ProgramInfo& info, - VideoStream& stream, ProControllerContext& context, + ConsoleHandle& console, ProControllerContext& context, const BBQOption& BBQ_OPTIONS, BBQuests current_quest ){ @@ -281,17 +289,17 @@ void quest_photo( CameraAngle move_camera = CameraAngle::none; while(!took_photo){ - EncounterWatcher encounter_watcher(stream, COLOR_RED); + EncounterWatcher encounter_watcher(console, COLOR_RED); int ret = run_until( - stream, context, + console, context, [&](ProControllerContext& context){ - move_camera = quest_photo_navi(info, stream, context, BBQ_OPTIONS, current_quest); + move_camera = quest_photo_navi(info, console, context, BBQ_OPTIONS, current_quest); //Take photo. - stream.log("Taking photo."); + console.log("Taking photo."); PromptDialogWatcher photo_prompt(COLOR_RED); - OverworldWatcher overworld(stream.logger(), COLOR_BLUE); + OverworldWatcher overworld(console.logger(), COLOR_BLUE); pbf_press_dpad(context, DPAD_DOWN, 50, 20); pbf_wait(context, 100); @@ -307,24 +315,24 @@ void quest_photo( pbf_press_button(context, BUTTON_A, 20, 50); int ret = wait_until( - stream, context, + console, context, std::chrono::seconds(10), { photo_prompt } ); if (ret != 0){ - stream.log("Photo not taken."); + console.log("Photo not taken."); } //Mash B until overworld int exit = run_until( - stream, context, + console, context, [&](ProControllerContext& context){ pbf_mash_button(context, BUTTON_B, 2000); }, {{ overworld }} ); if (exit == 0){ - stream.log("Overworld detected."); + console.log("Overworld detected."); } took_photo = true; context.wait_for_all_requests(); @@ -337,71 +345,74 @@ void quest_photo( encounter_watcher.throw_if_no_sound(); if (ret >= 0){ - stream.log("Battle menu detected."); + console.log("Battle menu detected."); bool is_shiny = (bool)encounter_watcher.shiny_screenshot(); if (is_shiny){ - stream.log("Shiny detected!"); + console.log("Shiny detected!"); pbf_press_button(context, BUTTON_CAPTURE, 2 * TICKS_PER_SECOND, 5 * TICKS_PER_SECOND); throw ProgramFinishedException(); }else{ - stream.log("Detected battle. Running from battle and returning to plaza."); + console.log("Detected battle. Running from battle and returning to plaza."); try{ //Smoke Ball or Flying type required due to Arena Trap/Magnet Pull NormalBattleMenuWatcher battle_menu(COLOR_YELLOW); - battle_menu.move_to_slot(stream, context, 3); + battle_menu.move_to_slot(console, context, 3); pbf_press_button(context, BUTTON_A, 10, 50); - press_Bs_to_back_to_overworld(info, stream, context); - return_to_plaza(info, stream, context); + press_Bs_to_back_to_overworld(info, console, context); + return_to_plaza(info, console, context); }catch (...){ - stream.log("Unable to flee."); + console.log("Unable to flee."); OperationFailedException::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to flee!", - stream + console ); } } } } context.wait_for_all_requests(); - return_to_plaza(info, stream, context); + return_to_plaza(info, console, context); } void quest_catch_navi( const ProgramInfo& info, - VideoStream& stream, ProControllerContext& context, + ConsoleHandle& console, ProControllerContext& context, const BBQOption& BBQ_OPTIONS, BBQuests current_quest ){ switch (current_quest){ case BBQuests::catch_any: case BBQuests::catch_normal: case BBQuests::catch_fire: - stream.log("Catch: Any/Normal/Fire"); + console.log("Catch: Any/Normal/Fire"); //Savanna Plaza - Pride Rock - central_to_savanna_plaza(info, stream, context); + central_to_savanna_plaza(info, console, context); - //pbf_move_left_joystick(context, 255, 255, 10, 20); pbf_move_left_joystick(context, 220, 255, 10, 20); pbf_press_button(context, BUTTON_L | BUTTON_PLUS, 20, 105); - jump_glide_fly(stream, context, BBQ_OPTIONS.INVERTED_FLIGHT, 600, 400, 400); + jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 600, 400, 400); pbf_press_button(context, BUTTON_PLUS, 20, 105); pbf_move_left_joystick(context, 255, 128, 20, 50); pbf_press_button(context, BUTTON_L, 20, 50); pbf_move_left_joystick(context, 128, 0, 100, 50); - pbf_move_left_joystick(context, 0, 0, 20, 50); - pbf_press_button(context, BUTTON_L, 20, 50); + + //Turn slightly for switch 1 + if (console.state().console_type() == ConsoleType::Switch1) { + pbf_move_left_joystick(context, 0, 0, 20, 50); + pbf_press_button(context, BUTTON_L, 20, 50); + } break; case BBQuests::catch_psychic: - stream.log("Catch: Psychic"); + console.log("Catch: Psychic"); //Polar Rest Area - targeting Duosion fixed spawn - central_to_polar_rest(info, stream, context); + central_to_polar_rest(info, console, context); pbf_press_button(context, BUTTON_L, 10, 50); pbf_move_left_joystick(context, 128, 0, 230, 20); @@ -413,10 +424,10 @@ void quest_catch_navi( break; case BBQuests::catch_grass: case BBQuests::catch_dragon: - stream.log("Catch: Grass/Dragon"); + console.log("Catch: Grass/Dragon"); //Coastal Plaza - Exeggutor-A - central_to_coastal_plaza(info, stream, context); + central_to_coastal_plaza(info, console, context); pbf_move_left_joystick(context, 0, 115, 400, 20); @@ -436,15 +447,15 @@ void quest_catch_navi( break; case BBQuests::catch_ghost: case BBQuests::catch_ground: - stream.log("Catch: Ghost/Ground"); + console.log("Catch: Ghost/Ground"); //Canyon Plaza - Golett - central_to_canyon_plaza(info, stream, context); + central_to_canyon_plaza(info, console, context); pbf_move_left_joystick(context, 210, 128, 10, 20); pbf_press_button(context, BUTTON_L | BUTTON_PLUS, 20, 105); - jump_glide_fly(stream, context, BBQ_OPTIONS.INVERTED_FLIGHT, 600, 300, 400); + jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 600, 300, 400); pbf_press_button(context, BUTTON_L | BUTTON_PLUS, 20, 105); @@ -454,17 +465,17 @@ void quest_catch_navi( break; case BBQuests::catch_fairy: - stream.log("Catch: Fairy"); + console.log("Catch: Fairy"); //Snubbull - Central plaza //Tested while snowing, seems fine? - open_map_from_overworld(info, stream, context); - fly_to_overworld_from_map(info, stream, context); + open_map_from_overworld(info, console, context); + fly_to_overworld_from_map(info, console, context); pbf_move_left_joystick(context, 0, 80, 10, 20); pbf_press_button(context, BUTTON_L | BUTTON_PLUS, 20, 105); - jump_glide_fly(stream, context, BBQ_OPTIONS.INVERTED_FLIGHT, 2000, 1500, 200); + jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 2000, 1500, 200); pbf_press_button(context, BUTTON_PLUS, 20, 105); @@ -473,34 +484,34 @@ void quest_catch_navi( break; case BBQuests::catch_fighting: - stream.log("Catch: Fighting"); + console.log("Catch: Fighting"); //Hitmontop (TERA ICE) - Canyon Plaza or Classroom - central_to_canyon_plaza(info, stream, context); + central_to_canyon_plaza(info, console, context); pbf_move_left_joystick(context, 0, 128, 400, 20); pbf_press_button(context, BUTTON_L, 10, 50); pbf_move_left_joystick(context, 0, 100, 20, 50); pbf_press_button(context, BUTTON_L | BUTTON_PLUS, 20, 105); - jump_glide_fly(stream, context, BBQ_OPTIONS.INVERTED_FLIGHT, 200, 500, 800); + jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 200, 500, 800); break; case BBQuests::catch_bug: - stream.log("Catch: Bug"); + console.log("Catch: Bug"); - central_to_canyon_plaza(info, stream, context); + central_to_canyon_plaza(info, console, context); pbf_move_left_joystick(context, 205, 64, 20, 105); pbf_press_button(context, BUTTON_L | BUTTON_PLUS, 20, 105); - jump_glide_fly(stream, context, BBQ_OPTIONS.INVERTED_FLIGHT, 1000, 1650, 500); + jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 1000, 1650, 500); break; case BBQuests::catch_dark: case BBQuests::catch_flying: - stream.log("Catch: Dark/Flying"); + console.log("Catch: Dark/Flying"); //Vullaby/Mandibuzz - central_to_savanna_plaza(info, stream, context); + central_to_savanna_plaza(info, console, context); pbf_move_left_joystick(context, 255, 40, 10, 20); pbf_press_button(context, BUTTON_L | BUTTON_PLUS, 20, 105); @@ -523,16 +534,16 @@ void quest_catch_navi( break; case BBQuests::catch_rock: case BBQuests::catch_electric: - stream.log("Catch: Rock/Electric"); + console.log("Catch: Rock/Electric"); //Geodude-A - open_map_from_overworld(info, stream, context); - fly_to_overworld_from_map(info, stream, context); + open_map_from_overworld(info, console, context); + fly_to_overworld_from_map(info, console, context); pbf_press_button(context, BUTTON_L, 20, 50); pbf_move_left_joystick(context, 70, 0, 10, 20); pbf_press_button(context, BUTTON_L | BUTTON_PLUS, 20, 105); - jump_glide_fly(stream, context, BBQ_OPTIONS.INVERTED_FLIGHT, 100, 550, 300); + jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 100, 550, 300); pbf_press_button(context, BUTTON_PLUS, 20, 105); pbf_wait(context, 300); @@ -540,14 +551,14 @@ void quest_catch_navi( break; case BBQuests::catch_steel: - stream.log("Catch: Steel"); + console.log("Catch: Steel"); //Dugtrio-A - area a bit laggy but should work most of the time - central_to_coastal_plaza(info, stream, context); + central_to_coastal_plaza(info, console, context); pbf_move_left_joystick(context, 0, 128, 20, 50); pbf_press_button(context, BUTTON_L | BUTTON_PLUS, 20, 105); - jump_glide_fly(stream, context, BBQ_OPTIONS.INVERTED_FLIGHT, 200, 590, 200); + jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 200, 590, 200); pbf_press_button(context, BUTTON_PLUS, 20, 105); pbf_move_left_joystick(context, 0, 128, 20, 50); @@ -556,14 +567,14 @@ void quest_catch_navi( break; case BBQuests::catch_poison: - stream.log("Catch: Poison"); + console.log("Catch: Poison"); //Muk-A - area a bit laggy but consistently so - central_to_coastal_plaza(info, stream, context); + central_to_coastal_plaza(info, console, context); pbf_move_left_joystick(context, 0, 128, 20, 50); pbf_press_button(context, BUTTON_L | BUTTON_PLUS, 20, 105); - jump_glide_fly(stream, context, BBQ_OPTIONS.INVERTED_FLIGHT, 1000, 1800, 300); + jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 1000, 1800, 300); pbf_press_button(context, BUTTON_PLUS, 20, 105); @@ -590,10 +601,10 @@ void quest_catch_navi( break; case BBQuests::catch_water: case BBQuests::catch_ice: - stream.log("Catch: Water/Ice"); + console.log("Catch: Water/Ice"); //Lapras - Tera Bug - central_to_polar_rest(info, stream, context); + central_to_polar_rest(info, console, context); pbf_press_button(context, BUTTON_L, 10, 50); pbf_move_left_joystick(context, 128, 0, 230, 20); pbf_move_left_joystick(context, 0, 128, 300, 20); @@ -601,14 +612,14 @@ void quest_catch_navi( pbf_move_left_joystick(context, 20, 0, 20, 50); pbf_press_button(context, BUTTON_L | BUTTON_PLUS, 20, 105); - jump_glide_fly(stream, context, BBQ_OPTIONS.INVERTED_FLIGHT, 700, 1700, 300); + jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 700, 1700, 300); break; default: OperationFailedException::fire( ErrorReport::SEND_ERROR_REPORT, "Invalid catch quest.", - stream + console ); break; } @@ -625,22 +636,22 @@ void quest_catch_navi( void quest_catch_throw_ball( const ProgramInfo& info, - VideoStream& stream, ProControllerContext& context, + ConsoleHandle& console, ProControllerContext& context, Language language, const std::string& selected_ball ){ - BattleBallReader reader(stream, language); + BattleBallReader reader(console, language); std::string ball_reader = ""; WallClock start = current_time(); - stream.log("Opening ball menu..."); + console.log("Opening ball menu..."); while (ball_reader == ""){ if (current_time() - start > std::chrono::minutes(2)){ - stream.log("Timed out trying to read ball after 2 minutes.", COLOR_RED); + console.log("Timed out trying to read ball after 2 minutes.", COLOR_RED); OperationFailedException::fire( ErrorReport::SEND_ERROR_REPORT, "Timed out trying to read ball after 2 minutes.", - stream + console ); } @@ -652,26 +663,26 @@ void quest_catch_throw_ball( pbf_press_button(context, BUTTON_X, 20, 100); context.wait_for_all_requests(); - VideoSnapshot screen = stream.video().snapshot(); + VideoSnapshot screen = console.video().snapshot(); ball_reader = reader.read_ball(screen); } - stream.log("Selecting ball."); - int quantity = move_to_ball(reader, stream, context, selected_ball); + console.log("Selecting ball."); + int quantity = move_to_ball(reader, console, context, selected_ball); if (quantity == 0){ - stream.log("Unable to find ball."); + console.log("Unable to find ball."); OperationFailedException::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to find ball.", - stream + console ); } if (quantity < 0){ - stream.log("Unable to read ball quantity.", COLOR_RED); + console.log("Unable to read ball quantity.", COLOR_RED); } //Throw ball - stream.log("Throwing ball."); + console.log("Throwing ball."); pbf_mash_button(context, BUTTON_A, 150); context.wait_for_all_requests(); @@ -681,14 +692,14 @@ void quest_catch_throw_ball( void quest_catch_handle_battle( const ProgramInfo& info, - VideoStream& stream, ProControllerContext& context, + ConsoleHandle& console, ProControllerContext& context, const BBQOption& BBQ_OPTIONS, BBQuests current_quest ){ - stream.log("Catching Pokemon."); + console.log("Catching Pokemon."); AdvanceDialogWatcher advance_dialog(COLOR_MAGENTA); PromptDialogWatcher add_to_party(COLOR_PURPLE); - OverworldWatcher overworld(stream.logger(), COLOR_RED); + OverworldWatcher overworld(console.logger(), COLOR_RED); uint8_t switch_party_slot = 1; bool quickball_thrown = false; @@ -696,38 +707,38 @@ void quest_catch_handle_battle( bool use_quickball = BBQ_OPTIONS.QUICKBALL; int ret2 = run_until( - stream, context, + console, context, [&](ProControllerContext& context){ while (true){ //Check that battle menu appears - this is in case of swapping pokemon NormalBattleMenuWatcher menu_before_throw(COLOR_YELLOW); int bMenu = wait_until( - stream, context, + console, context, std::chrono::seconds(15), { menu_before_throw } ); if (bMenu < 0){ - stream.log("Unable to find menu_before_throw."); + console.log("Unable to find menu_before_throw."); OperationFailedException::fire( ErrorReport::SEND_ERROR_REPORT, "Unable to find menu_before_throw.", - stream + console ); } //Check for catch menu - if none it is a tera pokemon - stream.log("Checking for ball menu."); - BattleBallReader exists(stream, BBQ_OPTIONS.LANGUAGE); + console.log("Checking for ball menu."); + BattleBallReader exists(console, BBQ_OPTIONS.LANGUAGE); std::string ball_exists = ""; pbf_press_button(context, BUTTON_X, 20, 100); context.wait_for_all_requests(); - VideoSnapshot screen_ball = stream.video().snapshot(); + VideoSnapshot screen_ball = console.video().snapshot(); ball_exists = exists.read_ball(screen_ball); if (ball_exists == ""){ - stream.log("Could not find ball reader. Tera battle. Using first attack."); + console.log("Could not find ball reader. Tera battle. Using first attack."); pbf_mash_button(context, BUTTON_B, 125); context.wait_for_all_requests(); @@ -739,28 +750,28 @@ void quest_catch_handle_battle( //Quick ball occurs before anything else in battle. //Do not throw if target is a tera pokemon. if (use_quickball && !quickball_thrown && tera_target == false){ - stream.log("Quick Ball option checked. Throwing Quick Ball."); - quest_catch_throw_ball(info, stream, context, BBQ_OPTIONS.LANGUAGE, "quick-ball"); + console.log("Quick Ball option checked. Throwing Quick Ball."); + quest_catch_throw_ball(info, console, context, BBQ_OPTIONS.LANGUAGE, "quick-ball"); quickball_thrown = true; }else{ - stream.log("Throwing selected ball."); - quest_catch_throw_ball(info, stream, context, BBQ_OPTIONS.LANGUAGE, BBQ_OPTIONS.BALL_SELECT.slug()); + console.log("Throwing selected ball."); + quest_catch_throw_ball(info, console, context, BBQ_OPTIONS.LANGUAGE, BBQ_OPTIONS.BALL_SELECT.slug()); } //Check for battle menu, if found use fourth attack this turn NormalBattleMenuWatcher battle_menu(COLOR_YELLOW); int ret = wait_until( - stream, context, + console, context, std::chrono::seconds(4), { battle_menu } ); if (ret == 0){ - stream.log("Battle menu detected early. Using fourth attack."); + console.log("Battle menu detected early. Using fourth attack."); MoveSelectWatcher move_watcher(COLOR_BLUE); MoveSelectDetector move_select(COLOR_BLUE); int ret_move_select = run_until( - stream, context, + console, context, [&](ProControllerContext& context){ pbf_press_button(context, BUTTON_A, 10, 50); pbf_wait(context, 100); @@ -769,13 +780,13 @@ void quest_catch_handle_battle( { move_watcher } ); if (ret_move_select != 0){ - stream.log("Could not find move select."); + console.log("Could not find move select."); }else{ - stream.log("Move select found!"); + console.log("Move select found!"); } context.wait_for_all_requests(); - move_select.move_to_slot(stream, context, 3); + move_select.move_to_slot(console, context, 3); pbf_mash_button(context, BUTTON_A, 150); pbf_wait(context, 100); context.wait_for_all_requests(); @@ -785,16 +796,16 @@ void quest_catch_handle_battle( //None of the target pokemon for this program have disable, taunt, etc. NormalBattleMenuWatcher battle_menu2(COLOR_YELLOW); int ret3 = wait_until( - stream, context, + console, context, std::chrono::seconds(4), { battle_menu2 } ); if (ret3 == 0){ - stream.log("Battle menu detected early. Out of PP/No move in slot, please check your setup."); + console.log("Battle menu detected early. Out of PP/No move in slot, please check your setup."); OperationFailedException::fire( ErrorReport::SEND_ERROR_REPORT, "Battle menu detected early. Out of PP, please check your setup.", - stream + console ); } }else{ @@ -808,31 +819,31 @@ void quest_catch_handle_battle( GradientArrowWatcher fainted(COLOR_BLUE, GradientArrowType::RIGHT, {0.610, 0.523, 0.044, 0.079}); SwapMenuWatcher swap(COLOR_YELLOW); int ret2_run = wait_until( - stream, context, + console, context, std::chrono::seconds(60), { battle_menu, fainted } ); switch (ret2_run){ case 0: - stream.log("Battle menu detected, continuing."); + console.log("Battle menu detected, continuing."); break; case 1: - stream.log("Detected fainted Pokemon. Switching to next living Pokemon..."); + console.log("Detected fainted Pokemon. Switching to next living Pokemon..."); pbf_press_button(context, BUTTON_A, 20, 50); pbf_wait(context, 100); context.wait_for_all_requests(); - if (swap.move_to_slot(stream, context, switch_party_slot)){ + if (swap.move_to_slot(console, context, switch_party_slot)){ pbf_mash_button(context, BUTTON_A, 3 * TICKS_PER_SECOND); context.wait_for_all_requests(); switch_party_slot++; } break; default: - stream.log("Invalid state ret2_run. Out of moves?"); + console.log("Invalid state ret2_run. Out of moves?"); OperationFailedException::fire( ErrorReport::SEND_ERROR_REPORT, "Invalid state ret2_run. Out of moves?", - stream + console ); } @@ -843,22 +854,22 @@ void quest_catch_handle_battle( switch (ret2){ case 0: - stream.log("Advance Dialog detected."); - press_Bs_to_back_to_overworld(info, stream, context); + console.log("Advance Dialog detected."); + press_Bs_to_back_to_overworld(info, console, context); break; case 1: - stream.log("Prompt dialog detected."); - press_Bs_to_back_to_overworld(info, stream, context); + console.log("Prompt dialog detected."); + press_Bs_to_back_to_overworld(info, console, context); break; case 2: - stream.log("Overworld detected."); + console.log("Overworld detected."); break; default: - stream.log("Invalid state in run_battle()."); + console.log("Invalid state in run_battle()."); OperationFailedException::fire( ErrorReport::SEND_ERROR_REPORT, "Invalid state in run_battle().", - stream + console ); } } @@ -943,30 +954,30 @@ void quest_catch( void wild_battle_tera( const ProgramInfo& info, - VideoStream& stream, ProControllerContext& context, + ConsoleHandle& console, ProControllerContext& context, bool& tera_self ){ AdvanceDialogWatcher lost(COLOR_YELLOW); - OverworldWatcher overworld(stream.logger(), COLOR_RED); + OverworldWatcher overworld(console.logger(), COLOR_RED); WallClock start = current_time(); uint8_t switch_party_slot = 1; bool first_turn = true; int ret2 = run_until( - stream, context, + console, context, [&](ProControllerContext& context){ while(true){ if (current_time() - start > std::chrono::minutes(5)){ - stream.log("Timed out during battle after 5 minutes.", COLOR_RED); + console.log("Timed out during battle after 5 minutes.", COLOR_RED); OperationFailedException::fire( ErrorReport::SEND_ERROR_REPORT, "Timed out during battle after 5 minutes.", - stream + console ); } if (first_turn && tera_self){ - stream.log("Turn 1: Tera."); + console.log("Turn 1: Tera."); //Open move menu pbf_press_button(context, BUTTON_A, 10, 50); pbf_wait(context, 100); @@ -985,22 +996,22 @@ void wild_battle_tera( context.wait_for_all_requests(); int ret3 = wait_until( - stream, context, + console, context, std::chrono::seconds(90), { battle_menu, fainted } ); switch (ret3){ case 0: - stream.log("Detected battle menu. Pressing A to attack..."); + console.log("Detected battle menu. Pressing A to attack..."); pbf_mash_button(context, BUTTON_A, 3 * TICKS_PER_SECOND); context.wait_for_all_requests(); break; case 1: - stream.log("Detected fainted Pokemon. Switching to next living Pokemon..."); + console.log("Detected fainted Pokemon. Switching to next living Pokemon..."); pbf_press_button(context, BUTTON_A, 20, 50); pbf_wait(context, 100); context.wait_for_all_requests(); - if (swap.move_to_slot(stream, context, switch_party_slot)){ + if (swap.move_to_slot(console, context, switch_party_slot)){ pbf_mash_button(context, BUTTON_A, 3 * TICKS_PER_SECOND); context.wait_for_all_requests(); switch_party_slot++; @@ -1010,7 +1021,7 @@ void wild_battle_tera( OperationFailedException::fire( ErrorReport::SEND_ERROR_REPORT, "Timed out during battle. Stuck, crashed, or took more than 90 seconds for a turn.", - stream + console ); } } @@ -1018,7 +1029,7 @@ void wild_battle_tera( { lost, overworld } ); if (ret2 == 0){ - stream.log("Lost battle. Mashing B."); + console.log("Lost battle. Mashing B."); } } diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryCatchPhoto.h b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryCatchPhoto.h index 1c09a17eed..20526904f3 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryCatchPhoto.h +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryCatchPhoto.h @@ -22,7 +22,7 @@ namespace PokemonSV{ //Navigate to a photo target CameraAngle quest_photo_navi( const ProgramInfo& info, - VideoStream& stream, ProControllerContext& context, + ConsoleHandle& console, ProControllerContext& context, const BBQOption& BBQ_OPTIONS, BBQuests current_quest ); @@ -30,7 +30,7 @@ CameraAngle quest_photo_navi( //Take picture of a pokemon/location void quest_photo( const ProgramInfo& info, - VideoStream& stream, ProControllerContext& context, + ConsoleHandle& console, ProControllerContext& context, const BBQOption& BBQ_OPTIONS, BBQuests current_quest ); @@ -39,7 +39,7 @@ void quest_photo( //Navigate to a catch target void quest_catch_navi( const ProgramInfo& info, - VideoStream& stream, ProControllerContext& context, + ConsoleHandle& console, ProControllerContext& context, const BBQOption& BBQ_OPTIONS, BBQuests current_quest ); @@ -47,7 +47,7 @@ void quest_catch_navi( //Select and throw ball void quest_catch_throw_ball( const ProgramInfo& info, - VideoStream& stream, ProControllerContext& context, + ConsoleHandle& console, ProControllerContext& context, Language language, const std::string& selected_ball ); @@ -55,7 +55,7 @@ void quest_catch_throw_ball( //Handle catching the target void quest_catch_handle_battle( const ProgramInfo& info, - VideoStream& stream, ProControllerContext& context, + ConsoleHandle& console, ProControllerContext& context, const BBQOption& BBQ_OPTIONS, BBQuests current_quest ); @@ -72,7 +72,7 @@ void quest_catch( //Handle battles for tera-self/defeat-wild-tera. Use first attack until victory. void wild_battle_tera( const ProgramInfo& info, - VideoStream& stream, ProControllerContext& context, + ConsoleHandle& console, ProControllerContext& context, bool& tera_self ); diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryQuests.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryQuests.cpp index 9252915183..6abc56f210 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryQuests.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryQuests.cpp @@ -660,8 +660,7 @@ void quest_tera_self_defeat( //Drop on top of Kleavor (plenty of Scyther in the area as well) if (console.state().console_type() == ConsoleType::Switch1) { jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 1000, 1650, 300); - } - else { //All switch 2s + } else { //All switch 2s jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 1000, 1600, 300); } @@ -880,8 +879,7 @@ void quest_wild_tera( pbf_move_left_joystick(context, 50, 0, 20, 105); pbf_press_button(context, BUTTON_L, 20, 50); pbf_move_left_joystick(context, 128, 0, 100, 50); - } - else { //Switch 2 + } else { //Switch 2 pbf_move_left_joystick(context, 20, 0, 20, 105); pbf_press_button(context, BUTTON_L, 20, 50); } From 0f609f511108ae1afbf1b0da5646ad7434c2ea82 Mon Sep 17 00:00:00 2001 From: kichithewolf Date: Wed, 11 Jun 2025 17:09:24 -0400 Subject: [PATCH 4/4] more fixes --- .../Farming/PokemonSV_BBQSoloFarmer.cpp | 10 +++--- .../Farming/PokemonSV_BlueberryCatchPhoto.cpp | 34 ++++++++++++++----- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BBQSoloFarmer.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BBQSoloFarmer.cpp index f9418abd81..295d882753 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BBQSoloFarmer.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BBQSoloFarmer.cpp @@ -78,8 +78,8 @@ void BBQSoloFarmer::program(SingleSwitchProgramEnvironment& env, ProControllerCo } //Fly to plaza - //open_map_from_overworld(env.program_info(), env.console, context); - //fly_to_overworld_from_map(env.program_info(), env.console, context); + open_map_from_overworld(env.program_info(), env.console, context); + fly_to_overworld_from_map(env.program_info(), env.console, context); std::vector quest_list; //all quests std::vector quests_to_do; //do-able quests @@ -87,13 +87,13 @@ void BBQSoloFarmer::program(SingleSwitchProgramEnvironment& env, ProControllerCo uint64_t num_completed_quests = 0; //Test a specific quest - - BBQuests test_quest = BBQuests::catch_any; + /* + BBQuests test_quest = BBQuests::catch_water; bool questTest = process_and_do_quest(env, env.console, context, BBQ_OPTIONS, test_quest, eggs_hatched); if (questTest){ env.log("Finished quest."); } - + */ while (num_completed_quests < BBQ_OPTIONS.NUM_QUESTS){ if (BBQ_OPTIONS.OUT_OF_EGGS == BBQOption::OOEggs::Stop && eggs_hatched >= BBQ_OPTIONS.NUM_EGGS){ diff --git a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryCatchPhoto.cpp b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryCatchPhoto.cpp index f4071f9fa9..8aea2e01b6 100644 --- a/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryCatchPhoto.cpp +++ b/SerialPrograms/Source/PokemonSV/Programs/Farming/PokemonSV_BlueberryCatchPhoto.cpp @@ -400,11 +400,8 @@ void quest_catch_navi( pbf_press_button(context, BUTTON_L, 20, 50); pbf_move_left_joystick(context, 128, 0, 100, 50); - //Turn slightly for switch 1 - if (console.state().console_type() == ConsoleType::Switch1) { - pbf_move_left_joystick(context, 0, 0, 20, 50); - pbf_press_button(context, BUTTON_L, 20, 50); - } + pbf_move_left_joystick(context, 0, 0, 20, 50); + pbf_press_button(context, BUTTON_L, 20, 50); break; @@ -522,13 +519,22 @@ void quest_catch_navi( pbf_move_left_joystick(context, 255, 0, 10, 20); pbf_press_button(context, BUTTON_L, 20, 50); - pbf_move_left_joystick(context, 128, 0, 200, 20); + if (console.state().console_type() == ConsoleType::Switch1) { + pbf_move_left_joystick(context, 128, 0, 200, 20); + } else { + pbf_move_left_joystick(context, 128, 0, 170, 20); + } + pbf_press_button(context, BUTTON_L, 20, 50); pbf_move_left_joystick(context, 0, 0, 10, 20); pbf_press_button(context, BUTTON_L, 20, 50); - pbf_move_left_joystick(context, 128, 0, 100, 20); + if (console.state().console_type() == ConsoleType::Switch1) { + pbf_move_left_joystick(context, 128, 0, 100, 20); + } else { + pbf_move_left_joystick(context, 128, 0, 120, 20); + } pbf_wait(context, 400); context.wait_for_all_requests(); @@ -558,7 +564,12 @@ void quest_catch_navi( pbf_move_left_joystick(context, 0, 128, 20, 50); pbf_press_button(context, BUTTON_L | BUTTON_PLUS, 20, 105); - jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 200, 590, 200); + + if (console.state().console_type() == ConsoleType::Switch1) { + jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 200, 575, 200); + } else { //Switch 2 + jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 200, 500, 200); + } pbf_press_button(context, BUTTON_PLUS, 20, 105); pbf_move_left_joystick(context, 0, 128, 20, 50); @@ -574,7 +585,12 @@ void quest_catch_navi( pbf_move_left_joystick(context, 0, 128, 20, 50); pbf_press_button(context, BUTTON_L | BUTTON_PLUS, 20, 105); - jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 1000, 1800, 300); + + if (console.state().console_type() == ConsoleType::Switch1) { + jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 1000, 1800, 300); + } else { + jump_glide_fly(console, context, BBQ_OPTIONS.INVERTED_FLIGHT, 1000, 1600, 300); + } pbf_press_button(context, BUTTON_PLUS, 20, 105);