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 @@ -10,9 +10,10 @@
#include "CommonTools/Async/InferenceRoutines.h"
#include "CommonTools/VisualDetectors/BlackScreenDetector.h"
#include "CommonFramework/Exceptions/UnexpectedBattleException.h"
#include "CommonFramework/Exceptions/OperationFailedException.h"
#endif


#include "CommonFramework/Exceptions/OperationFailedException.h"
#include "CommonFramework/StaticGlobals.h"
#include "CommonFramework/GlobalAutoPaths.h"
#include "CommonFramework/VideoPipeline/VideoFeed.h"
Expand Down Expand Up @@ -1342,8 +1343,27 @@ void AutoStory::program(SingleSwitchProgramEnvironment& env, ProControllerContex
}

if (ENSURE_MINIMAP_UNLOCKED && STORY_SECTION == StorySection::MAIN_STORY){
env.console.log("Ensure the minimap is unlocked.");
confirm_minimap_unlocked(env, context);
env.console.log("Ensure the N symbol on minimap is visible.");
context.wait_for_all_requests();

DirectionDetector direction;
double current = direction.get_current_direction(env.console, env.console.video().snapshot());
if (current < 0){
OperationFailedException::fire(
ErrorReport::SEND_ERROR_REPORT,
"change_direction(): Unable to detect current direction. Something (e.g. a marker) is covering the N symbol on the minimap. "
"Try moving the marker on the map.",
env.console
);
}

if (is_main_story_start_point_indoors()){
env.console.log("Can't confirm if minimap unlocked while indoors.");
}else{
env.console.log("Ensure the minimap is unlocked.");
confirm_minimap_unlocked(env, context);
}

}

run_autostory(env, context);
Expand All @@ -1352,7 +1372,36 @@ void AutoStory::program(SingleSwitchProgramEnvironment& env, ProControllerContex
GO_HOME_WHEN_DONE.run_end_of_program(context);
}

bool AutoStory::is_main_story_start_point_indoors(){

bool start_indoors = false;
if (ENABLE_ADVANCED_MODE){ // checkpoint mode
size_t checkpoint_index = get_start_checkpoint_index();

start_indoors =
checkpoint_index == 44 ||
checkpoint_index == 46 ||
checkpoint_index == 52 ||
checkpoint_index == 62 ||
checkpoint_index == 63 ||
checkpoint_index == 72 ||
checkpoint_index == 74 ||
checkpoint_index == 76 ||
checkpoint_index == 77 ||
checkpoint_index == 88 ||
checkpoint_index == 89 ||
checkpoint_index == 91 ||
checkpoint_index >= 94; // all of area zero is considered indoors
}else{ // segment mode
size_t segment_index = get_start_segment_index();

start_indoors = segment_index >= 35; // all of area zero is considered indoors
// all previous main story segments start outdoors
}

return start_indoors;

}



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class AutoStory : public SingleSwitchProgramInstance, public ConfigOption::Liste

void run_autostory(SingleSwitchProgramEnvironment& env, ProControllerContext& context);

bool is_main_story_start_point_indoors();

