mirror of
https://github.com/0O0o0oOoO00/Alas.git
synced 2026-05-22 11:51:27 +08:00
Merge branch 'master_lme'
# Conflicts: # module/equipment/equipment.py
This commit is contained in:
@@ -108,8 +108,7 @@ class ActionPointHandler(UI, MapEventHandler):
|
||||
return self.appear(ACTION_POINT_USE, offset=(20, 20))
|
||||
|
||||
def is_current_ap_visible(self):
|
||||
return self.appear(CURRENT_AP_CHECK, offset=(40, 5)) \
|
||||
and CURRENT_AP_CHECK.match_appear_on(self.device.image, threshold=15)
|
||||
return self.match_template_color(CURRENT_AP_CHECK, offset=(40, 5), threshold=15)
|
||||
|
||||
def action_point_use(self, skip_first_screenshot=True):
|
||||
prev = self._action_point_current
|
||||
|
||||
@@ -10,7 +10,7 @@ class EnemySearchingHandler(EnemySearchingHandler_):
|
||||
def is_in_map(self):
|
||||
if IN_MAP.match_luma(self.device.image, offset=(200, 5)):
|
||||
return True
|
||||
if self.appear(MAP_GOTO_GLOBE_FOG, offset=(5, 5)) and MAP_GOTO_GLOBE_FOG.match_appear_on(self.device.image):
|
||||
if self.match_template_color(MAP_GOTO_GLOBE_FOG, offset=(5, 5)):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
from module.base.timer import Timer
|
||||
from module.combat.assets import *
|
||||
from module.exception import CampaignEnd
|
||||
from module.handler.assets import *
|
||||
from module.handler.assets import POPUP_CANCEL, POPUP_CONFIRM
|
||||
from module.logger import logger
|
||||
from module.os.assets import GLOBE_GOTO_MAP
|
||||
from module.os_handler.assets import *
|
||||
from module.os_handler.enemy_searching import EnemySearchingHandler
|
||||
from module.statistics.azurstats import DropImage
|
||||
from module.ui.assets import BACK_ARROW
|
||||
from module.ui.switch import Switch
|
||||
|
||||
|
||||
@@ -19,8 +20,8 @@ class FleetLockSwitch(Switch):
|
||||
|
||||
|
||||
fleet_lock = FleetLockSwitch('Fleet_Lock', offset=(10, 120))
|
||||
fleet_lock.add_status('on', check_button=OS_FLEET_LOCKED)
|
||||
fleet_lock.add_status('off', check_button=OS_FLEET_UNLOCKED)
|
||||
fleet_lock.add_state('on', check_button=OS_FLEET_LOCKED)
|
||||
fleet_lock.add_state('off', check_button=OS_FLEET_UNLOCKED)
|
||||
|
||||
|
||||
class MapEventHandler(EnemySearchingHandler):
|
||||
@@ -208,7 +209,6 @@ class MapEventHandler(EnemySearchingHandler):
|
||||
if drop:
|
||||
drop.handle_add(main=self, before=4)
|
||||
self.device.click(AUTO_SEARCH_REWARD)
|
||||
self.clicked = True
|
||||
self.interval_reset([
|
||||
AUTO_SEARCH_REWARD,
|
||||
AUTO_SEARCH_OS_MAP_OPTION_ON,
|
||||
@@ -225,6 +225,14 @@ class MapEventHandler(EnemySearchingHandler):
|
||||
# because of duplicated clicks and clicks to places outside the map
|
||||
confirm_timer.reset()
|
||||
continue
|
||||
# Donno why but it just entered storage, exit it anyway
|
||||
# Equivalent to is_in_storage, but can't inherit StorageHandler here
|
||||
# STORAGE_CHECK is a duplicate name, this is the os_handler/STORAGE_CHECK, not handler/STORAGE_CHECK
|
||||
if self.appear(STORAGE_CHECK, offset=(20, 20), interval=5):
|
||||
logger.info(f'{STORAGE_CHECK} -> {BACK_ARROW}')
|
||||
self.device.click(BACK_ARROW)
|
||||
confirm_timer.reset()
|
||||
continue
|
||||
|
||||
# End
|
||||
if self.is_in_map():
|
||||
@@ -244,14 +252,12 @@ class MapEventHandler(EnemySearchingHandler):
|
||||
Returns:
|
||||
bool: If clicked.
|
||||
"""
|
||||
if self.appear(AUTO_SEARCH_OS_MAP_OPTION_OFF, offset=(5, 120)) \
|
||||
and AUTO_SEARCH_OS_MAP_OPTION_OFF.match_appear_on(self.device.image):
|
||||
if self.match_template_color(AUTO_SEARCH_OS_MAP_OPTION_OFF, offset=(5, 120)):
|
||||
if self.info_bar_count() >= 2:
|
||||
self.device.screenshot_interval_set()
|
||||
self.os_auto_search_quit(drop=drop)
|
||||
raise CampaignEnd
|
||||
if self.appear(AUTO_SEARCH_OS_MAP_OPTION_OFF_DISABLED, offset=(5, 120)) \
|
||||
and AUTO_SEARCH_OS_MAP_OPTION_OFF_DISABLED.match_appear_on(self.device.image):
|
||||
if self.match_template_color(AUTO_SEARCH_OS_MAP_OPTION_OFF_DISABLED, offset=(5, 120)):
|
||||
if self.info_bar_count() >= 2:
|
||||
self.device.screenshot_interval_set()
|
||||
self.os_auto_search_quit(drop=drop)
|
||||
@@ -268,20 +274,17 @@ class MapEventHandler(EnemySearchingHandler):
|
||||
if enable is None:
|
||||
pass
|
||||
elif enable:
|
||||
if self.appear(AUTO_SEARCH_OS_MAP_OPTION_OFF, offset=(5, 120), interval=3) \
|
||||
and AUTO_SEARCH_OS_MAP_OPTION_OFF.match_appear_on(self.device.image):
|
||||
if self.match_template_color(AUTO_SEARCH_OS_MAP_OPTION_OFF, offset=(5, 120), interval=3):
|
||||
self.device.click(AUTO_SEARCH_OS_MAP_OPTION_OFF)
|
||||
self.interval_reset(AUTO_SEARCH_OS_MAP_OPTION_OFF_DISABLED)
|
||||
return True
|
||||
# Game client bugged sometimes, AUTO_SEARCH_OS_MAP_OPTION_OFF grayed out but still functional
|
||||
if self.appear(AUTO_SEARCH_OS_MAP_OPTION_OFF_DISABLED, offset=(5, 120), interval=3) \
|
||||
and AUTO_SEARCH_OS_MAP_OPTION_OFF_DISABLED.match_appear_on(self.device.image):
|
||||
if self.match_template_color(AUTO_SEARCH_OS_MAP_OPTION_OFF_DISABLED, offset=(5, 120), interval=3):
|
||||
self.device.click(AUTO_SEARCH_OS_MAP_OPTION_OFF_DISABLED)
|
||||
self.interval_reset(AUTO_SEARCH_OS_MAP_OPTION_OFF)
|
||||
return True
|
||||
else:
|
||||
if self.appear(AUTO_SEARCH_OS_MAP_OPTION_ON, offset=(5, 120), interval=3) \
|
||||
and AUTO_SEARCH_OS_MAP_OPTION_ON.match_appear_on(self.device.image):
|
||||
if self.match_template_color(AUTO_SEARCH_OS_MAP_OPTION_ON, offset=(5, 120), interval=3):
|
||||
self.device.click(AUTO_SEARCH_OS_MAP_OPTION_ON)
|
||||
return True
|
||||
|
||||
@@ -303,7 +306,7 @@ class MapEventHandler(EnemySearchingHandler):
|
||||
|
||||
if enable is None:
|
||||
enable = self.config.Campaign_UseFleetLock
|
||||
status = 'on' if enable else 'off'
|
||||
changed = fleet_lock.set(status=status, main=self)
|
||||
state = 'on' if enable else 'off'
|
||||
changed = fleet_lock.set(state, main=self)
|
||||
|
||||
return changed
|
||||
|
||||
@@ -81,15 +81,13 @@ class MissionHandler(GlobeOperation, ZoneManager):
|
||||
# End
|
||||
if self.is_in_os_mission() \
|
||||
and not self.appear(MISSION_FINISH, offset=(20, 20)) \
|
||||
and not (self.appear(MISSION_CHECKOUT, offset=(20, 20))
|
||||
and MISSION_CHECKOUT.match_appear_on(self.device.image)):
|
||||
and not self.match_template_color(MISSION_CHECKOUT, offset=(20, 20)):
|
||||
# No mission found, wait to confirm. Missions might not be loaded so fast.
|
||||
if confirm_timer.reached():
|
||||
logger.info('No OS mission found.')
|
||||
break
|
||||
elif self.is_in_os_mission() \
|
||||
and (self.appear(MISSION_CHECKOUT, offset=(20, 20))
|
||||
and MISSION_CHECKOUT.match_appear_on(self.device.image)):
|
||||
and self.match_template_color(MISSION_CHECKOUT, offset=(20, 20)):
|
||||
# Found one mission.
|
||||
logger.info('Found at least one OS missions.')
|
||||
break
|
||||
@@ -119,8 +117,7 @@ class MissionHandler(GlobeOperation, ZoneManager):
|
||||
logger.info('Monthly BOSS mission found, checking missions bellow it')
|
||||
checkout_offset = (-20, 100, 20, 150)
|
||||
|
||||
if not (self.appear(MISSION_CHECKOUT, offset=checkout_offset)
|
||||
and MISSION_CHECKOUT.match_appear_on(self.device.image)):
|
||||
if not self.match_template_color(MISSION_CHECKOUT, offset=checkout_offset):
|
||||
# If not having enough items to claim a mission,
|
||||
# there will still be MISSION_CHECKOUT, but button is transparent.
|
||||
# So here needs to use both template matching and color detection.
|
||||
|
||||
@@ -17,7 +17,7 @@ from module.log_res.log_res import LogRes
|
||||
if server.server != 'jp':
|
||||
OCR_SHOP_YELLOW_COINS = Digit(SHOP_YELLOW_COINS, letter=(239, 239, 239), threshold=160, name='OCR_SHOP_YELLOW_COINS')
|
||||
else:
|
||||
OCR_SHOP_YELLOW_COINS = Digit(SHOP_YELLOW_COINS, letter=(193, 193, 193), threshold=200, name='OCR_SHOP_YELLOW_COINS')
|
||||
OCR_SHOP_YELLOW_COINS = Digit(SHOP_YELLOW_COINS, letter=(201, 201, 201), threshold=200, name='OCR_SHOP_YELLOW_COINS')
|
||||
OCR_SHOP_PURPLE_COINS = Digit(SHOP_PURPLE_COINS, letter=(255, 255, 255), name='OCR_SHOP_PURPLE_COINS')
|
||||
OCR_OS_SHOP_PURPLE_COINS = Digit(OS_SHOP_PURPLE_COINS, letter=(255, 255, 255), name='OCR_OS_SHOP_PURPLE_COINS')
|
||||
|
||||
|
||||
@@ -25,8 +25,7 @@ class StrategicSearchHandler(MapEventHandler):
|
||||
continue
|
||||
if self.appear(AUTO_SEARCH_REWARD, offset=(50, 50)):
|
||||
continue
|
||||
if self.appear(STRATEGIC_SEARCH_MAP_OPTION_OFF, offset=(20, 20), interval=2) \
|
||||
and STRATEGIC_SEARCH_MAP_OPTION_OFF.match_appear_on(self.device.image):
|
||||
if self.match_template_color(STRATEGIC_SEARCH_MAP_OPTION_OFF, offset=(20, 20), interval=2):
|
||||
self.device.click(STRATEGIC_SEARCH_MAP_OPTION_OFF)
|
||||
self.device.sleep(1)
|
||||
'''
|
||||
@@ -110,7 +109,7 @@ class StrategicSearchHandler(MapEventHandler):
|
||||
else:
|
||||
self.device.screenshot()
|
||||
|
||||
self.appear(STRATEGIC_SEARCH_DEVICE_CHECK, offset=(20, 200), threshold=0.7)
|
||||
self.appear(STRATEGIC_SEARCH_DEVICE_CHECK, offset=(20, 200), similarity=0.7)
|
||||
STRATEGIC_SEARCH_DEVICE_STOP.load_offset(STRATEGIC_SEARCH_DEVICE_CHECK)
|
||||
STRATEGIC_SEARCH_DEVICE_CONTINUE.load_offset(STRATEGIC_SEARCH_DEVICE_CHECK)
|
||||
|
||||
@@ -135,7 +134,7 @@ class StrategicSearchHandler(MapEventHandler):
|
||||
else:
|
||||
self.device.screenshot()
|
||||
|
||||
self.appear(STRATEGIC_SEARCH_SUBMIT_CHECK, offset=(20, 20), threshold=0.7)
|
||||
self.appear(STRATEGIC_SEARCH_SUBMIT_CHECK, offset=(20, 20), similarity=0.7)
|
||||
STRATEGIC_SEARCH_SUBMIT_OFF.load_offset(STRATEGIC_SEARCH_SUBMIT_CHECK)
|
||||
STRATEGIC_SEARCH_SUBMIT_ON.load_offset(STRATEGIC_SEARCH_SUBMIT_CHECK)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user