mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-12 06:18:21 +08:00
Opt: OpsiObscure SkipHazard2Obscure
This commit is contained in:
@@ -82,6 +82,7 @@ TEMPLATE_STORAGE_ABYSSAL = Template(file={'cn': './assets/cn/os_handler/TEMPLATE
|
||||
TEMPLATE_STORAGE_COMBAT = Template(file={'cn': './assets/cn/os_handler/TEMPLATE_STORAGE_COMBAT.png', 'en': './assets/en/os_handler/TEMPLATE_STORAGE_COMBAT.png', 'jp': './assets/jp/os_handler/TEMPLATE_STORAGE_COMBAT.png', 'tw': './assets/tw/os_handler/TEMPLATE_STORAGE_COMBAT.png'})
|
||||
TEMPLATE_STORAGE_LOGGER = Template(file={'cn': './assets/cn/os_handler/TEMPLATE_STORAGE_LOGGER.gif', 'en': './assets/en/os_handler/TEMPLATE_STORAGE_LOGGER.gif', 'jp': './assets/jp/os_handler/TEMPLATE_STORAGE_LOGGER.gif', 'tw': './assets/tw/os_handler/TEMPLATE_STORAGE_LOGGER.gif'})
|
||||
TEMPLATE_STORAGE_OBSCURE = Template(file={'cn': './assets/cn/os_handler/TEMPLATE_STORAGE_OBSCURE.png', 'en': './assets/en/os_handler/TEMPLATE_STORAGE_OBSCURE.png', 'jp': './assets/jp/os_handler/TEMPLATE_STORAGE_OBSCURE.png', 'tw': './assets/tw/os_handler/TEMPLATE_STORAGE_OBSCURE.png'})
|
||||
TEMPLATE_STORAGE_OBSCURE_HAZARD_2 = Template(file={'cn': './assets/cn/os_handler/TEMPLATE_STORAGE_OBSCURE_HAZARD_2.png', 'en': './assets/cn/os_handler/TEMPLATE_STORAGE_OBSCURE_HAZARD_2.png', 'jp': './assets/cn/os_handler/TEMPLATE_STORAGE_OBSCURE_HAZARD_2.png', 'tw': './assets/cn/os_handler/TEMPLATE_STORAGE_OBSCURE_HAZARD_2.png'})
|
||||
TEMPLATE_STORAGE_OFFENSE = Template(file={'cn': './assets/cn/os_handler/TEMPLATE_STORAGE_OFFENSE.png', 'en': './assets/en/os_handler/TEMPLATE_STORAGE_OFFENSE.png', 'jp': './assets/jp/os_handler/TEMPLATE_STORAGE_OFFENSE.png', 'tw': './assets/tw/os_handler/TEMPLATE_STORAGE_OFFENSE.png'})
|
||||
TEMPLATE_STORAGE_QUALITY_COMBAT = Template(file={'cn': './assets/cn/os_handler/TEMPLATE_STORAGE_QUALITY_COMBAT.png', 'en': './assets/en/os_handler/TEMPLATE_STORAGE_QUALITY_COMBAT.png', 'jp': './assets/jp/os_handler/TEMPLATE_STORAGE_QUALITY_COMBAT.png', 'tw': './assets/tw/os_handler/TEMPLATE_STORAGE_QUALITY_COMBAT.png'})
|
||||
TEMPLATE_STORAGE_QUALITY_OFFENSE = Template(file={'cn': './assets/cn/os_handler/TEMPLATE_STORAGE_QUALITY_OFFENSE.png', 'en': './assets/en/os_handler/TEMPLATE_STORAGE_QUALITY_OFFENSE.png', 'jp': './assets/jp/os_handler/TEMPLATE_STORAGE_QUALITY_OFFENSE.png', 'tw': './assets/tw/os_handler/TEMPLATE_STORAGE_QUALITY_OFFENSE.png'})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from module.base.timer import Timer
|
||||
from module.base.utils import rgb2gray
|
||||
from module.base.utils import area_offset, crop, rgb2gray
|
||||
from module.combat.assets import GET_ITEMS_1, GET_ITEMS_2
|
||||
from module.exception import ScriptError
|
||||
from module.handler.assets import GET_MISSION
|
||||
@@ -233,10 +233,11 @@ class StorageHandler(GlobeOperation, ZoneManager):
|
||||
else:
|
||||
raise ScriptError(f'Unknown storage item: {item}')
|
||||
|
||||
def storage_checkout_item(self, item, skip_first_screenshot=True):
|
||||
def storage_checkout_item(self, item, skip_obscure_hazard_2=False, skip_first_screenshot=True):
|
||||
"""
|
||||
Args:
|
||||
item (str): 'OBSCURE' or 'ABYSSAL'.
|
||||
skip_obscure_hazard_2: if skip hazard 2 obscure
|
||||
skip_first_screenshot:
|
||||
|
||||
Returns:
|
||||
@@ -263,18 +264,25 @@ class StorageHandler(GlobeOperation, ZoneManager):
|
||||
logger.attr(f'Storage_{item}', len(items))
|
||||
|
||||
if len(items):
|
||||
self._storage_coordinate_checkout(items[0], types=(item,))
|
||||
for button in items:
|
||||
if skip_obscure_hazard_2:
|
||||
crop_image = crop(image, area_offset(button.area, (-25, -35)))
|
||||
if TEMPLATE_STORAGE_OBSCURE_HAZARD_2.match(crop_image, similarity=0.92):
|
||||
continue
|
||||
self._storage_coordinate_checkout(button, types=(item,))
|
||||
break
|
||||
return True
|
||||
if confirm_timer.reached():
|
||||
logger.info(f'No more {item} items in storage')
|
||||
self.storage_quit()
|
||||
return False
|
||||
|
||||
def storage_get_next_item(self, item, use_logger=True):
|
||||
def storage_get_next_item(self, item, use_logger=True, skip_obscure_hazard_2=False):
|
||||
"""
|
||||
Args:
|
||||
item (str): 'OBSCURE' or 'ABYSSAL'.
|
||||
use_logger: If use all loggers.
|
||||
skip_obscure_hazard_2: if skip hazard 2 obscure
|
||||
|
||||
Returns:
|
||||
bool: If checkout
|
||||
@@ -289,5 +297,5 @@ class StorageHandler(GlobeOperation, ZoneManager):
|
||||
if use_logger:
|
||||
self.storage_logger_use_all()
|
||||
|
||||
result = self.storage_checkout_item(item)
|
||||
result = self.storage_checkout_item(item, skip_obscure_hazard_2=skip_obscure_hazard_2)
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user