Skip to content

Commit 76a2493

Browse files
Updated the formatting more
Reviewed additional programs and updated the code formatting.
1 parent 8ef0f0f commit 76a2493

2 files changed

Lines changed: 29 additions & 20 deletions

File tree

SerialPrograms/Source/PokemonFRLG/Programs/ShinyHunting/PokemonFRLG_ShinyHunt-Fishing.cpp

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,24 @@
77
#include "CommonFramework/ProgramStats/StatsTracking.h"
88
#include "CommonFramework/Notifications/ProgramNotifications.h"
99
#include "CommonFramework/VideoPipeline/VideoFeed.h"
10+
1011
#include "CommonTools/Async/InferenceRoutines.h"
1112
#include "CommonTools/VisualDetectors/BlackScreenDetector.h"
13+
1214
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_PushButtons.h"
1315
#include "NintendoSwitch/Commands/NintendoSwitch_Commands_Superscalar.h"
16+
1417
#include "Pokemon/Pokemon_Strings.h"
1518
#include "PokemonFRLG/Inference/Dialogs/PokemonFRLG_DialogDetector.h"
1619
#include "PokemonFRLG/Inference/Dialogs/PokemonFRLG_BattleDialogs.h"
1720
#include "PokemonFRLG/Inference/PokemonFRLG_SelectionArrowDetector.h"
1821
#include "PokemonFRLG/Inference/Sounds/PokemonFRLG_ShinySoundDetector.h"
1922
#include "PokemonFRLG/PokemonFRLG_Navigation.h"
20-
#include "PokemonFRLG_ShinyHunt-Fishing.h"
23+
2124
#include <chrono>
2225

26+
#include "PokemonFRLG_ShinyHunt-Fishing.h"
27+
2328
/*TODO LIST
2429
* Based on reading the included .h files, I believe I can add the following functionality in the future.
2530
* -An option to automatically register a new rod.
@@ -35,8 +40,8 @@ namespace PokemonAutomation{
3540
namespace NintendoSwitch{
3641
namespace PokemonFRLG{
3742

38-
PokemonFRLG_ShinyHuntFishing_Descriptor::
39-
PokemonFRLG_ShinyHuntFishing_Descriptor()
43+
ShinyHuntFishing_Descriptor::
44+
ShinyHuntFishing_Descriptor()
4045
: SingleSwitchProgramDescriptor(
4146
"PokemonFRLG:ShinyHuntFishing",
4247
Pokemon::STRING_POKEMON + " FRLG", "Shiny Hunt - Fishing",
@@ -48,30 +53,29 @@ PokemonFRLG_ShinyHuntFishing_Descriptor::
4853
)
4954
{}
5055

51-
struct PokemonFRLG_ShinyHuntFishing_Descriptor::Stats : public StatsTracker{
56+
struct ShinyHuntFishing_Descriptor::Stats : public StatsTracker{
5257
Stats()
5358
: encounters(m_stats["Encounters"])
5459
, shinies(m_stats["Shinies"])
5560
, errors(m_stats["Errors"])
5661
{
5762
m_display_order.emplace_back("Encounters");
5863
m_display_order.emplace_back("Shinies");
59-
m_display_order.emplace_back("Errors");
64+
m_display_order.emplace_back("Errors", HIDDEN_IF_ZERO);
6065
}
6166

6267
std::atomic<uint64_t>& encounters;
6368
std::atomic<uint64_t>& shinies;
6469
std::atomic<uint64_t>& errors;
6570
};
6671

67-
std::unique_ptr<StatsTracker> PokemonFRLG_ShinyHuntFishing_Descriptor::make_stats() const{
72+
std::unique_ptr<StatsTracker> ShinyHuntFishing_Descriptor::make_stats() const{
6873
return std::make_unique<Stats>();
6974
}
7075

7176

72-
PokemonFRLG_ShinyHuntFishing::PokemonFRLG_ShinyHuntFishing()
77+
ShinyHuntFishing::ShinyHuntFishing()
7378
: SingleSwitchProgramInstance()
74-
7579
, BITE_WAIT_MS(
7680
"<b>Bite Wait (ms)</b><br>"
7781
"Adaptive delay before pressing A.",
@@ -80,16 +84,18 @@ PokemonFRLG_ShinyHuntFishing::PokemonFRLG_ShinyHuntFishing()
8084
2400,
8185
4200
8286
)
83-
8487
, GO_HOME_WHEN_DONE(true)
8588

8689
, NOTIFICATION_SHINY(
8790
"Shiny found",
8891
true, true, ImageAttachmentMode::JPG,
8992
{"Notifs", "Showcase"}
9093
)
94+
95+
, NOTIFICATION_STATUS_UPDATE("Status Update", true, false, std::chrono::seconds(3600))
9196
, NOTIFICATIONS({
9297
&NOTIFICATION_SHINY,
98+
&NOTIFICATION_STATUS_UPDATE,
9399
&NOTIFICATION_PROGRAM_FINISH
94100
})
95101

@@ -104,15 +110,14 @@ PokemonFRLG_ShinyHuntFishing::PokemonFRLG_ShinyHuntFishing()
104110
}
105111

106112

107-
void PokemonFRLG_ShinyHuntFishing::program(SingleSwitchProgramEnvironment& env,ProControllerContext& context
113+
void ShinyHuntFishing::program(SingleSwitchProgramEnvironment& env,ProControllerContext& context
108114
){
109-
auto& stats = env.current_stats<PokemonFRLG_ShinyHuntFishing_Descriptor::Stats>();
115+
auto& stats = env.current_stats<ShinyHuntFishing_Descriptor::Stats>();
110116

111117
home_black_border_check(env.console, context);
112118
/*
113-
* Settings: Text Speed fast. Audio required.
119+
* Settings: Text Speed fast.
114120
* Setup: Stand in facing fishable water.
115-
* Lead can't be shiny.
116121
*/
117122

