-
Notifications
You must be signed in to change notification settings - Fork 104
Pokopia Palette Town Reset #1185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
GnidGnaw
wants to merge
1
commit into
PokemonAutomation:main
Choose a base branch
from
GnidGnaw:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
136 changes: 136 additions & 0 deletions
136
SerialPrograms/Source/PokemonPokopia/Programs/PokemonPokopia_PaletteReset.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,136 @@ | ||
| /* Palette Reset | ||
| * | ||
| * From: https://github.com/PokemonAutomation/ | ||
| * | ||
| */ | ||
|
|
||
| //#include "CommonFramework/Logging/Logger.h" | ||
| #include "Common/Cpp/PrettyPrint.h" | ||
| #include "CommonFramework/Notifications/ProgramNotifications.h" | ||
| #include "CommonTools/StartupChecks/VideoResolutionCheck.h" | ||
| #include "NintendoSwitch/NintendoSwitch_Settings.h" | ||
| #include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h" | ||
| #include "NintendoSwitch/Programs/NintendoSwitch_GameEntry.h" | ||
| #include "NintendoSwitch/Programs/DateSpam/NintendoSwitch_HomeToDateTime.h" | ||
| #include "Pokemon/Pokemon_Strings.h" | ||
| #include "PokemonPokopia/Inference/PokemonPokopia_ButtonDetector.h" | ||
| #include "PokemonPokopia/Inference/PokemonPokopia_MovesDetection.h" | ||
| #include "PokemonPokopia/Inference/PokemonPokopia_PCDetection.h" | ||
| #include "PokemonPokopia/Inference/PokemonPokopia_SettingsScreenDetector.h" | ||
| #include "CommonFramework/Notifications/ProgramNotifications.h" | ||
| #include "PokemonPokopia/PokemonPokopia_Settings.h" | ||
|
|
||
| #include "PokemonPokopia/Programs/PokemonPokopia_PCNavigation.h" | ||
| #include "PokemonPokopia/Programs/PokemonPokopia_PaletteReset.h" | ||
|
|
||
| namespace PokemonAutomation{ | ||
| namespace NintendoSwitch{ | ||
| namespace PokemonPokopia{ | ||
|
|
||
| using namespace Pokemon; | ||
|
|
||
|
|
||
| PaletteReset_Descriptor::PaletteReset_Descriptor() | ||
| : SingleSwitchProgramDescriptor( | ||
| "PokemonPokopia:PaletteReset", | ||
| STRING_POKEMON + " Pokopia", "Palette Reset", | ||
| "Programs/PokemonPokopia/PaletteReset.html", | ||
| "Reset Palette Town for Mew stamps and recipes.", | ||
| ProgramControllerClass::StandardController_NoRestrictions, | ||
| FeedbackType::REQUIRED, | ||
| AllowCommandsWhenRunning::DISABLE_COMMANDS | ||
| ) | ||
| {} | ||
|
|
||
|
|
||
| PaletteReset::PaletteReset() | ||
| : SKIPS( | ||
| "<b>Number of Attempts:</b>", | ||
| LockMode::UNLOCK_WHILE_RUNNING, | ||
| 1500 | ||
| ) | ||
| , GO_HOME_WHEN_DONE(false) | ||
| , NOTIFICATIONS({ | ||
| &NOTIFICATION_PROGRAM_FINISH, | ||
| &NOTIFICATION_ERROR_FATAL, | ||
| }) | ||
| { | ||
| PA_ADD_OPTION(SKIPS); | ||
| PA_ADD_OPTION(GO_HOME_WHEN_DONE); | ||
| PA_ADD_OPTION(NOTIFICATIONS); | ||
| } | ||
|
|
||
|
|
||
|
|
||
| void PaletteReset::program(SingleSwitchProgramEnvironment& env, ProControllerContext& context){ | ||
| assert_16_9_720p_min(env.logger(), env.console); | ||
|
|
||
| //start in game facing a PC, with the A button visible, | ||
| for (uint32_t c = 0; c < SKIPS; c++){ | ||
| env.log("Resets: " + tostr_u_commas(c)); | ||
|
|
||
| wait_for_overworld(env.console, context); | ||
|
|
||
|
|
||
| access_pc_from_overworld(env.console, context, true); | ||
| env.console.log("Opened Cloud Island PC menu"); | ||
| pbf_wait(context, 2000ms); | ||
|
|
||
| Stamp todays_stamp = get_stamp(env.console, context, TODAYS_STAMP_BOX); | ||
| if (todays_stamp == Stamp::MEW){ | ||
| env.log("Mew Stamp found."); | ||
| GO_HOME_WHEN_DONE.run_end_of_program(context); | ||
| send_program_finished_notification(env, NOTIFICATION_PROGRAM_FINISH); | ||
| break; | ||
| } | ||
|
|
||
| exit_pc(env.console, context); | ||
|
|
||
| // Date skip | ||
| pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); | ||
| home_to_date_time(env.console, context, true); | ||
|
|
||
| pbf_press_button(context, BUTTON_A, 160ms, 840ms); | ||
| pbf_press_button(context, BUTTON_A, 48ms, 24ms);//month | ||
| pbf_move_left_joystick(context, {0,-1}, 48ms, 24ms); | ||
| pbf_press_button(context, BUTTON_A, 48ms, 24ms);//day | ||
| pbf_press_button(context, BUTTON_A, 48ms, 24ms);//year | ||
| pbf_press_button(context, BUTTON_A, 48ms, 24ms);//hour | ||
| pbf_press_button(context, BUTTON_A, 48ms, 24ms);//minute | ||
| pbf_press_button(context, BUTTON_A, 48ms, 24ms);//am-pm | ||
| pbf_press_button(context, BUTTON_A, 160ms, 840ms); | ||
|
|
||
| pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0); | ||
| //resume game | ||
| resume_game_from_home(env.console, context); | ||
|
|
||
| // Date skip | ||
| pbf_press_button(context, BUTTON_HOME, 160ms, GameSettings::instance().GAME_TO_HOME_DELAY0); | ||
| home_to_date_time(env.console, context, true); | ||
|
|
||
| pbf_press_button(context, BUTTON_A, 160ms, 840ms); | ||
| pbf_press_button(context, BUTTON_A, 48ms, 24ms);//month | ||
| pbf_move_left_joystick(context, {0,+1}, 48ms, 24ms); | ||
| pbf_press_button(context, BUTTON_A, 48ms, 24ms);//day | ||
| pbf_press_button(context, BUTTON_A, 48ms, 24ms);//year | ||
| pbf_press_button(context, BUTTON_A, 48ms, 24ms);//hour | ||
| pbf_press_button(context, BUTTON_A, 48ms, 24ms);//minute | ||
| pbf_press_button(context, BUTTON_A, 48ms, 24ms);//am-pm | ||
| pbf_press_button(context, BUTTON_A, 160ms, 840ms); | ||
|
|
||
| pbf_press_button(context, BUTTON_HOME, 160ms, ConsoleSettings::instance().SETTINGS_TO_HOME_DELAY0); | ||
| //resume game | ||
| resume_game_from_home(env.console, context); | ||
|
|
||
| pbf_wait(context, 2000ms); | ||
|
|
||
| send_program_finished_notification(env, NOTIFICATION_PROGRAM_FINISH); | ||
| GO_HOME_WHEN_DONE.run_end_of_program(context); | ||
| } | ||
|
|
||
|
|
||
|
|
||
| } | ||
| } | ||
| } | ||
| } | ||
53 changes: 53 additions & 0 deletions
53
SerialPrograms/Source/PokemonPokopia/Programs/PokemonPokopia_PaletteReset.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| /* Palette Reset | ||
| * | ||
| * From: https://github.com/PokemonAutomation/ | ||
| * | ||
| */ | ||
|
|
||
| #ifndef PokemonAutomation_PokemonPokopia_PaletteReset_H | ||
| #define PokemonAutomation_PokemonPokopia_PaletteReset_H | ||
|
|
||
| #include "Common/Cpp/Options/SimpleIntegerOption.h" | ||
| #include "Common/Cpp/Options/ButtonOption.h" | ||
| #include "CommonFramework/Notifications/EventNotificationsTable.h" | ||
| #include "NintendoSwitch/NintendoSwitch_SingleSwitchProgram.h" | ||
| #include "NintendoSwitch/Options/NintendoSwitch_GoHomeWhenDoneOption.h" | ||
|
|
||
| namespace PokemonAutomation{ | ||
|
|
||
| template <typename Type> class ControllerContext; | ||
|
|
||
| namespace NintendoSwitch{ | ||
|
|
||
| class ProController; | ||
| using ProControllerContext = ControllerContext<ProController>; | ||
|
|
||
| namespace PokemonPokopia{ | ||
|
|
||
|
|
||
| class PaletteReset_Descriptor : public SingleSwitchProgramDescriptor{ | ||
| public: | ||
| PaletteReset_Descriptor(); | ||
|
|
||
| }; | ||
|
|
||
|
|
||
| class PaletteReset : public SingleSwitchProgramInstance{ | ||
| public: | ||
| PaletteReset(); | ||
|
|
||
| virtual void program(SingleSwitchProgramEnvironment& env, ProControllerContext& context) override; | ||
|
|
||
|
|
||
| private: | ||
| SimpleIntegerOption<uint32_t> SKIPS; | ||
| GoHomeWhenDoneOption GO_HOME_WHEN_DONE; | ||
| EventNotificationsOption NOTIFICATIONS; | ||
| }; | ||
|
|
||
|
|
||
|
|
||
| } | ||
| } | ||
| } | ||
| #endif |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beware, you have some tabs in your files and we ban them from this codebase !