Skip to content

Commit

Permalink
improve efficiency of momo_talk
Browse files Browse the repository at this point in the history
  • Loading branch information
pur1fying committed Dec 21, 2023
1 parent 99bd8e9 commit 531e032
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 7 deletions.
5 changes: 5 additions & 0 deletions core/position.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ def init_image_data(self):
'normal_task': normal_task_x,
'main_story': main_story_x,
'buy_ap': buy_ap_x,
'plot':{
'menu':(1172,21, 1231,56),
'skip-plot-button':(1193,103, 1235,132),
'skip-plot-notice':(606,124, 672,160)
}
}
filepath = 'src/images/CN'
elif self.server == 'Global':
Expand Down
10 changes: 6 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def wait_loading(self):
while 1:
self.latest_img_array = self.get_screenshot_array()
if not color.judge_rgb_range(self.latest_img_array, 937, 648, 200, 255, 200, 255, 200, 255) or not \
color.judge_rgb_range(self.latest_img_array, 919, 636, 200, 255, 200, 255, 200, 255):
color.judge_rgb_range(self.latest_img_array, 919, 636, 200, 255, 200, 255, 200, 255):
loading_pos = [[929, 664], [941, 660], [979, 662], [1077, 665], [1199, 665]]
rgb_loading = [[200, 255, 200, 255, 200, 255], [200, 255, 200, 255, 200, 255],
[200, 255, 200, 255, 200, 255], [200, 255, 200, 255, 200, 255],
Expand Down Expand Up @@ -268,7 +268,9 @@ def quick_method_to_main_page(self):
'arena_battle-lost': (640, 468),
'arena_season-record': (640, 538),
'arena_best-record': (640, 538),

'plot_menu': (1202, 37),
'plot_skip-plot-button': (1208, 116),
'plot_skip-plot-notice': (770, 519),
}
fail_cnt = 0
while True:
Expand Down Expand Up @@ -597,11 +599,11 @@ def init_package_name(self):
if __name__ == '__main__':
# # print(time.time())
t = Main()
t.solve('explore_normal_task')
t.solve('momo_talk')
t.flag_run = True
# t.solve('de_clothes')
# t.solve('common_shop')
# t.quick_method_to_main_page()
t.quick_method_to_main_page()
# t.solve('tactical_challenge_shop')
# t.quick_method_to_main_page()
# t.solve('arena')
Expand Down
9 changes: 6 additions & 3 deletions module/momo_talk.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,17 @@ def common_solve_affection_story_method(self):
def get_reply_position(img):
i = 156
while i < 657:
if color.judge_rgb_range(img, 786, i, 29, 49, 143, 163, 219, 239):
if color.judge_rgb_range(img, 786, i, 29, 49, 143, 163, 219, 239) and \
color.judge_rgb_range(img, 786, i+20, 29, 49, 143, 163, 219, 239):
return 'reply', min(i + 65, 625)
elif color.judge_rgb_range(img, 862, i, 245, 255, 227, 247, 230, 250) and \
color.judge_rgb_range(img, 862, i + 10, 245, 255, 125, 155, 145, 175):
return 'affection', min(625, i + 30)
else:
i += 1
return 'end', 0


def pd_menu_bright(img_array):
if color.judge_rgb_range(img_array, 1165, 45, 230, 255, 230, 255, 230, 255) and color.judge_rgb_range(img_array,
1238, 45, 230,
Expand Down Expand Up @@ -238,12 +241,12 @@ def pd_enter_button(img_array):

def common_skip_plot_method(self):
fail_cnt = 0
while fail_cnt <= 60:
while fail_cnt <= 20/self.screenshot_interval:
self.latest_img_array = self.get_screenshot_array()
if pd_enter_button(self.latest_img_array):
self.logger.info("Begin Relationship Story")
self.click(920, 556, wait=False)
time.sleep(7)
time.sleep(4)
elif pd_confirm_button(self.latest_img_array):
self.logger.info("find CONFIRM button")
self.click(766, 520, wait=False)
Expand Down
Binary file added src/images/CN/plot/menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/CN/plot/skip-plot-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/CN/plot/skip-plot-notice.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 531e032

Please sign in to comment.