Skip to content
Open
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
@@ -1,3 +1,3 @@
/* Pokemon FRLG Panels
*
* From: https://github.com/PokemonAutomation/
Expand All @@ -12,6 +12,7 @@

// General
#include "Programs/PokemonPokopia_CloudIslandReset.h"
#include "Programs/PokemonPokopia_PaletteReset.h"

namespace PokemonAutomation{
namespace NintendoSwitch{
Expand Down Expand Up @@ -39,6 +40,7 @@
if (IS_BETA_VERSION || PreloadSettings::instance().DEVELOPER_MODE){
ret.emplace_back("---- Untested/Beta/WIP ----");
ret.emplace_back(make_single_switch_program<CloudIslandReset_Descriptor, CloudIslandReset>());
ret.emplace_back(make_single_switch_program<PaletteReset_Descriptor, PaletteReset>());
}

// if (PreloadSettings::instance().DEVELOPER_MODE){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/* Pokemon Pokopia
*
* From: https://github.com/PokemonAutomation/
Expand All @@ -24,10 +24,17 @@
, m_general("<font size=4><b>General Settings:</b></font>")
, m_advanced_options(
"<font size=4><b>Advanced Options:</b> You should not need to touch anything below here.</font>"
)
,GAME_TO_HOME_DELAY0(
"<b>Game to Home Delay:</b><br>Delay from pressing home to entering the the Switch home menu.",
LockMode::LOCK_WHILE_RUNNING,
"1000 ms"
)

{
PA_ADD_STATIC(m_general);
PA_ADD_STATIC(m_advanced_options);
PA_ADD_OPTION(GAME_TO_HOME_DELAY0);
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/* Pokemon Pokopia
*
* From: https://github.com/PokemonAutomation/
Expand Down Expand Up @@ -26,6 +26,7 @@

SectionDividerOption m_advanced_options;

MillisecondsOption GAME_TO_HOME_DELAY0;

};

Expand All @@ -35,6 +36,8 @@
class GameSettings_Descriptor : public PanelDescriptor{
public:
GameSettings_Descriptor();


};


Expand Down
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
Copy link
Copy Markdown
Member

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 !

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);
}



}
}
}
}
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
Loading
Loading