Skip to content

Commit 43b314c

Browse files
committed
check if NPC was reached
1 parent 33b7b19 commit 43b314c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

SerialPrograms/Source/PokemonSwSh/Programs/RNG/PokemonSwSh_DailyHighlightRNG.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "Pokemon/Pokemon_Strings.h"
1818
#include "PokemonSwSh/PokemonSwSh_Settings.h"
1919
#include "PokemonSwSh/Commands/PokemonSwSh_Commands_DateSpam.h"
20+
#include "PokemonSwSh/Inference/PokemonSwSh_DialogTriangleDetector.h"
2021
#include "PokemonSwSh/Inference/PokemonSwSh_SelectionArrowFinder.h"
2122
#include "PokemonSwSh/Programs/PokemonSwSh_MenuNavigation.h"
2223
#include "PokemonSwSh/Programs/RNG/PokemonSwSh_BasicRNG.h"
@@ -138,7 +139,18 @@ DailyHighlightRNG::DailyHighlightRNG()
138139
void DailyHighlightRNG::move_to_trader(SingleSwitchProgramEnvironment& env, BotBaseContext& context) {
139140
pbf_move_left_joystick(context, 207, 1, 160, 10); // Magic numbers to barely reach the trader
140141
pbf_press_button(context, BUTTON_A, 20, 20);
141-
// TODO: check if NPC was reached -> DialogArrow
142+
143+
//Check if NPC was reached
144+
DialogTriangleDetector dialog_detector(env.console, ImageFloatBox(0.465, 0.195, 0.054, 0.57));
145+
dialog_detector.make_overlays(boxes);
146+
147+
int ret = wait_until(env.console, context, Milliseconds(3000), { dialog_detector });
148+
if (ret < 0) {
149+
OperationFailedException::fire(
150+
env.console, ErrorReport::SEND_ERROR_REPORT,
151+
"Failed to talk to the trader."
152+
);
153+
}
142154
}
143155

144156
void DailyHighlightRNG::navigate_to_party(SingleSwitchProgramEnvironment& env, BotBaseContext& context){

0 commit comments

Comments
 (0)