private:
virtual void on_config_value_changed(void* object) override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1454,7 +1454,8 @@ void checkpoint_reattempt_loop(
if (i > max_attempts){
OperationFailedException::fire(
ErrorReport::SEND_ERROR_REPORT,
"Autostory checkpoint failed " + std::to_string(max_attempts) + " times.\n"
"Autostory checkpoint failed " + std::to_string(max_attempts) + " times.\n" +
checkpoint_text + "\n"
"Make sure you selected the correct Start Point, and your character is in the exactly correct starting position."
"Also, make sure you have set the correct Language.\n" + e.message(),
env.console
Expand Down Expand Up @@ -1495,6 +1496,15 @@ void checkpoint_reattempt_loop_tutorial(

break;
}catch (OperationFailedException& e){
if (i == 10){ // send an error report for debugging if 10 failed attempts for a given checkpoint.
OperationFailedException exception(
ErrorReport::SEND_ERROR_REPORT,
"10 failed attempts. " + checkpoint_text,
env.console
);
exception.send_recoverable_notification(env);
}

if (i > max_attempts){
OperationFailedException::fire(
ErrorReport::SEND_ERROR_REPORT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class AutoStory_Checkpoint {
AutoStoryStats& stats) const = 0;

std::string checkpoint_text() const {
return "Checkpoint:: " + name() + ". Start point:" + start_text();
return "Checkpoint:: " + name() + ". Start point: " + start_text();
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void AutoStory_Segment_16::run_segment(

std::string AutoStory_Checkpoint_35::name() const{ return "035 - " + AutoStory_Segment_16().name(); }
std::string AutoStory_Checkpoint_35::start_text() const{ return "At Cascarrafa (West) Pokecenter.";}
std::string AutoStory_Checkpoint_35::end_text() const{ return "At Cascarrafa Gym. Received Kofu's wallet.";}
std::string AutoStory_Checkpoint_35::end_text() const{ return "Outside Cascarrafa Gym. Received Kofu's wallet.";}
void AutoStory_Checkpoint_35::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
checkpoint_35(env, context, options.notif_status_update, stats, checkpoint_text());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class AutoStory_Checkpoint_36 : public AutoStory_Checkpoint{


// start: At Cascarrafa (West) Pokecenter.
// end: At Cascarrafa Gym. Received Kofu's wallet.
// end: Outside Cascarrafa Gym. Received Kofu's wallet.
void checkpoint_35(
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
Expand All @@ -54,7 +54,7 @@ void checkpoint_35(
const std::string& checkpoint_text
);

// start: At Cascarrafa Gym. Received Kofu's wallet.
// start: Outside Cascarrafa Gym. Received Kofu's wallet.
// end: At Porto Marinada Pokecenter.
void checkpoint_36(
SingleSwitchProgramEnvironment& env,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void AutoStory_Segment_20::run_segment(

std::string AutoStory_Checkpoint_43::name() const{ return "043 - " + AutoStory_Segment_20().name(); }
std::string AutoStory_Checkpoint_43::start_text() const{ return "Defeated Klawf. At Artazon (West) Pokecenter.";}
std::string AutoStory_Checkpoint_43::end_text() const{ return "At Artazon Gym building. Battled Nemona. Received Sunflora gym challenge.";}
std::string AutoStory_Checkpoint_43::end_text() const{ return "Battled Nemona. Inside Artazon Gym building.";}
void AutoStory_Checkpoint_43::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
checkpoint_43(env, context, options.notif_status_update, stats, checkpoint_text());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class AutoStory_Checkpoint_46 : public AutoStory_Checkpoint{


// start: Defeated Klawf. At Artazon (West) Pokecenter.
// end: At Artazon Gym building. Battled Nemona. Received Sunflora gym challenge.
// end: Battled Nemona. Inside Artazon Gym building.
void checkpoint_43(
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
Expand All @@ -69,7 +69,7 @@ void checkpoint_43(
const std::string& checkpoint_text
);

// start: At Artazon Gym building. Battled Nemona. Received Sunflora gym challenge.
// start: Battled Nemona. Inside Artazon Gym building.
// end: Finished Sunflora gym challenge.
void checkpoint_44(
SingleSwitchProgramEnvironment& env,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ void AutoStory_Checkpoint_50::run_checkpoint(SingleSwitchProgramEnvironment& env

std::string AutoStory_Checkpoint_51::name() const{ return "051 - " + AutoStory_Segment_22().name(); }
std::string AutoStory_Checkpoint_51::start_text() const{ return AutoStory_Checkpoint_50().end_text();}
std::string AutoStory_Checkpoint_51::end_text() const{ return "At Levincia gym building. Talked to Hassel, met Rika.";}
std::string AutoStory_Checkpoint_51::end_text() const{ return "Inside Levincia gym building. Talked to Hassel, met Rika.";}
void AutoStory_Checkpoint_51::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
checkpoint_51(env, context, options.notif_status_update, stats, checkpoint_text());
}


std::string AutoStory_Checkpoint_52::name() const{ return "052 - " + AutoStory_Segment_22().name(); }
std::string AutoStory_Checkpoint_52::start_text() const{ return AutoStory_Checkpoint_51().end_text();}
std::string AutoStory_Checkpoint_52::end_text() const{ return "Finished Levincia gym challenge.";}
std::string AutoStory_Checkpoint_52::end_text() const{ return "Finished Levincia gym challenge. Outside Levincia gym building.";}
void AutoStory_Checkpoint_52::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
checkpoint_52(env, context, options.notif_status_update, stats, checkpoint_text());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void checkpoint_50(
);

// start: At Levincia (South) Pokecenter.
// end: At Levincia gym building. Talked to Hassel, met Rika.
// end: Inside Levincia gym building. Talked to Hassel, met Rika.
void checkpoint_51(
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
Expand All @@ -82,8 +82,8 @@ void checkpoint_51(
);


// start: At Levincia gym building. Talked to Hassel, met Rika.
// end: Finished Levincia gym challenge.
// start: Inside Levincia gym building. Talked to Hassel, met Rika.
// end: Finished Levincia gym challenge. Outside Levincia gym building.
void checkpoint_52(
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
Expand All @@ -93,7 +93,7 @@ void checkpoint_52(
);


// start: Finished Levincia gym challenge. Standing outside Levincia gym.
// start: Finished Levincia gym challenge. Outside Levincia gym building.
// end: Defeated Levincia Gym (Electric). At Levincia (North) Pokecenter.
void checkpoint_53(
SingleSwitchProgramEnvironment& env,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,22 @@ void AutoStory_Segment_26::run_segment(

std::string AutoStory_Checkpoint_61::name() const{ return "061 - " + AutoStory_Segment_26().name(); }
std::string AutoStory_Checkpoint_61::start_text() const{ return "At Medali Pokecenter.";}
std::string AutoStory_Checkpoint_61::end_text() const{ return "At Medali Gym";}
std::string AutoStory_Checkpoint_61::end_text() const{ return "Inside Medali Gym building.";}
void AutoStory_Checkpoint_61::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
checkpoint_61(env, context, options.notif_status_update, stats, checkpoint_text());
}


std::string AutoStory_Checkpoint_62::name() const{ return "062 - " + AutoStory_Segment_26().name(); }
std::string AutoStory_Checkpoint_62::start_text() const{ return AutoStory_Checkpoint_61().end_text();}
std::string AutoStory_Checkpoint_62::end_text() const{ return "Beat Medali Gym";}
std::string AutoStory_Checkpoint_62::end_text() const{ return "Beat Medali Gym. Inside Medali Gym building.";}
void AutoStory_Checkpoint_62::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
checkpoint_62(env, context, options.notif_status_update, stats, checkpoint_text());
}

std::string AutoStory_Checkpoint_63::name() const{ return "063 - " + AutoStory_Segment_26().name(); }
std::string AutoStory_Checkpoint_63::start_text() const{ return AutoStory_Checkpoint_62().end_text();}
std::string AutoStory_Checkpoint_63::end_text() const{ return "At Glaseado Mountain Pokecenter";}
std::string AutoStory_Checkpoint_63::end_text() const{ return "At Glaseado Mountain Pokecenter.";}
void AutoStory_Checkpoint_63::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
checkpoint_63(env, context, options.notif_status_update, stats, checkpoint_text());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class AutoStory_Checkpoint_63 : public AutoStory_Checkpoint{


// start: At Medali Pokecenter.
// end: At Medali Gym
// end: Inside Medali Gym building
void checkpoint_61(
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
Expand All @@ -63,8 +63,8 @@ void checkpoint_61(
const std::string& checkpoint_text
);

// start: At Medali Gym
// end: Beat Medali Gym
// start: Inside Medali Gym building
// end: Beat Medali Gym. Inside Medali Gym building.
void checkpoint_62(
SingleSwitchProgramEnvironment& env,
ProControllerContext& context,
Expand All @@ -74,7 +74,7 @@ void checkpoint_62(
);


// start: Beat Medali Gym
// start: Beat Medali Gym. Inside Medali Gym building.
// end: At Glaseado Mountain Pokecenter
void checkpoint_63(
SingleSwitchProgramEnvironment& env,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,23 +68,23 @@ void AutoStory_Segment_29::run_segment(

std::string AutoStory_Checkpoint_71::name() const{ return "071 - " + AutoStory_Segment_29().name(); }
std::string AutoStory_Checkpoint_71::start_text() const{ return "At Montenevera Pokecenter";}
std::string AutoStory_Checkpoint_71::end_text() const{ return "Spoke to Montenevera gym receptionist";}
std::string AutoStory_Checkpoint_71::end_text() const{ return "Spoke to Montenevera gym receptionist. Inside Montenevera gym building.";}
void AutoStory_Checkpoint_71::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
checkpoint_71(env, context, options.notif_status_update, stats, checkpoint_text());
}


std::string AutoStory_Checkpoint_72::name() const{ return "072 - " + AutoStory_Segment_29().name(); }
std::string AutoStory_Checkpoint_72::start_text() const{ return AutoStory_Checkpoint_71().end_text();}
std::string AutoStory_Checkpoint_72::end_text() const{ return "Passed gym test with MC Sledge.";}
std::string AutoStory_Checkpoint_72::end_text() const{ return "Passed gym test with MC Sledge. Standing in front of MC Sledge, outside the Montenevera gym building.";}
void AutoStory_Checkpoint_72::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
checkpoint_72(env, context, options.notif_status_update, stats, checkpoint_text());
}


std::string AutoStory_Checkpoint_73::name() const{ return "073 - " + AutoStory_Segment_29().name(); }
std::string AutoStory_Checkpoint_73::start_text() const{ return AutoStory_Checkpoint_72().end_text();}
std::string AutoStory_Checkpoint_73::end_text() const{ return "Beat Montenevera Gym. Inside gym building.";}
std::string AutoStory_Checkpoint_73::end_text() const{ return "Beat Montenevera Gym. Inside Montenevera gym building.";}
void AutoStory_Checkpoint_73::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
checkpoint_73(env, context, options.notif_status_update, stats, checkpoint_text());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,18 @@ class AutoStory_Checkpoint_74 : public AutoStory_Checkpoint{


// start: At Montenevera Pokecenter
// end: Spoke to Montenevera gym receptionist
// end: Spoke to Montenevera gym receptionist. Inside Montenevera gym building.
void checkpoint_71(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats, const std::string& checkpoint_text);

// start: Spoke to Montenevera gym receptionist
// end: Passed gym test with MC Sledge.
// start: Spoke to Montenevera gym receptionist. Inside Montenevera gym building.
// end: Passed gym test with MC Sledge. Standing in front of MC Sledge, outside the Montenevera gym building.
void checkpoint_72(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats, const std::string& checkpoint_text);

// start: Passed gym test with MC Sledge.
// end: Beat Montenevera Gym. Inside gym building.
// start: Passed gym test with MC Sledge. Standing in front of MC Sledge, outside the Montenevera gym building.
// end: Beat Montenevera Gym. Inside Montenevera gym building.
void checkpoint_73(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats, const std::string& checkpoint_text);

// start: Beat Montenevera Gym. Inside gym building.
// start: Beat Montenevera Gym. Inside Montenevera gym building.
// end: At Glaseado gym Pokecenter.
void checkpoint_74(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats, const std::string& checkpoint_text);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ void AutoStory_Segment_30::run_segment(

std::string AutoStory_Checkpoint_75::name() const{ return "075 - " + AutoStory_Segment_30().name(); }
std::string AutoStory_Checkpoint_75::start_text() const{ return "At Glaseado gym Pokecenter.";}
std::string AutoStory_Checkpoint_75::end_text() const{ return "Battled Nemona. Spoke to Glaseado Gym receptionist";}
std::string AutoStory_Checkpoint_75::end_text() const{ return "Battled Nemona. Spoke to Glaseado Gym receptionist. Inside Glaseado Gym building.";}
void AutoStory_Checkpoint_75::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
checkpoint_75(env, context, options.notif_status_update, stats, checkpoint_text());
}


std::string AutoStory_Checkpoint_76::name() const{ return "076 - " + AutoStory_Segment_30().name(); }
std::string AutoStory_Checkpoint_76::start_text() const{ return AutoStory_Checkpoint_75().end_text();}
std::string AutoStory_Checkpoint_76::end_text() const{ return "Beat Glaseado Gym Challenge. Beat Glaseado Gym (Ice).";}
std::string AutoStory_Checkpoint_76::end_text() const{ return "Beat Glaseado Gym Challenge. Beat Glaseado Gym (Ice). Inside Glaseado Gym building.";}
void AutoStory_Checkpoint_76::run_checkpoint(SingleSwitchProgramEnvironment& env, ProControllerContext& context, AutoStoryOptions options, AutoStoryStats& stats) const{
checkpoint_76(env, context, options.notif_status_update, stats, checkpoint_text());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ class AutoStory_Checkpoint_77 : public AutoStory_Checkpoint{


// start: At Glaseado Gym Pokecenter
// end: Battled Nemona. Spoke to Glaseado Gym receptionist
// end: Battled Nemona. Spoke to Glaseado Gym receptionist. Inside Glaseado Gym building.
void checkpoint_75(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats, const std::string& checkpoint_text);

// start: Spoke to Glaseado Gym receptionist.
// end: Beat Glaseado Gym Challenge. Beat Glaseado Gym (Ice).
// start: Spoke to Glaseado Gym receptionist. Inside Glaseado Gym building.
// end: Beat Glaseado Gym Challenge. Beat Glaseado Gym (Ice). Inside Glaseado Gym building.
void checkpoint_76(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats, const std::string& checkpoint_text);

// start: Beat Glaseado Gym Challenge. Beat Glaseado Gym (Ice).
// start: Beat Glaseado Gym Challenge. Beat Glaseado Gym (Ice). Inside Glaseado Gym building.
// end: At North Province Area One Pokecenter
void checkpoint_77(SingleSwitchProgramEnvironment& env, ProControllerContext& context, EventNotificationOption& notif_status_update, AutoStoryStats& stats, const std::string& checkpoint_text);

Expand Down
Loading
Loading