mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-12 21:27:01 +08:00
Merge branch 'master' of https://github.com/LmeSzinc/AzurLaneAutoScript
This commit is contained in:
@@ -17,19 +17,14 @@ class StorageHandler(GlobeOperation, ZoneManager):
|
||||
def is_in_storage(self):
|
||||
return self.appear(STORAGE_CHECK, offset=(20, 20))
|
||||
|
||||
def storage_enter(self, skip_first_screenshot=True):
|
||||
def storage_enter(self):
|
||||
"""
|
||||
Pages:
|
||||
in: is_in_map, STORAGE_ENTER
|
||||
out: STORAGE_CHECK
|
||||
"""
|
||||
logger.info('Storage enter')
|
||||
while 1:
|
||||
if skip_first_screenshot:
|
||||
skip_first_screenshot = False
|
||||
else:
|
||||
self.device.screenshot()
|
||||
|
||||
for _ in self.loop():
|
||||
# End
|
||||
if self.is_in_storage():
|
||||
break
|
||||
@@ -53,11 +48,10 @@ class StorageHandler(GlobeOperation, ZoneManager):
|
||||
logger.info('Storage quit')
|
||||
self.ui_back(STORAGE_ENTER, offset=(200, 5), skip_first_screenshot=True)
|
||||
|
||||
def _storage_item_use(self, button, skip_first_screenshot=True):
|
||||
def _storage_item_use(self, button):
|
||||
"""
|
||||
Args:
|
||||
button (Button): Item
|
||||
skip_first_screenshot (bool):
|
||||
|
||||
Pages:
|
||||
in: STORAGE_CHECK
|
||||
@@ -72,12 +66,7 @@ class StorageHandler(GlobeOperation, ZoneManager):
|
||||
self.interval_clear(GET_ADAPTABILITY)
|
||||
self.interval_clear(GET_MISSION)
|
||||
|
||||
while 1:
|
||||
if skip_first_screenshot:
|
||||
skip_first_screenshot = False
|
||||
else:
|
||||
self.device.screenshot()
|
||||
|
||||
for _ in self.loop():
|
||||
# Accidentally clicked on an item, having popups for its info
|
||||
if self.appear(GET_MISSION, offset=True, interval=2):
|
||||
logger.info(f'_storage_item_use item info -> {GET_MISSION}')
|
||||
@@ -119,22 +108,14 @@ class StorageHandler(GlobeOperation, ZoneManager):
|
||||
if success and self.appear(STORAGE_CHECK, offset=(20, 20)):
|
||||
break
|
||||
|
||||
def storage_logger_use_all(self, skip_first_screenshot=True):
|
||||
def storage_logger_use_all(self):
|
||||
"""
|
||||
Args:
|
||||
skip_first_screenshot:
|
||||
|
||||
Pages:
|
||||
in: STORAGE_CHECK
|
||||
out: STORAGE_CHECK, scroll to bottom
|
||||
"""
|
||||
logger.hr('Storage logger use all')
|
||||
while 1:
|
||||
if skip_first_screenshot:
|
||||
skip_first_screenshot = False
|
||||
else:
|
||||
self.device.screenshot()
|
||||
|
||||
for _ in self.loop():
|
||||
if SCROLL_STORAGE.appear(main=self):
|
||||
SCROLL_STORAGE.set_bottom(main=self, skip_first_screenshot=True)
|
||||
|
||||
@@ -157,11 +138,8 @@ class StorageHandler(GlobeOperation, ZoneManager):
|
||||
if quit:
|
||||
self.storage_quit()
|
||||
|
||||
def storage_sample_use_all(self, skip_first_screenshot=True):
|
||||
def storage_sample_use_all(self):
|
||||
"""
|
||||
Args:
|
||||
skip_first_screenshot:
|
||||
|
||||
Pages:
|
||||
in: STORAGE_CHECK
|
||||
out: STORAGE_CHECK, scroll to bottom
|
||||
@@ -171,12 +149,7 @@ class StorageHandler(GlobeOperation, ZoneManager):
|
||||
TEMPLATE_STORAGE_QUALITY_OFFENSE, TEMPLATE_STORAGE_QUALITY_SURVIVAL, TEMPLATE_STORAGE_QUALITY_COMBAT
|
||||
]
|
||||
for sample_type in sample_types:
|
||||
while 1:
|
||||
if skip_first_screenshot:
|
||||
skip_first_screenshot = False
|
||||
else:
|
||||
self.device.screenshot()
|
||||
|
||||
for _ in self.loop():
|
||||
image = rgb2gray(self.device.image)
|
||||
items = sample_type.match_multi(image, similarity=0.75)
|
||||
logger.attr('Storage_sample', len(items))
|
||||
@@ -287,12 +260,11 @@ class StorageHandler(GlobeOperation, ZoneManager):
|
||||
"""
|
||||
self.ui_click(STORAGE_REPAIR_CANCEL, STORAGE_CHECK, retry_wait=2, skip_first_screenshot=True)
|
||||
|
||||
def _storage_coordinate_checkout(self, button, types=('OBSCURE',), skip_first_screenshot=True):
|
||||
def _storage_coordinate_checkout(self, button, types=('OBSCURE',)):
|
||||
"""
|
||||
Args:
|
||||
button (Button): Item
|
||||
types (tuple[str]):
|
||||
skip_first_screenshot (bool):
|
||||
|
||||
Pages:
|
||||
in: STORAGE_CHECK
|
||||
@@ -303,12 +275,7 @@ class StorageHandler(GlobeOperation, ZoneManager):
|
||||
STORAGE_COORDINATE_CHECKOUT
|
||||
])
|
||||
self.popup_interval_clear()
|
||||
while 1:
|
||||
if skip_first_screenshot:
|
||||
skip_first_screenshot = False
|
||||
else:
|
||||
self.device.screenshot()
|
||||
|
||||
for _ in self.loop():
|
||||
if self.appear(STORAGE_CHECK, offset=(30, 30), interval=5):
|
||||
self.device.click(button)
|
||||
continue
|
||||
@@ -346,12 +313,11 @@ class StorageHandler(GlobeOperation, ZoneManager):
|
||||
else:
|
||||
raise ScriptError(f'Unknown storage item: {item}')
|
||||
|
||||
def storage_checkout_item(self, item, skip_obscure_hazard_2=False, skip_first_screenshot=True):
|
||||
def storage_checkout_item(self, item, skip_obscure_hazard_2=False):
|
||||
"""
|
||||
Args:
|
||||
item (str): 'OBSCURE', 'ABYSSAL' or 'REPAIR_PACK'.
|
||||
skip_obscure_hazard_2: if skip hazard 2 obscure
|
||||
skip_first_screenshot:
|
||||
|
||||
Returns:
|
||||
bool: If checkout
|
||||
@@ -366,17 +332,12 @@ class StorageHandler(GlobeOperation, ZoneManager):
|
||||
if SCROLL_STORAGE.appear(main=self):
|
||||
if item == 'REPAIR_PACK':
|
||||
# repair packs always at the bottom page
|
||||
SCROLL_STORAGE.set_bottom(main=self, skip_first_screenshot=skip_first_screenshot)
|
||||
SCROLL_STORAGE.set_bottom(main=self)
|
||||
else:
|
||||
SCROLL_STORAGE.set_top(main=self, skip_first_screenshot=skip_first_screenshot)
|
||||
SCROLL_STORAGE.set_top(main=self)
|
||||
|
||||
confirm_timer = Timer(0.6, count=2).start()
|
||||
while 1:
|
||||
if skip_first_screenshot:
|
||||
skip_first_screenshot = False
|
||||
else:
|
||||
self.device.screenshot()
|
||||
|
||||
for _ in self.loop():
|
||||
image = rgb2gray(self.device.image)
|
||||
items = self._storage_item_to_template(item).match_multi(image, similarity=0.75)
|
||||
logger.attr(f'Storage_{item}', len(items))
|
||||
|
||||
Reference in New Issue
Block a user