1
0
mirror of https://github.com/TheFunny/ArisuAutoSweeper synced 2025-12-16 19:55:12 +00:00

fix: auto-mission

This commit is contained in:
RedDeadDepresso 2024-01-21 21:11:34 +00:00
parent 78c12a21dc
commit 2a1e7686f0
6 changed files with 41 additions and 31 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

View File

@ -348,13 +348,7 @@ ONE_STAR = ButtonWrapper(
PRESET1_OFF = ButtonWrapper( PRESET1_OFF = ButtonWrapper(
name='PRESET1_OFF', name='PRESET1_OFF',
jp=None, jp=None,
en=Button( en=None,
file='./assets/en/auto_mission/PRESET1_OFF.png',
area=(52, 143, 197, 181),
search=(32, 123, 217, 201),
color=(253, 253, 254),
button=(52, 143, 197, 181),
),
zht=Button( zht=Button(
file='./assets/zht/auto_mission/PRESET1_OFF.png', file='./assets/zht/auto_mission/PRESET1_OFF.png',
area=(52, 143, 197, 181), area=(52, 143, 197, 181),
@ -384,13 +378,7 @@ PRESET1_ON = ButtonWrapper(
PRESET2_OFF = ButtonWrapper( PRESET2_OFF = ButtonWrapper(
name='PRESET2_OFF', name='PRESET2_OFF',
jp=None, jp=None,
en=Button( en=None,
file='./assets/en/auto_mission/PRESET2_OFF.png',
area=(214, 144, 355, 180),
search=(194, 124, 375, 200),
color=(252, 253, 253),
button=(214, 144, 355, 180),
),
zht=Button( zht=Button(
file='./assets/zht/auto_mission/PRESET2_OFF.png', file='./assets/zht/auto_mission/PRESET2_OFF.png',
area=(214, 144, 355, 180), area=(214, 144, 355, 180),
@ -420,13 +408,7 @@ PRESET2_ON = ButtonWrapper(
PRESET3_OFF = ButtonWrapper( PRESET3_OFF = ButtonWrapper(
name='PRESET3_OFF', name='PRESET3_OFF',
jp=None, jp=None,
en=Button( en=None,
file='./assets/en/auto_mission/PRESET3_OFF.png',
area=(369, 143, 516, 186),
search=(349, 123, 536, 206),
color=(251, 252, 252),
button=(369, 143, 516, 186),
),
zht=Button( zht=Button(
file='./assets/zht/auto_mission/PRESET3_OFF.png', file='./assets/zht/auto_mission/PRESET3_OFF.png',
area=(369, 143, 516, 186), area=(369, 143, 516, 186),
@ -456,13 +438,7 @@ PRESET3_ON = ButtonWrapper(
PRESET4_OFF = ButtonWrapper( PRESET4_OFF = ButtonWrapper(
name='PRESET4_OFF', name='PRESET4_OFF',
jp=None, jp=None,
en=Button( en=None,
file='./assets/en/auto_mission/PRESET4_OFF.png',
area=(527, 146, 675, 183),
search=(507, 126, 695, 203),
color=(252, 252, 253),
button=(527, 146, 675, 183),
),
zht=Button( zht=Button(
file='./assets/zht/auto_mission/PRESET4_OFF.png', file='./assets/zht/auto_mission/PRESET4_OFF.png',
area=(527, 146, 675, 183), area=(527, 146, 675, 183),
@ -561,6 +537,24 @@ RANK = ButtonWrapper(
button=(540, 628, 738, 689), button=(540, 628, 738, 689),
), ),
) )
RECEIVED_CHEST = ButtonWrapper(
name='RECEIVED_CHEST',
jp=None,
en=Button(
file='./assets/en/auto_mission/RECEIVED_CHEST.png',
area=(502, 188, 774, 226),
search=(482, 168, 794, 246),
color=(198, 208, 217),
button=(547, 487, 738, 547),
),
zht=Button(
file='./assets/zht/auto_mission/RECEIVED_CHEST.png',
area=(569, 192, 704, 226),
search=(549, 172, 724, 246),
color=(177, 187, 197),
button=(549, 488, 736, 543),
),
)
REWARD_ACQUIRED = ButtonWrapper( REWARD_ACQUIRED = ButtonWrapper(
name='REWARD_ACQUIRED', name='REWARD_ACQUIRED',
jp=None, jp=None,

View File

@ -88,7 +88,7 @@ class Copilot(UI):
while not self.match_color(PRESET, threshold=50): while not self.match_color(PRESET, threshold=50):
self.device.screenshot() self.device.screenshot()
self.click_with_interval(PRESET, interval=1) self.click_with_interval(PRESET, interval=1)
clickoffsety = [90, 85, 0, -90, 0] clickoffsety = [85, 85, 0, -120, 0]
SCROLL_SELECT.select_index(main=self, target_index=row_index, clickoffsety=clickoffsety[row_index]) SCROLL_SELECT.select_index(main=self, target_index=row_index, clickoffsety=clickoffsety[row_index])
def choose_unit(self, unit): def choose_unit(self, unit):
@ -146,7 +146,20 @@ class Copilot(UI):
force_index = self.get_force() force_index = self.get_force()
self.sleep(1) self.sleep(1)
return force_index return force_index
def handle_all_mission_popup(self):
self.sleep(2)
while not self.match_color(MISSION_INFO):
self.device.screenshot()
if self.match_color(MISSION_INFO):
break
if self.appear_then_click(MISSION_INFO_POPUP):
continue
if self.appear_then_click(MOVE_UNIT):
continue
if self.appear_then_click(RECEIVED_CHEST):
continue
def handle_mission_popup(self, button, skip_first_screenshot=True): def handle_mission_popup(self, button, skip_first_screenshot=True):
while 1: while 1:
if skip_first_screenshot: if skip_first_screenshot:
@ -170,9 +183,10 @@ class Copilot(UI):
while 1: while 1:
self.device.screenshot() self.device.screenshot()
if not self.match_color(END_PHASE): if not self.match_color(END_PHASE):
self.handle_mission_popup(END_PHASE_POPUP) self.handle_all_mission_popup()
break break
self.appear_then_click(END_PHASE) self.appear_then_click(END_PHASE)
self.sleep(2)
def wait_over(self): def wait_over(self):
#self.sleep(2) #self.sleep(2)
@ -244,6 +258,8 @@ class Copilot(UI):
if 'wait-over' in act: if 'wait-over' in act:
self.wait_over() self.wait_over()
self.sleep(2) self.sleep(2)
if i != len(actions) - 1:
self.handle_all_mission_popup()
logger.warning("Actions completed, waiting to enter the battle...") logger.warning("Actions completed, waiting to enter the battle...")