diff --git a/assets/cn/retire/RETIRE_CONFIRM_SCROLL_AREA.png b/assets/cn/retire/RETIRE_CONFIRM_SCROLL_AREA.png new file mode 100644 index 0000000000..700269dd39 Binary files /dev/null and b/assets/cn/retire/RETIRE_CONFIRM_SCROLL_AREA.png differ diff --git a/assets/en/retire/RETIRE_CONFIRM_SCROLL_AREA.png b/assets/en/retire/RETIRE_CONFIRM_SCROLL_AREA.png new file mode 100644 index 0000000000..700269dd39 Binary files /dev/null and b/assets/en/retire/RETIRE_CONFIRM_SCROLL_AREA.png differ diff --git a/assets/jp/retire/RETIRE_CONFIRM_SCROLL_AREA.png b/assets/jp/retire/RETIRE_CONFIRM_SCROLL_AREA.png new file mode 100644 index 0000000000..700269dd39 Binary files /dev/null and b/assets/jp/retire/RETIRE_CONFIRM_SCROLL_AREA.png differ diff --git a/assets/tw/retire/RETIRE_CONFIRM_SCROLL_AREA.png b/assets/tw/retire/RETIRE_CONFIRM_SCROLL_AREA.png new file mode 100644 index 0000000000..700269dd39 Binary files /dev/null and b/assets/tw/retire/RETIRE_CONFIRM_SCROLL_AREA.png differ diff --git a/assets/tw/shipyard/SHIPYARD_SERIES_SELECT_CHECK.png b/assets/tw/shipyard/SHIPYARD_SERIES_SELECT_CHECK.png index cb64171703..ea6d536fca 100644 Binary files a/assets/tw/shipyard/SHIPYARD_SERIES_SELECT_CHECK.png and b/assets/tw/shipyard/SHIPYARD_SERIES_SELECT_CHECK.png differ diff --git a/module/campaign/gems_farming.py b/module/campaign/gems_farming.py index 845eaf4aa5..dc855f211e 100644 --- a/module/campaign/gems_farming.py +++ b/module/campaign/gems_farming.py @@ -400,7 +400,6 @@ def run(self, name, folder='campaign_main', mode='normal', total=0): total (int): """ self.config.STOP_IF_REACH_LV32 = self.change_flagship - self.config.RETIRE_KEEP_COMMON_CV = True while 1: self._trigger_lv32 = False diff --git a/module/config/config_manual.py b/module/config/config_manual.py index 22261d2051..cd795c7e86 100644 --- a/module/config/config_manual.py +++ b/module/config/config_manual.py @@ -353,7 +353,6 @@ def SERVER(self): """ DOCK_FULL_TRIGGERED = False GET_SHIP_TRIGGERED = False - RETIRE_KEEP_COMMON_CV = False COMMON_CV_THRESHOLD = 0.9 """ diff --git a/module/freebies/mail_white.py b/module/freebies/mail_white.py index 42f1feeebe..e717d39e0d 100644 --- a/module/freebies/mail_white.py +++ b/module/freebies/mail_white.py @@ -1,4 +1,5 @@ from module.base.decorator import cached_property +from module.base.timer import Timer from module.combat.assets import GET_ITEMS_1, GET_ITEMS_2 from module.freebies.assets import * from module.logger import logger @@ -28,6 +29,9 @@ def mail_select_setting(self): def _mail_enter(self, skip_first_screenshot=True): """ + Returns: + int: If having mails + Page: in: page_main_white or MAIL_MANAGE out: MAIL_BATCH_CLAIM @@ -36,6 +40,7 @@ def _mail_enter(self, skip_first_screenshot=True): self.interval_clear([ MAIL_MANAGE ]) + timeout = Timer(0.6, count=1) while 1: if skip_first_screenshot: skip_first_screenshot = False @@ -45,7 +50,12 @@ def _mail_enter(self, skip_first_screenshot=True): # End if self.appear(MAIL_BATCH_CLAIM, offset=(20, 20)): logger.info('Mail entered') - break + return True + if self.appear(GOTO_MAIN_WHITE, offset=(20, 20)): + timeout.start() + if timeout.reached(): + logger.info('Mail empty') + return False # Click if self.appear_then_click(MAIL_MANAGE, offset=(30, 30), interval=3): @@ -186,6 +196,9 @@ def mail_claim( in: page_main_white or MAIL_MANAGE out: MAIL_BATCH_CLAIM """ + if not self._mail_enter(): + return + if merit: logger.hr('Mail merit', level=2) self._mail_enter() diff --git a/module/retire/assets.py b/module/retire/assets.py index 2cf3da530a..25ad35ccae 100644 --- a/module/retire/assets.py +++ b/module/retire/assets.py @@ -27,6 +27,7 @@ RETIRE_APPEAR_2 = Button(area={'cn': (604, 501, 677, 533), 'en': (585, 496, 694, 527), 'jp': (604, 497, 677, 529), 'tw': (603, 501, 677, 533)}, color={'cn': (146, 178, 219), 'en': (146, 179, 220), 'jp': (136, 171, 215), 'tw': (145, 177, 218)}, button={'cn': (604, 501, 677, 533), 'en': (585, 496, 694, 527), 'jp': (604, 497, 677, 529), 'tw': (603, 501, 677, 533)}, file={'cn': './assets/cn/retire/RETIRE_APPEAR_2.png', 'en': './assets/en/retire/RETIRE_APPEAR_2.png', 'jp': './assets/jp/retire/RETIRE_APPEAR_2.png', 'tw': './assets/tw/retire/RETIRE_APPEAR_2.png'}) RETIRE_APPEAR_3 = Button(area={'cn': (804, 501, 876, 533), 'en': (776, 496, 904, 521), 'jp': (804, 497, 876, 529), 'tw': (804, 501, 877, 533)}, color={'cn': (148, 179, 219), 'en': (155, 184, 222), 'jp': (136, 170, 214), 'tw': (147, 179, 219)}, button={'cn': (804, 501, 876, 533), 'en': (776, 496, 904, 521), 'jp': (804, 497, 876, 529), 'tw': (804, 501, 877, 533)}, file={'cn': './assets/cn/retire/RETIRE_APPEAR_3.png', 'en': './assets/en/retire/RETIRE_APPEAR_3.png', 'jp': './assets/jp/retire/RETIRE_APPEAR_3.png', 'tw': './assets/tw/retire/RETIRE_APPEAR_3.png'}) RETIRE_COIN = Button(area={'cn': (307, 638, 351, 661), 'en': (361, 638, 401, 661), 'jp': (326, 637, 365, 662), 'tw': (307, 638, 351, 661)}, color={'cn': (150, 158, 165), 'en': (152, 157, 165), 'jp': (173, 176, 182), 'tw': (150, 158, 165)}, button={'cn': (307, 638, 351, 661), 'en': (361, 638, 401, 661), 'jp': (326, 637, 365, 662), 'tw': (307, 638, 351, 661)}, file={'cn': './assets/cn/retire/RETIRE_COIN.png', 'en': './assets/en/retire/RETIRE_COIN.png', 'jp': './assets/jp/retire/RETIRE_COIN.png', 'tw': './assets/tw/retire/RETIRE_COIN.png'}) +RETIRE_CONFIRM_SCROLL_AREA = Button(area={'cn': (1092, 114, 1095, 592), 'en': (1092, 114, 1095, 592), 'jp': (1092, 114, 1095, 592), 'tw': (1092, 114, 1095, 592)}, color={'cn': (255, 255, 255), 'en': (255, 255, 255), 'jp': (255, 255, 255), 'tw': (255, 255, 255)}, button={'cn': (1092, 114, 1095, 592), 'en': (1092, 114, 1095, 592), 'jp': (1092, 114, 1095, 592), 'tw': (1092, 114, 1095, 592)}, file={'cn': './assets/cn/retire/RETIRE_CONFIRM_SCROLL_AREA.png', 'en': './assets/en/retire/RETIRE_CONFIRM_SCROLL_AREA.png', 'jp': './assets/jp/retire/RETIRE_CONFIRM_SCROLL_AREA.png', 'tw': './assets/tw/retire/RETIRE_CONFIRM_SCROLL_AREA.png'}) RETIRE_SETTING_1 = Button(area={'cn': (818, 259, 847, 290), 'en': (989, 260, 1017, 289), 'jp': (965, 265, 996, 296), 'tw': (818, 259, 847, 290)}, color={'cn': (102, 122, 147), 'en': (61, 71, 92), 'jp': (61, 70, 91), 'tw': (102, 122, 147)}, button={'cn': (818, 259, 847, 290), 'en': (989, 260, 1017, 289), 'jp': (965, 265, 996, 296), 'tw': (818, 259, 847, 290)}, file={'cn': './assets/cn/retire/RETIRE_SETTING_1.png', 'en': './assets/en/retire/RETIRE_SETTING_1.png', 'jp': './assets/jp/retire/RETIRE_SETTING_1.png', 'tw': './assets/cn/retire/RETIRE_SETTING_1.png'}) RETIRE_SETTING_2 = Button(area={'cn': (746, 316, 775, 346), 'en': (990, 317, 1017, 345), 'jp': (965, 325, 996, 356), 'tw': (746, 316, 775, 346)}, color={'cn': (104, 124, 149), 'en': (62, 73, 93), 'jp': (62, 73, 91), 'tw': (104, 124, 149)}, button={'cn': (746, 316, 775, 346), 'en': (990, 317, 1017, 345), 'jp': (965, 325, 996, 356), 'tw': (746, 316, 775, 346)}, file={'cn': './assets/cn/retire/RETIRE_SETTING_2.png', 'en': './assets/en/retire/RETIRE_SETTING_2.png', 'jp': './assets/jp/retire/RETIRE_SETTING_2.png', 'tw': './assets/cn/retire/RETIRE_SETTING_2.png'}) RETIRE_SETTING_3 = Button(area={'cn': (894, 372, 923, 404), 'en': (990, 374, 1017, 402), 'jp': (965, 385, 996, 416), 'tw': (894, 372, 923, 404)}, color={'cn': (101, 120, 145), 'en': (107, 129, 155), 'jp': (103, 121, 143), 'tw': (101, 120, 145)}, button={'cn': (894, 372, 923, 404), 'en': (990, 374, 1017, 402), 'jp': (965, 385, 996, 416), 'tw': (894, 372, 923, 404)}, file={'cn': './assets/cn/retire/RETIRE_SETTING_3.png', 'en': './assets/en/retire/RETIRE_SETTING_3.png', 'jp': './assets/jp/retire/RETIRE_SETTING_3.png', 'tw': './assets/cn/retire/RETIRE_SETTING_3.png'}) diff --git a/module/retire/retirement.py b/module/retire/retirement.py index 505144b64f..e1efed738c 100644 --- a/module/retire/retirement.py +++ b/module/retire/retirement.py @@ -9,6 +9,7 @@ from module.retire.enhancement import Enhancement from module.retire.scanner import ShipScanner from module.retire.setting import QuickRetireSettingHandler +from module.ui.scroll import Scroll CARD_GRIDS = ButtonGrid( origin=(93, 76), delta=(164 + 2 / 3, 227), button_shape=(138, 204), grid_shape=(7, 2), name='CARD') @@ -23,6 +24,9 @@ # Not support marriage cards. } +RETIRE_CONFIRM_SCROLL = Scroll(RETIRE_CONFIRM_SCROLL_AREA, color=(74, 77, 110), name='STRATEGIC_SEARCH_SCROLL') +RETIRE_CONFIRM_SCROLL.color_threshold = 240 # Background color is (66, 72, 77), so default (256-221)=35 is not enough to dintinguish. + class Retirement(Enhancement, QuickRetireSettingHandler): _unable_to_enhance = False @@ -31,6 +35,10 @@ class Retirement(Enhancement, QuickRetireSettingHandler): # From MapOperation map_cat_attack_timer = Timer(2) + @property + def retire_keep_common_cv(self): + return self.config.is_task_enabled('GemsFarming') + def _retirement_choose(self, amount=10, target_rarity=('N',)): """ Args: @@ -110,7 +118,7 @@ def _retirement_confirm(self, skip_first_screenshot=True): else: self.interval_clear(SHIP_CONFIRM) if self.appear(SHIP_CONFIRM_2, offset=(30, 30), interval=2): - if self.config.RETIRE_KEEP_COMMON_CV and not self._have_kept_cv: + if self.retire_keep_common_cv and not self._have_kept_cv: self.keep_one_common_cv() self.device.click(SHIP_CONFIRM_2) self.interval_clear(GET_ITEMS_1) @@ -167,7 +175,7 @@ def retire_ships_one_click(self): end = False total = 0 - if self.config.RETIRE_KEEP_COMMON_CV: + if self.retire_keep_common_cv: self._have_kept_cv = False while 1: @@ -242,7 +250,7 @@ def retire_ships_old(self, amount=None, rarity=None): self.dock_favourite_set(False) total = 0 - if self.config.RETIRE_KEEP_COMMON_CV: + if self.retire_keep_common_cv: self._have_kept_cv = False while amount: @@ -456,7 +464,7 @@ def _retire_select_one(self, button, skip_first_screenshot=True): return True return False - def retirement_get_common_rarity_cv(self): + def retirement_get_common_rarity_cv_in_page(self): """ Returns: Button: @@ -486,6 +494,22 @@ def retirement_get_common_rarity_cv(self): return None + def retirement_get_common_rarity_cv(self, skip_first_screenshot=False): + button = self.retirement_get_common_rarity_cv_in_page() + if button is not None: + return button + + while RETIRE_CONFIRM_SCROLL.appear(main=self): + RETIRE_CONFIRM_SCROLL.next_page(main=self) + button = self.retirement_get_common_rarity_cv_in_page() + if button is not None: + return button + if RETIRE_CONFIRM_SCROLL.at_bottom(main=self): + logger.info('Scroll bar reached end, stop') + break + + return button + def keep_one_common_cv(self): button = self.retirement_get_common_rarity_cv() if button is not None: diff --git a/module/shipyard/assets.py b/module/shipyard/assets.py index 964a260373..b777c48580 100644 --- a/module/shipyard/assets.py +++ b/module/shipyard/assets.py @@ -20,7 +20,7 @@ SHIPYARD_RESEARCH_COMPLETE = Button(area={'cn': (548, 498, 740, 531), 'en': (548, 498, 740, 531), 'jp': (536, 494, 731, 538), 'tw': (548, 498, 740, 531)}, color={'cn': (214, 142, 124), 'en': (214, 142, 124), 'jp': (208, 120, 95), 'tw': (214, 142, 124)}, button={'cn': (548, 498, 740, 531), 'en': (548, 498, 740, 531), 'jp': (536, 494, 731, 538), 'tw': (548, 498, 740, 531)}, file={'cn': './assets/cn/shipyard/SHIPYARD_RESEARCH_COMPLETE.png', 'en': './assets/en/shipyard/SHIPYARD_RESEARCH_COMPLETE.png', 'jp': './assets/jp/shipyard/SHIPYARD_RESEARCH_COMPLETE.png', 'tw': './assets/tw/shipyard/SHIPYARD_RESEARCH_COMPLETE.png'}) SHIPYARD_RESEARCH_INCOMPLETE = Button(area={'cn': (616, 490, 740, 531), 'en': (616, 490, 740, 531), 'jp': (614, 493, 735, 521), 'tw': (616, 490, 740, 531)}, color={'cn': (229, 192, 121), 'en': (229, 192, 121), 'jp': (244, 219, 164), 'tw': (229, 192, 121)}, button={'cn': (616, 490, 740, 531), 'en': (616, 490, 740, 531), 'jp': (614, 493, 735, 521), 'tw': (616, 490, 740, 531)}, file={'cn': './assets/cn/shipyard/SHIPYARD_RESEARCH_INCOMPLETE.png', 'en': './assets/en/shipyard/SHIPYARD_RESEARCH_INCOMPLETE.png', 'jp': './assets/jp/shipyard/SHIPYARD_RESEARCH_INCOMPLETE.png', 'tw': './assets/tw/shipyard/SHIPYARD_RESEARCH_INCOMPLETE.png'}) SHIPYARD_RESEARCH_IN_PROGRESS = Button(area={'cn': (465, 479, 482, 501), 'en': (465, 479, 482, 501), 'jp': (465, 479, 482, 501), 'tw': (465, 479, 482, 501)}, color={'cn': (105, 135, 173), 'en': (105, 135, 173), 'jp': (105, 135, 173), 'tw': (105, 135, 173)}, button={'cn': (465, 479, 482, 501), 'en': (465, 479, 482, 501), 'jp': (465, 479, 482, 501), 'tw': (465, 479, 482, 501)}, file={'cn': './assets/cn/shipyard/SHIPYARD_RESEARCH_IN_PROGRESS.png', 'en': './assets/en/shipyard/SHIPYARD_RESEARCH_IN_PROGRESS.png', 'jp': './assets/jp/shipyard/SHIPYARD_RESEARCH_IN_PROGRESS.png', 'tw': './assets/tw/shipyard/SHIPYARD_RESEARCH_IN_PROGRESS.png'}) -SHIPYARD_SERIES_SELECT_CHECK = Button(area={'cn': (32, 62, 53, 100), 'en': (32, 62, 53, 100), 'jp': (32, 62, 53, 100), 'tw': (565, 194, 715, 212)}, color={'cn': (9, 61, 190), 'en': (9, 61, 190), 'jp': (9, 61, 190), 'tw': (18, 28, 56)}, button={'cn': (32, 62, 53, 100), 'en': (32, 62, 53, 100), 'jp': (32, 62, 53, 100), 'tw': (565, 194, 715, 212)}, file={'cn': './assets/cn/shipyard/SHIPYARD_SERIES_SELECT_CHECK.png', 'en': './assets/en/shipyard/SHIPYARD_SERIES_SELECT_CHECK.png', 'jp': './assets/jp/shipyard/SHIPYARD_SERIES_SELECT_CHECK.png', 'tw': './assets/tw/shipyard/SHIPYARD_SERIES_SELECT_CHECK.png'}) +SHIPYARD_SERIES_SELECT_CHECK = Button(area={'cn': (32, 62, 53, 100), 'en': (32, 62, 53, 100), 'jp': (32, 62, 53, 100), 'tw': (32, 62, 53, 100)}, color={'cn': (9, 61, 190), 'en': (9, 61, 190), 'jp': (9, 61, 190), 'tw': (9, 61, 190)}, button={'cn': (32, 62, 53, 100), 'en': (32, 62, 53, 100), 'jp': (32, 62, 53, 100), 'tw': (32, 62, 53, 100)}, file={'cn': './assets/cn/shipyard/SHIPYARD_SERIES_SELECT_CHECK.png', 'en': './assets/en/shipyard/SHIPYARD_SERIES_SELECT_CHECK.png', 'jp': './assets/jp/shipyard/SHIPYARD_SERIES_SELECT_CHECK.png', 'tw': './assets/tw/shipyard/SHIPYARD_SERIES_SELECT_CHECK.png'}) SHIPYARD_SERIES_SELECT_ENTER = Button(area={'cn': (33, 659, 161, 701), 'en': (34, 659, 160, 700), 'jp': (36, 674, 154, 696), 'tw': (33, 657, 157, 697)}, color={'cn': (91, 110, 155), 'en': (66, 87, 138), 'jp': (112, 126, 161), 'tw': (98, 117, 164)}, button={'cn': (33, 659, 161, 701), 'en': (34, 659, 160, 700), 'jp': (36, 674, 154, 696), 'tw': (33, 657, 157, 697)}, file={'cn': './assets/cn/shipyard/SHIPYARD_SERIES_SELECT_ENTER.png', 'en': './assets/en/shipyard/SHIPYARD_SERIES_SELECT_ENTER.png', 'jp': './assets/jp/shipyard/SHIPYARD_SERIES_SELECT_ENTER.png', 'tw': './assets/tw/shipyard/SHIPYARD_SERIES_SELECT_ENTER.png'}) SHIPYARD_TOTAL_DEV = Button(area={'cn': (1086, 429, 1147, 463), 'en': (1091, 426, 1142, 466), 'jp': (1086, 429, 1147, 463), 'tw': (1086, 429, 1147, 463)}, color={'cn': (39, 46, 55), 'en': (45, 48, 55), 'jp': (39, 46, 55), 'tw': (39, 46, 55)}, button={'cn': (1086, 429, 1147, 463), 'en': (1091, 426, 1142, 466), 'jp': (1086, 429, 1147, 463), 'tw': (1086, 429, 1147, 463)}, file={'cn': './assets/cn/shipyard/SHIPYARD_TOTAL_DEV.png', 'en': './assets/en/shipyard/SHIPYARD_TOTAL_DEV.png', 'jp': './assets/jp/shipyard/SHIPYARD_TOTAL_DEV.png', 'tw': './assets/tw/shipyard/SHIPYARD_TOTAL_DEV.png'}) SHIPYARD_TOTAL_FATE = Button(area={'cn': (1067, 457, 1126, 484), 'en': (1100, 449, 1165, 486), 'jp': (1067, 457, 1126, 484), 'tw': (1067, 457, 1126, 484)}, color={'cn': (43, 50, 59), 'en': (47, 51, 59), 'jp': (43, 50, 59), 'tw': (43, 50, 59)}, button={'cn': (1067, 457, 1126, 484), 'en': (1100, 449, 1165, 486), 'jp': (1067, 457, 1126, 484), 'tw': (1067, 457, 1126, 484)}, file={'cn': './assets/cn/shipyard/SHIPYARD_TOTAL_FATE.png', 'en': './assets/en/shipyard/SHIPYARD_TOTAL_FATE.png', 'jp': './assets/jp/shipyard/SHIPYARD_TOTAL_FATE.png', 'tw': './assets/tw/shipyard/SHIPYARD_TOTAL_FATE.png'}) diff --git a/module/shipyard/ui_globals.py b/module/shipyard/ui_globals.py index 185a93278b..3c2301ca3b 100644 --- a/module/shipyard/ui_globals.py +++ b/module/shipyard/ui_globals.py @@ -1,4 +1,3 @@ -import module.config.server as server from module.base.button import ButtonGrid from module.ocr.ocr import Digit from module.shipyard.assets import * @@ -11,14 +10,9 @@ button_shape=(45, 30), grid_shape=(6, 1), name='SHIPYARD_BP_COUNT_GRID') -if server.server == 'tw': - SHIPYARD_SERIES_GRID = ButtonGrid(origin=(450, 260), delta=(280, 90), - button_shape=(155, 40), grid_shape=(2, 3), - name='SHIPYARD_SERIES_GRID') -else: - SHIPYARD_SERIES_GRID = ButtonGrid(origin=(75, 133), delta=(399, 91), - button_shape=(337, 60), grid_shape=(3, 3), - name='SHIPYARD_SERIES_GRID') +SHIPYARD_SERIES_GRID = ButtonGrid(origin=(75, 133), delta=(399, 91), + button_shape=(337, 60), grid_shape=(3, 3), + name='SHIPYARD_SERIES_GRID') OCR_SHIPYARD_BP_COUNT_GRID = Digit(SHIPYARD_BP_COUNT_GRID.buttons, letter=(255, 247, 247),