1
0
mirror of https://github.com/sui-feng-cb/AzurLaneAutoScript1.git synced 2026-07-23 06:06:16 +08:00

Add: asset for Akashi grid overlap avoidance

This commit is contained in:
positnuec
2026-07-22 07:11:30 +08:00
parent afb43ec892
commit 26f8f112f5
3 changed files with 6 additions and 9 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@@ -16,16 +16,12 @@ from module.os.fleet import OSFleet, BossFleet
from module.os.globe_camera import GlobeCamera
from module.os.globe_operation import RewardUncollectedError
from module.os_handler.assets import AUTO_SEARCH_OS_MAP_OPTION_OFF, AUTO_SEARCH_OS_MAP_OPTION_OFF_DISABLED, \
AUTO_SEARCH_OS_MAP_OPTION_ON, AUTO_SEARCH_REWARD
AUTO_SEARCH_OS_MAP_OPTION_ON, AUTO_SEARCH_REWARD, MAP_OPTIONS_AREA
from module.os_handler.storage import StorageHandler
from module.os_handler.strategic import StrategicSearchHandler
from module.ui.assets import GOTO_MAIN
from module.ui.page import page_os
# UI button area where clicking may trigger UI buttons instead of fleet movement
# To be replaced with an asset in the future
OS_UI_BUTTON_AREA = (1170, 455, 1280, 720)
class OSMap(OSFleet, Map, GlobeCamera, StorageHandler, StrategicSearchHandler):
def os_init(self):
@@ -1021,7 +1017,7 @@ class OSMap(OSFleet, Map, GlobeCamera, StorageHandler, StrategicSearchHandler):
Args:
drop:
_ui_avoid_count (int): Internal counter for UI button area avoidance attempts
_ui_avoid_count (int): Internal counter for map options area avoidance attempts
Returns:
bool: If solved a map random event
@@ -1043,9 +1039,9 @@ class OSMap(OSFleet, Map, GlobeCamera, StorageHandler, StrategicSearchHandler):
logger.info(f'Found Akashi on {grid}')
fleet = self.convert_radar_to_local((0, 0))
if fleet.distance_to(grid) > 1:
# Avoid clicking grid that overlaps with UI button area
if _ui_avoid_count < 3 and area_cross_area(grid.button, OS_UI_BUTTON_AREA, threshold=0):
logger.info(f'Akashi grid {grid} overlaps with UI button area, swipe camera to avoid')
# Avoid clicking grid that overlaps with map options area
if _ui_avoid_count < 3 and area_cross_area(grid.button, MAP_OPTIONS_AREA.area, threshold=0):
logger.info(f'Akashi grid {grid} overlaps with map options area, swipe camera to avoid')
vector = np.array(grid.location) - np.array(fleet.location)
vector = tuple((vector // 2).astype(int))
self.map_swipe(vector)

View File

@@ -23,6 +23,7 @@ GET_MEOWFFICER_ITEMS_1 = Button(area={'cn': (558, 211, 730, 242), 'en': (550, 21
GET_MEOWFFICER_ITEMS_2 = Button(area={'cn': (558, 140, 730, 171), 'en': (550, 140, 723, 176), 'jp': (538, 146, 731, 182), 'tw': (558, 140, 730, 171)}, color={'cn': (186, 200, 231), 'en': (165, 191, 242), 'jp': (143, 179, 249), 'tw': (186, 200, 231)}, button={'cn': (558, 140, 730, 171), 'en': (550, 140, 723, 176), 'jp': (538, 146, 731, 182), 'tw': (558, 140, 730, 171)}, file={'cn': './assets/cn/os_handler/GET_MEOWFFICER_ITEMS_2.png', 'en': './assets/en/os_handler/GET_MEOWFFICER_ITEMS_2.png', 'jp': './assets/jp/os_handler/GET_MEOWFFICER_ITEMS_2.png', 'tw': './assets/tw/os_handler/GET_MEOWFFICER_ITEMS_2.png'})
IN_MAP = Button(area={'cn': (925, 644, 986, 674), 'en': (923, 660, 978, 674), 'jp': (926, 645, 985, 674), 'tw': (925, 645, 986, 674)}, color={'cn': (244, 212, 159), 'en': (247, 227, 200), 'jp': (241, 211, 160), 'tw': (244, 212, 160)}, button={'cn': (925, 644, 986, 674), 'en': (923, 660, 978, 674), 'jp': (926, 645, 985, 674), 'tw': (925, 645, 986, 674)}, file={'cn': './assets/cn/os_handler/IN_MAP.png', 'en': './assets/en/os_handler/IN_MAP.png', 'jp': './assets/jp/os_handler/IN_MAP.png', 'tw': './assets/tw/os_handler/IN_MAP.png'})
MAP_ARCHIVES = Button(area={'cn': (1180, 353, 1280, 411), 'en': (1212, 391, 1280, 411), 'jp': (1180, 353, 1280, 411), 'tw': (1180, 353, 1280, 411)}, color={'cn': (134, 255, 255), 'en': (134, 255, 255), 'jp': (134, 255, 255), 'tw': (134, 255, 255)}, button={'cn': (1180, 353, 1280, 411), 'en': (1212, 391, 1280, 411), 'jp': (1180, 353, 1280, 411), 'tw': (1180, 353, 1280, 411)}, file={'cn': './assets/cn/os_handler/MAP_ARCHIVES.png', 'en': './assets/en/os_handler/MAP_ARCHIVES.png', 'jp': './assets/jp/os_handler/MAP_ARCHIVES.png', 'tw': './assets/tw/os_handler/MAP_ARCHIVES.png'})
MAP_OPTIONS_AREA = Button(area={'cn': (1171, 455, 1280, 636), 'en': (1171, 455, 1280, 636), 'jp': (1171, 455, 1280, 636), 'tw': (1171, 455, 1280, 636)}, color={'cn': (99, 118, 135), 'en': (99, 118, 135), 'jp': (99, 118, 135), 'tw': (99, 118, 135)}, button={'cn': (1171, 455, 1280, 636), 'en': (1171, 455, 1280, 636), 'jp': (1171, 455, 1280, 636), 'tw': (1171, 455, 1280, 636)}, file={'cn': './assets/cn/os_handler/MAP_OPTIONS_AREA.png', 'en': './assets/cn/os_handler/MAP_OPTIONS_AREA.png', 'jp': './assets/cn/os_handler/MAP_OPTIONS_AREA.png', 'tw': './assets/cn/os_handler/MAP_OPTIONS_AREA.png'})
MAP_WORLD = Button(area={'cn': (943, 499, 1048, 512), 'en': (943, 499, 1048, 512), 'jp': (943, 499, 1048, 512), 'tw': (943, 499, 1048, 512)}, color={'cn': (71, 74, 83), 'en': (71, 74, 83), 'jp': (71, 74, 83), 'tw': (71, 74, 83)}, button={'cn': (578, 675, 702, 691), 'en': (578, 675, 702, 691), 'jp': (578, 675, 702, 691), 'tw': (578, 675, 702, 692)}, file={'cn': './assets/cn/os_handler/MAP_WORLD.png', 'en': './assets/en/os_handler/MAP_WORLD.png', 'jp': './assets/jp/os_handler/MAP_WORLD.png', 'tw': './assets/tw/os_handler/MAP_WORLD.png'})
MISSION_CHECK = Button(area={'cn': (120, 122, 229, 148), 'en': (120, 125, 323, 147), 'jp': (119, 121, 230, 148), 'tw': (119, 121, 230, 149)}, color={'cn': (145, 153, 187), 'en': (139, 148, 184), 'jp': (131, 142, 180), 'tw': (143, 153, 187)}, button={'cn': (120, 122, 229, 148), 'en': (120, 125, 323, 147), 'jp': (119, 121, 230, 148), 'tw': (119, 121, 230, 149)}, file={'cn': './assets/cn/os_handler/MISSION_CHECK.png', 'en': './assets/en/os_handler/MISSION_CHECK.png', 'jp': './assets/jp/os_handler/MISSION_CHECK.png', 'tw': './assets/tw/os_handler/MISSION_CHECK.png'})
MISSION_CHECKOUT = Button(area={'cn': (1026, 204, 1114, 234), 'en': (1029, 205, 1112, 232), 'jp': (1026, 204, 1114, 234), 'tw': (1026, 204, 1114, 234)}, color={'cn': (152, 153, 156), 'en': (153, 154, 158), 'jp': (157, 158, 161), 'tw': (152, 153, 156)}, button={'cn': (1026, 204, 1114, 234), 'en': (1029, 205, 1112, 232), 'jp': (1026, 204, 1114, 234), 'tw': (1026, 204, 1114, 234)}, file={'cn': './assets/cn/os_handler/MISSION_CHECKOUT.png', 'en': './assets/en/os_handler/MISSION_CHECKOUT.png', 'jp': './assets/jp/os_handler/MISSION_CHECKOUT.png', 'tw': './assets/tw/os_handler/MISSION_CHECKOUT.png'})