Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,12 @@
#include "VideoGames/PokemonSwSh/Options/PokemonSwSh_BallSelectOption.h"
#include "VideoGames/PokemonSV/Options/PokemonSV_TeraAIOption.h"
#include "VideoGames/PokemonSV/Options/PokemonSV_TeraCatchOnWinOption.h"
#include "VideoGames/PokemonSV/Options/PokemonSV_BBQuests.h"

namespace PokemonAutomation{
namespace NintendoSwitch{
namespace PokemonSV{

enum class BBQuests{
auto_10, make_tm, pickup_10, sneak_up, photo_fly, photo_swim, photo_canyon, photo_coastal, photo_polar, photo_savanna, tera_self_defeat,
travel_500, catch_any, catch_normal, catch_fighting, catch_flying, catch_poison, catch_ground, catch_rock, catch_bug, catch_ghost, catch_steel,
catch_fire, catch_water, catch_grass, catch_electric, catch_psychic, catch_ice, catch_dragon, catch_dark, catch_fairy,
wash_pokemon, wild_tera, auto_30, tera_raid, sandwich_three, bitter_sandwich, sweet_sandwich, salty_sandwich, sour_sandwich, spicy_sandwich, hatch_egg,
photo_normal, photo_fighting, photo_flying, photo_poison, photo_ground, photo_rock, photo_bug, photo_ghost, photo_steel, photo_fire, photo_water,
photo_grass, photo_electric, photo_psychic, photo_ice, photo_dragon, photo_dark, photo_fairy,
ditto_central, ditto_canyon, ditto_coastal, ditto_polar, ditto_savanna, group_canyon, group_coastal, group_polar, group_savanna, group_eyewear, group_nonuniform,
group_masks, sandwich_four, catch_hint, catch_hint2,
UnableToDetect
};

enum class BBQAction{
run,
skip,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
/* Blueberry Quests
*
* From: https://github.com/PokemonAutomation/
*
*/

#include <map>
#include "PokemonSV_BBQuests.h"

namespace PokemonAutomation{
namespace NintendoSwitch{
namespace PokemonSV{

namespace{

const std::map<std::string, BBQuests>& BBQuests_TOKEN_TO_ENUM(){
static std::map<std::string, BBQuests> data{
{"auto-10", BBQuests::auto_10},
{"make-tm", BBQuests::make_tm },
{"pickup-10", BBQuests::pickup_10},
{"sneak-up", BBQuests::sneak_up},
{"photo-fly", BBQuests::photo_fly},
{"photo-swim", BBQuests::photo_swim},
{"photo-canyon", BBQuests::photo_canyon},
{"photo-coastal", BBQuests::photo_coastal},
{"photo-polar", BBQuests::photo_polar},
{"photo-savanna", BBQuests::photo_savanna},
{"tera-self-defeat", BBQuests::tera_self_defeat},
{"travel-500", BBQuests::travel_500},
{"catch-any", BBQuests::catch_any},
{"catch-normal", BBQuests::catch_normal},
{"catch-fighting", BBQuests::catch_fighting},
{"catch-flying", BBQuests::catch_flying},
{"catch-poison", BBQuests::catch_poison},
{"catch-ground", BBQuests::catch_ground},
{"catch-rock", BBQuests::catch_rock},
{"catch-bug", BBQuests::catch_bug},
{"catch-ghost", BBQuests::catch_ghost},
{"catch-steel", BBQuests::catch_steel},
{"catch-fire", BBQuests::catch_fire},
{"catch-water", BBQuests::catch_water},
{"catch-grass", BBQuests::catch_grass},
{"catch-electric", BBQuests::catch_electric},
{"catch-psychic", BBQuests::catch_psychic},
{"catch-ice", BBQuests::catch_ice},
{"catch-dragon", BBQuests::catch_dragon},
{"catch-dark", BBQuests::catch_dark},
{"catch-fairy", BBQuests::catch_fairy},
{"wash-pokemon", BBQuests::wash_pokemon},
{"wild-tera", BBQuests::wild_tera},
{"auto-30", BBQuests::auto_30},
{"tera-raid", BBQuests::tera_raid},
{"sandwich-three", BBQuests::sandwich_three},
{"bitter-sandwich", BBQuests::bitter_sandwich},
{"sweet-sandwich", BBQuests::sweet_sandwich},
{"salty-sandwich", BBQuests::salty_sandwich},
{"sour-sandwich", BBQuests::sour_sandwich},
{"spicy-sandwich", BBQuests::spicy_sandwich},
{"hatch-egg", BBQuests::hatch_egg},
{"photo-normal", BBQuests::photo_normal},
{"photo-fighting", BBQuests::photo_fighting},
{"photo-flying", BBQuests::photo_flying},
{"photo-poison", BBQuests::photo_poison},
{"photo-ground", BBQuests::photo_ground},
{"photo-rock", BBQuests::photo_rock},
{"photo-bug", BBQuests::photo_bug},
{"photo-ghost", BBQuests::photo_ghost},
{"photo-steel", BBQuests::photo_steel},
{"photo-fire", BBQuests::photo_fire},
{"photo-water", BBQuests::photo_water},
{"photo-grass", BBQuests::photo_grass},
{"photo-electric", BBQuests::photo_electric},
{"photo-psychic", BBQuests::photo_psychic},
{"photo-ice", BBQuests::photo_ice},
{"photo-dragon", BBQuests::photo_dragon},
{"photo-dark", BBQuests::photo_dark},
{"photo-fairy", BBQuests::photo_fairy},
{"ditto-central", BBQuests::ditto_central},
{"ditto-canyon", BBQuests::ditto_canyon},
{"ditto-coastal", BBQuests::ditto_coastal},
{"ditto-polar", BBQuests::ditto_polar},
{"ditto-savanna", BBQuests::ditto_savanna},
{"group-canyon", BBQuests::group_canyon},
{"group-coastal", BBQuests::group_coastal},
{"group-polar", BBQuests::group_polar},
{"group-savanna", BBQuests::group_savanna},
{"group-eyewear", BBQuests::group_eyewear},
{"group-nonuniform", BBQuests::group_nonuniform},
{"group-masks", BBQuests::group_masks},
{"sandwich-four", BBQuests::sandwich_four},
{"catch-hint", BBQuests::catch_hint},
{"catch-hint2", BBQuests::catch_hint2},
{"", BBQuests::UnableToDetect},
};
return data;
}

const std::map<BBQuests, std::string>& BBQuests_ENUM_TO_TOKEN(){
static std::map<BBQuests, std::string> data = []{
std::map<BBQuests, std::string> ret;
for (const auto& [token, quest] : BBQuests_TOKEN_TO_ENUM()){
ret.emplace(quest, token);
}
return ret;
}();
return data;
}

}

BBQuests BBQuests_string_to_enum(const std::string& token){
auto iter = BBQuests_TOKEN_TO_ENUM().find(token);
if (iter == BBQuests_TOKEN_TO_ENUM().end()){
return BBQuests::UnableToDetect;
}
return iter->second;
}

const std::string& BBQuests_enum_to_string(BBQuests quest){
static const std::string EMPTY;
auto iter = BBQuests_ENUM_TO_TOKEN().find(quest);
if (iter == BBQuests_ENUM_TO_TOKEN().end()){
return EMPTY;
}
return iter->second;
}


}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/* Blueberry Quests
*
* From: https://github.com/PokemonAutomation/
*
*/

#ifndef PokemonAutomation_PokemonSV_BBQuests_H
#define PokemonAutomation_PokemonSV_BBQuests_H

#include <string>

namespace PokemonAutomation{
namespace NintendoSwitch{
namespace PokemonSV{

enum class BBQuests{
auto_10, make_tm, pickup_10, sneak_up, photo_fly, photo_swim, photo_canyon, photo_coastal, photo_polar, photo_savanna, tera_self_defeat,
travel_500, catch_any, catch_normal, catch_fighting, catch_flying, catch_poison, catch_ground, catch_rock, catch_bug, catch_ghost, catch_steel,
catch_fire, catch_water, catch_grass, catch_electric, catch_psychic, catch_ice, catch_dragon, catch_dark, catch_fairy,
wash_pokemon, wild_tera, auto_30, tera_raid, sandwich_three, bitter_sandwich, sweet_sandwich, salty_sandwich, sour_sandwich, spicy_sandwich, hatch_egg,
photo_normal, photo_fighting, photo_flying, photo_poison, photo_ground, photo_rock, photo_bug, photo_ghost, photo_steel, photo_fire, photo_water,
photo_grass, photo_electric, photo_psychic, photo_ice, photo_dragon, photo_dark, photo_fairy,
ditto_central, ditto_canyon, ditto_coastal, ditto_polar, ditto_savanna, group_canyon, group_coastal, group_polar, group_savanna, group_eyewear, group_nonuniform,
group_masks, sandwich_four, catch_hint, catch_hint2,
UnableToDetect
};

// Map a quest slug (as returned by BlueberryQuestDetector) to its enum.
// Unrecognized slugs return UnableToDetect.
BBQuests BBQuests_string_to_enum(const std::string& token);

// Map a quest to its slug. UnableToDetect maps to the empty string.
const std::string& BBQuests_enum_to_string(BBQuests quest);


}
}
}
#endif
31 changes: 31 additions & 0 deletions SerialPrograms/Source/VideoGames/PokemonSV/PokemonSV_Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "Inference/Overworld/PokemonSV_LetsGoKillDetector.h"
#include "Inference/Picnics/PokemonSV_SandwichRecipeDetector.h"
#include "Inference/Picnics/PokemonSV_SandwichHandDetector.h"
#include "Options/PokemonSV_BBQuests.h"
#include "Programs/Farming/PokemonSV_BlueberryQuests.h"
#include "PokemonSV_Tests.h"

Expand Down Expand Up @@ -84,9 +85,39 @@ void add_tests_TeraEncounterAction(UnitTestDatabase& database){
}
}

namespace{

class Test_BBQuestsSlugs : public UnitTest{
public:
Test_BBQuestsSlugs()
: UnitTest("PokemonSV::BBQuests - slug round trip")
{}

virtual UnitTestResult run(Logger&, CancellableScope&) const override{
for (int c = 0; c < (int)BBQuests::UnableToDetect; c++){
const BBQuests quest = (BBQuests)c;
const std::string& slug = BBQuests_enum_to_string(quest);
if (slug.empty()){
return "Quest " + std::to_string(c) + " has no slug.";
}
if (BBQuests_string_to_enum(slug) != quest){
return "Slug " + slug + " does not map back to quest " + std::to_string(c) + ".";
}
}
if (!BBQuests_enum_to_string(BBQuests::UnableToDetect).empty()){
return "UnableToDetect must map to the empty slug.";
}
if (BBQuests_string_to_enum("not-a-quest") != BBQuests::UnableToDetect){
return "An unrecognized slug must map to UnableToDetect.";
}
return true;
}
};

}

void add_tests(UnitTestDatabase& database){
database.add<Test_BBQuestsSlugs>();
add_tests_WhiteButtonDetector(database);
add_tests_BoxInfoDetector(database);
add_tests_BoxEggDetector(database);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "VideoGames/PokemonSV/Programs/PokemonSV_WorldNavigation.h"
#include "VideoGames/PokemonSV/Programs/Battles/PokemonSV_BasicCatcher.h"
#include "VideoGames/PokemonSV/Programs/PokemonSV_Terarium.h"
#include "PokemonSV_BlueberryQuests.h"
#include "PokemonSV_BlueberryCatchPhoto.h"

namespace PokemonAutomation{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "NintendoSwitch/Controllers/Procon/NintendoSwitch_ProController.h"
#include "NintendoSwitch/NintendoSwitch_Settings.h"
#include "VideoGames/PokemonSV/Programs/Farming/PokemonSV_BlueberryQuests.h"
#include "NintendoSwitch/NintendoSwitch_ConsoleHandle.h"
#include "VideoGames/PokemonSV/Options/PokemonSV_BBQOption.h"

using namespace std;
Expand All @@ -19,6 +19,12 @@ namespace PokemonAutomation{
namespace NintendoSwitch{
namespace PokemonSV{

enum class CameraAngle{
none,
up,
down
};

//Navigate to a photo target
CameraAngle quest_photo_navi(
const ProgramInfo& info,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,96 +48,6 @@ namespace PokemonAutomation{
namespace NintendoSwitch{
namespace PokemonSV{

const std::map<std::string, BBQuests>& BBQuests_TOKEN_TO_ENUM(){
static std::map<std::string, BBQuests> data{
{"auto-10", BBQuests::auto_10},
{"make-tm", BBQuests::make_tm },
{"pickup-10", BBQuests::pickup_10},
{"sneak-up", BBQuests::sneak_up},
{"photo-fly", BBQuests::photo_fly},
{"photo-swim", BBQuests::photo_swim},
{"photo-canyon", BBQuests::photo_canyon},
{"photo-coastal", BBQuests::photo_coastal},
{"photo-polar", BBQuests::photo_polar},
{"photo-savanna", BBQuests::photo_savanna},
{"tera-self-defeat", BBQuests::tera_self_defeat},
{"travel-500", BBQuests::travel_500},
{"catch-any", BBQuests::catch_any},
{"catch-normal", BBQuests::catch_normal},
{"catch-fighting", BBQuests::catch_fighting},
{"catch-flying", BBQuests::catch_flying},
{"catch-poison", BBQuests::catch_poison},
{"catch-ground", BBQuests::catch_ground},
{"catch-rock", BBQuests::catch_rock},
{"catch-bug", BBQuests::catch_bug},
{"catch-ghost", BBQuests::catch_ghost},
{"catch-steel", BBQuests::catch_steel},
{"catch-fire", BBQuests::catch_fire},
{"catch-water", BBQuests::catch_water},
{"catch-grass", BBQuests::catch_grass},
{"catch-electric", BBQuests::catch_electric},
{"catch-psychic", BBQuests::catch_psychic},
{"catch-ice", BBQuests::catch_ice},
{"catch-dragon", BBQuests::catch_dragon},
{"catch-dark", BBQuests::catch_dark},
{"catch-fairy", BBQuests::catch_fairy},
{"wash-pokemon", BBQuests::wash_pokemon},
{"wild-tera", BBQuests::wild_tera},
{"auto-30", BBQuests::auto_30},
{"tera-raid", BBQuests::tera_raid},
{"sandwich-three", BBQuests::sandwich_three},
{"bitter-sandwich", BBQuests::bitter_sandwich},
{"sweet-sandwich", BBQuests::sweet_sandwich},
{"salty-sandwich", BBQuests::salty_sandwich},
{"sour-sandwich", BBQuests::sour_sandwich},
{"spicy-sandwich", BBQuests::spicy_sandwich},
{"hatch-egg", BBQuests::hatch_egg},
{"photo-normal", BBQuests::photo_normal},
{"photo-fighting", BBQuests::photo_fighting},
{"photo-flying", BBQuests::photo_flying},
{"photo-poison", BBQuests::photo_poison},
{"photo-ground", BBQuests::photo_ground},
{"photo-rock", BBQuests::photo_rock},
{"photo-bug", BBQuests::photo_bug},
{"photo-ghost", BBQuests::photo_ghost},
{"photo-steel", BBQuests::photo_steel},
{"photo-fire", BBQuests::photo_fire},
{"photo-water", BBQuests::photo_water},
{"photo-grass", BBQuests::photo_grass},
{"photo-electric", BBQuests::photo_electric},
{"photo-psychic", BBQuests::photo_psychic},
{"photo-ice", BBQuests::photo_ice},
{"photo-dragon", BBQuests::photo_dragon},
{"photo-dark", BBQuests::photo_dark},
{"photo-fairy", BBQuests::photo_fairy},
{"ditto-central", BBQuests::ditto_central},
{"ditto-canyon", BBQuests::ditto_canyon},
{"ditto-coastal", BBQuests::ditto_coastal},
{"ditto-polar", BBQuests::ditto_polar},
{"ditto-savanna", BBQuests::ditto_savanna},
{"group-canyon", BBQuests::group_canyon},
{"group-coastal", BBQuests::group_coastal},
{"group-polar", BBQuests::group_polar},
{"group-savanna", BBQuests::group_savanna},
{"group-eyewear", BBQuests::group_eyewear},
{"group-nonuniform", BBQuests::group_nonuniform},
{"group-masks", BBQuests::group_masks},
{"sandwich-four", BBQuests::sandwich_four},
{"catch-hint", BBQuests::catch_hint},
{"catch-hint2", BBQuests::catch_hint2},
{"", BBQuests::UnableToDetect},
};
return data;
}

BBQuests BBQuests_string_to_enum(const std::string& token){
auto iter = BBQuests_TOKEN_TO_ENUM().find(token);
if (iter == BBQuests_TOKEN_TO_ENUM().end()){
return BBQuests::UnableToDetect;
}
return iter->second;
}

int read_BP(const ProgramInfo& info, VideoStream& stream, ProControllerContext& context){
WhiteButtonWatcher right_panel(COLOR_BLUE, WhiteButton::ButtonB, {0.484, 0.117, 0.022, 0.037});
int result = run_until<ProControllerContext>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ namespace PokemonAutomation{
namespace NintendoSwitch{
namespace PokemonSV{

BBQuests BBQuests_string_to_enum(const std::string& token);

enum class CameraAngle{
none,
up,
down
};

//Basic blue quests
const std::set<BBQuests> blue_quests = {
BBQuests::auto_10, BBQuests::make_tm, BBQuests::pickup_10, BBQuests::sneak_up, BBQuests::photo_fly, BBQuests::photo_swim, BBQuests::photo_canyon, BBQuests::photo_coastal, BBQuests::photo_polar, BBQuests::photo_savanna, BBQuests::tera_self_defeat,
Expand Down
2 changes: 2 additions & 0 deletions SerialPrograms/cmake/SourceFiles.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2430,6 +2430,8 @@ file(GLOB LIBRARY_SOURCES
Source/VideoGames/PokemonSV/Options/PokemonSV_BattleMoveTable.h
Source/VideoGames/PokemonSV/Options/PokemonSV_BBQOption.cpp
Source/VideoGames/PokemonSV/Options/PokemonSV_BBQOption.h
Source/VideoGames/PokemonSV/Options/PokemonSV_BBQuests.cpp
Source/VideoGames/PokemonSV/Options/PokemonSV_BBQuests.h
Source/VideoGames/PokemonSV/Options/PokemonSV_EggPowerSandwichOption.cpp
Source/VideoGames/PokemonSV/Options/PokemonSV_EggPowerSandwichOption.h
Source/VideoGames/PokemonSV/Options/PokemonSV_EncounterActionsTable.cpp
Expand Down
Loading