118123
env.log("FRLG Fishing shiny hunt started.");
@@ -128,7 +133,7 @@ void PokemonFRLG_ShinyHuntFishing::program(SingleSwitchProgramEnvironment& env,P
128133
while (true){
129134

130135
// cast rod (must already be registered)
131-
pbf_press_button(context, BUTTON_MINUS, 20ms, 400ms);
136+
pbf_press_button(context, BUTTON_MINUS, 20ms, 1400ms);
132137

133138
// wait for bite dialog or battle transition
134139
int ret =

SerialPrograms/Source/PokemonFRLG/Programs/ShinyHunting/PokemonFRLG_ShinyHunt-Fishing.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* From: https://github.com/PokemonAutomation/
44
*
55
*/
6-
#ifndef PokemonAutomation_PokemonFRLG_ShinyHuntFishing_H
7-
#define PokemonAutomation_PokemonFRLG_ShinyHuntFishing_H
6+
#ifndef PokemonAutomation_ShinyHuntFishing_H
7+
#define PokemonAutomation_ShinyHuntFishing_H
88

99
#include "CommonFramework/Notifications/EventNotificationsTable.h"
1010
#include "NintendoSwitch/NintendoSwitch_SingleSwitchProgram.h"
@@ -19,16 +19,18 @@ namespace NintendoSwitch{
1919
namespace PokemonFRLG{
2020

2121

22-
class PokemonFRLG_ShinyHuntFishing_Descriptor : public SingleSwitchProgramDescriptor{
22+
class ShinyHuntFishing_Descriptor
23+
: public SingleSwitchProgramDescriptor{
2324
public:
24-
PokemonFRLG_ShinyHuntFishing_Descriptor();
25+
ShinyHuntFishing_Descriptor
26+
();
2527
struct Stats;
2628
virtual std::unique_ptr<StatsTracker> make_stats() const override;
2729
};
2830

29-
class PokemonFRLG_ShinyHuntFishing : public SingleSwitchProgramInstance{
31+
class ShinyHuntFishing : public SingleSwitchProgramInstance{
3032
public:
31-
PokemonFRLG_ShinyHuntFishing();
33+
ShinyHuntFishing();
3234
virtual void program(SingleSwitchProgramEnvironment& env, ProControllerContext& context) override;
3335

3436

@@ -45,6 +47,8 @@ class PokemonFRLG_ShinyHuntFishing : public SingleSwitchProgramInstance{
4547

4648
EventNotificationOption NOTIFICATION_SHINY;
4749

50+
EventNotificationOption NOTIFICATION_STATUS_UPDATE;
51+
4852
EventNotificationsOption NOTIFICATIONS;
4953

5054
};

0 commit comments

Comments
 (0)