Closed RuaBQ closed 1 month ago
1_1_affinity_farming 在<<< MAP INIT >>> 过程中,在 module.map_detection.view.py 的 load函数中,大概率 # Find local view center 出错,小概率正常 后排为竞技神/突击者
报错如上所示
正常的log 2024-07-26 01:06:58.463 | INFO | <<< MAP INIT >>> 2024-07-26 01:06:58.463 | INFO | Load map_data, has_loop=False, use_loop=False 2024-07-26 01:06:58.464 | INFO | Load spawn_data, has_loop=False, use_loop=False 2024-07-26 01:06:58.465 | INFO | grid_connection: wall=False, portal=False 2024-07-26 01:06:58.465 | INFO | Load mechanism, land_base=False, maze=False, fortress=False, bouncing_enemy=False 2024-07-26 01:06:58.630 | INFO | vanish_point: ( 635, -1836) 2024-07-26 01:06:58.631 | INFO | distant_point: (-2322, -1836) 2024-07-26 01:06:58.637 | INFO | Horizontal coincident point unexpected: [-282.56585874 132.2788036 ] 2024-07-26 01:06:58.645 | INFO | 0.074s _ Horizontal: 2 (5 inner, 2 edge) 2024-07-26 01:06:58.646 | INFO | Edges: /_\ Vertical: 8 (6 inner, 2 edge) 2024-07-26 01:06:58.647 | INFO | [homo_storage] ((7, 1), [(214.554, 268.109), (1081.531, 268.109), (195.683, 362.522), (1101.546, 362.522)]) 2024-07-26 01:06:58.677 | INFO | tile_center: 0.560 (bad match) 2024-07-26 01:06:58.785 | INFO | tile_corner: 0.930 (8 matches) 2024-07-26 01:06:58.793 | INFO | 0.145s _ edge_lines: 2 hori, 2 vert 2024-07-26 01:06:58.793 | INFO | Edges: /_\ homo_loca: ( 30, 92) 2024-07-26 01:06:58.795 | INFO | center_loca: (3, 0) 2024-07-26 01:06:58.796 | INFO | [view.center_offset] [0.41823634 0.93980731] 2024-07-26 01:06:58.796 | INFO | camera_corrected: A1 -> D1 2024-07-26 01:06:58.797 | INFO | Camera: D1 2024-07-26 01:06:58.878 | INFO | 0.082s predict: 7 2024-07-26 01:06:58.881 | INFO | Fl -- -- -- -- 1E -- 2024-07-26 01:06:58.882 | INFO | Fleet set to 1 2024-07-26 01:06:58.888 | INFO | Fleet: 1, fleet_current_index: 1 2024-07-26 01:06:58.901 | INFO | [Map_buff] line_ahead 2024-07-26 01:06:58.902 | INFO | Skip strategy bar check. 2024-07-26 01:06:58.904 | INFO | [HP] 98% ____ ____ 98% ____ ____ 2024-07-26 01:06:58.905 | INFO | Ensure edge in sight. 2024-07-26 01:06:58.906 | INFO | Full scan start, mode=normal 2024-07-26 01:06:58.906 | INFO | [enemy_missing] EN: 1, MY: 0, SI: 0, BO: 0, CA: 0 2024-07-26 01:06:58.907 | INFO | [enemy_may____] EN: 0, MY: 0, SI: 0, BO: 0, CA: 0 2024-07-26 01:06:58.908 | INFO | Focus to: D1 错误的log 2024-07-26 01:09:35.313 | INFO | <<< MAP INIT >>> 2024-07-26 01:09:35.317 | INFO | Load map_data, has_loop=False, use_loop=False 2024-07-26 01:09:35.321 | INFO | Load spawn_data, has_loop=False, use_loop=False 2024-07-26 01:09:35.326 | INFO | grid_connection: wall=False, portal=False 2024-07-26 01:09:35.331 | INFO | Load mechanism, land_base=False, maze=False, fortress=False, bouncing_enemy=False 2024-07-26 01:09:35.674 | INFO | vanish_point: ( 635, -1836) 2024-07-26 01:09:35.679 | INFO | distant_point: (-2562, -1836) 2024-07-26 01:09:35.707 | INFO | 0.214s _ Horizontal: 2 (5 inner, 2 edge) 2024-07-26 01:09:35.712 | INFO | Edges: /_\ Vertical: 8 (6 inner, 2 edge) 2024-07-26 01:09:35.717 | INFO | [homo_storage] ((7, 1), [(213.643, 272.67), (1082.498, 272.67), (196.245, 359.714), (1100.951, 359.714)]) 2024-07-26 01:09:35.783 | INFO | tile_center: 0.939 (good match) 2024-07-26 01:09:35.793 | INFO | 0.059s _ edge_lines: 2 hori, 2 vert 2024-07-26 01:09:35.798 | INFO | Edges: /_\ homo_loca: ( 29, 126) 2024-07-26 01:09:35.804 | INFO | center_loca: (3, 1) 2024-07-26 01:09:35.839 | WARNING | Camera outside map: offset=(0, 1) 2024-07-26 01:09:35.844 | INFO | Swipe ( 983, 360) -> ( 983, 455) 2024-07-26 01:09:36.061 | WARNING | Camera.update(wait_swipe=True) but camera has no _prev_view 2024-07-26 01:09:36.066 | INFO | [prev.center_offset] None 2024-07-26 01:09:36.256 | INFO | tile_center: 0.918 (good match) 2024-07-26 01:09:36.266 | INFO | 0.049s _ edge_lines: 3 hori, 2 vert 2024-07-26 01:09:36.270 | INFO | Edges: /_\ homo_loca: ( 28, 133) 2024-07-26 01:09:36.276 | INFO | center_loca: (3, 0) 2024-07-26 01:09:36.281 | INFO | [view.center_offset] [ 0.43859832 -0.04338542] 2024-07-26 01:09:36.286 | ERROR | TypeError: unsupported operand type(s) for -: 'float' and 'NoneType' ╭───────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────╮ │ │ │ d:\AzurLaneAutoScript\module\map\camera.py:120 in _update_view │ │ │ │ 117 │ │ │ │ │ and not self.is_in_strategy_mob_move(): │ │ 118 │ │ │ │ logger.warning('Image to detect is not in_map') │ │ 119 │ │ │ │ raise MapDetectionError('Image to detect is not in_map') │ │ ❱ 120 │ │ │ self.view.load(self.device.image) │ │ 121 │ │ except MapDetectionError as e: │ │ 122 │ │ │ if self.info_bar_count(): │ │ 123 │ │ │ │ logger.warning('Perspective error caused by info bar') │ │ │ │ ╭─────────────────────────────────────────────── locals ────────────────────────────────────────────────╮ │ │ │ self = <campaign.campaign_main.campaign_1_1_affinity_farming.Campaign object at 0x000002C6D630DBE0> │ │ │ │ string = 'Camera outside map: offset=(0, 1)' │ │ │ │ x = '0' │ │ │ │ y = ' 1' │ │ │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ d:\AzurLaneAutoScript\module\map_detection\view.py:97 in load │ │ │ │ 94 │ │ │ │ x = max(self.center_loca[0] - self.shape[0], 0) if self.center_loca[0] > │ │ 0 else self.center_loca[0] │ │ 95 │ │ │ │ y = max(self.center_loca[1] - self.shape[1], 0) if self.center_loca[1] > │ │ 0 else self.center_loca[1] │ │ 96 │ │ │ │ self.center_offset = offset - self.center_loca │ │ ❱ 97 │ │ │ │ raise MapDetectionError(f'Camera outside map: offset=({x}, {y})') │ │ 98 │ │ │ break │ │ 99 │ │ │ 100 │ def predict(self): │ │ │ │ ╭───────────────────────────────────────────── locals ─────────────────────────────────────────────╮ │ │ │ __class__ = <class 'module.map_detection.view.View'> │ │ │ │ grid = A1 │ │ │ │ grids = {(0, 0): A1, (1, 0): B1, (2, 0): C1, (3, 0): D1, (4, 0): E1, (5, 0): F1, (6, 0): G1} │ │ │ │ image = array([[[0, 0, 0], │ │ │ │ │ │ [0, 0, 0], │ │ │ │ │ │ [0, 0, 0], │ │ │ │ │ │ ..., │ │ │ │ │ │ [0, 0, 0], │ │ │ │ │ │ [0, 0, 0], │ │ │ │ │ │ [0, 0, 0]], │ │ │ │ │ │ │ │ │ │ [[0, 0, 0], │ │ │ │ │ │ [0, 0, 0], │ │ │ │ │ │ [0, 0, 0], │ │ │ │ │ │ ..., │ │ │ │ │ │ [0, 0, 0], │ │ │ │ │ │ [0, 0, 0], │ │ │ │ │ │ [0, 0, 0]], │ │ │ │ │ │ │ │ │ │ [[0, 0, 0], │ │ │ │ │ │ [0, 0, 0], │ │ │ │ │ │ [0, 0, 0], │ │ │ │ │ │ ..., │ │ │ │ │ │ [0, 0, 0], │ │ │ │ │ │ [0, 0, 0], │ │ │ │ │ │ [0, 0, 0]], │ │ │ │ │ │ │ │ │ │ ..., │ │ │ │ │ │ │ │ │ │ [[0, 0, 0], │ │ │ │ │ │ [0, 0, 0], │ │ │ │ │ │ [0, 0, 0], │ │ │ │ │ │ ..., │ │ │ │ │ │ [0, 0, 0], │ │ │ │ │ │ [0, 0, 0], │ │ │ │ │ │ [0, 0, 0]], │ │ │ │ │ │ │ │ │ │ [[0, 0, 0], │ │ │ │ │ │ [0, 0, 0], │ │ │ │ │ │ [0, 0, 0], │ │ │ │ │ │ ..., │ │ │ │ │ │ [0, 0, 0], │ │ │ │ │ │ [0, 0, 0], │ │ │ │ │ │ [0, 0, 0]], │ │ │ │ │ │ │ │ │ │ [[0, 0, 0], │ │ │ │ │ │ [0, 0, 0], │ │ │ │ │ │ [0, 0, 0], │ │ │ │ │ │ ..., │ │ │ │ │ │ [0, 0, 0], │ │ │ │ │ │ [0, 0, 0], │ │ │ │ │ │ [0, 0, 0]]], dtype=uint8) │ │ │ │ loca = (0, 0) │ │ │ │ offset = array([3, 1]) │ │ │ │ points = array([[648.85642404, 359.4004825 ], │ │ │ │ │ [519.63112754, 359.4004825 ], │ │ │ │ │ [583.16871426, 405.65955127], │ │ │ │ │ [585.27538124, 315.01129531]]) │ │ │ │ self = <module.map_detection.view.View object at 0x000002C6864C57F0> │ │ │ │ x = 0 │ │ │ │ y = 1 │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ MapDetectionError: Camera outside map: offset=(0, 1) During handling of the above exception, another exception occurred: ╭───────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────╮ │ │ │ d:\AzurLaneAutoScript\alas.py:69 in run │ │ │ │ 66 │ │ try: │ │ 67 │ │ │ if not skip_first_screenshot: │ │ 68 │ │ │ │ self.device.screenshot() │ │ ❱ 69 │ │ │ self.__getattribute__(command)() │ │ 70 │ │ │ return True │ │ 71 │ │ except TaskEnd: │ │ 72 │ │ │ return True │ │ │ │ ╭──────────────────────────────────────────── locals ────────────────────────────────────────────╮ │ │ │ command = 'main3' │ │ │ │ e = TypeError("unsupported operand type(s) for -: 'float' and 'NoneType'") │ │ │ │ self = <__main__.AzurLaneAutoScript object at 0x000002C6A3C31AC0> │ │ │ │ skip_first_screenshot = False │ │ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ d:\AzurLaneAutoScript\alas.py:353 in main3 │ │ │ │ 350 │ │ │ 351 │ def main3(self): │ │ 352 │ │ from module.campaign.run import CampaignRun │ │ ❱ 353 │ │ CampaignRun(config=self.config, device=self.device).run( │ │ 354 │ │ │ name=self.config.Campaign_Name, folder=self.config.Campaign_Event, │ │ mode=self.config.Campaign_Mode) │ │ 355 │ │ │ 356 │ def event(self): │ │ │ │ ╭───────────────────────────────── locals ─────────────────────────────────╮ │ │ │ CampaignRun = <class 'module.campaign.run.CampaignRun'> │ │ │ │ self = <__main__.AzurLaneAutoScript object at 0x000002C6A3C31AC0> │ │ │ ╰──────────────────────────────────────────────────────────────────────────╯ │ │ │ │ d:\AzurLaneAutoScript\module\campaign\run.py:387 in run │ │ │ │ 384 │ │ │ self.device.stuck_record_clear() │ │ 385 │ │ │ self.device.click_record_clear() │ │ 386 │ │ │ try: │ │ ❱ 387 │ │ │ │ self.campaign.run() │ │ 388 │ │ │ except ScriptEnd as e: │ │ 389 │ │ │ │ logger.hr('Script end') │ │ 390 │ │ │ │ logger.info(str(e)) │ │ │ │ ╭──────────────────────────────── locals ─────────────────────────────────╮ │ │ │ folder = 'campaign_main' │ │ │ │ mode = 'normal' │ │ │ │ name = 'campaign_1_1_affinity_farming' │ │ │ │ self = <module.campaign.run.CampaignRun object at 0x000002C6D563AE20> │ │ │ │ total = 0 │ │ │ ╰─────────────────────────────────────────────────────────────────────────╯ │ │ │ │ d:\AzurLaneAutoScript\module\campaign\campaign_base.py:130 in run │ │ │ │ 127 │ │ # Map init │ │ 128 │ │ if not self.map_is_auto_search: │ │ 129 │ │ │ self.handle_map_fleet_lock() │ │ ❱ 130 │ │ │ self.map_init(self.MAP) │ │ 131 │ │ else: │ │ 132 │ │ │ self.map = self.MAP │ │ 133 │ │ │ self.battle_count = 0 │ │ │ │ ╭────────────────────────────────────────────── locals ───────────────────────────────────────────────╮ │ │ │ self = <campaign.campaign_main.campaign_1_1_affinity_farming.Campaign object at 0x000002C6D630DBE0> │ │ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ d:\AzurLaneAutoScript\module\map\fleet.py:836 in map_init │ │ │ │ 833 │ │ """ │ │ 834 │ │ logger.hr('Map init') │ │ 835 │ │ self.map_data_init(map_) │ │ ❱ 836 │ │ self.map_control_init() │ │ 837 │ │ │ 838 │ def map_data_init(self, map_): │ │ 839 │ │ """ │ │ │ │ ╭────────────────────────────────────────────── locals ───────────────────────────────────────────────╮ │ │ │ map_ = <module.map.map_base.CampaignMap object at 0x000002C6D6197DF0> │ │ │ │ self = <campaign.campaign_main.campaign_1_1_affinity_farming.Campaign object at 0x000002C6D630DBE0> │ │ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ d:\AzurLaneAutoScript\module\map\fleet.py:877 in map_control_init │ │ │ │ 874 │ │ Preparation before operations. │ │ 875 │ │ Such as select strategy, calculate hp and level, init camera position, do first │ │ map scan. │ │ 876 │ │ """ │ │ ❱ 877 │ │ self.update() │ │ 878 │ │ if not self.handle_fleet_reverse(): │ │ 879 │ │ │ self.fleet_set(index=1) │ │ 880 │ │ self.handle_strategy(index=self.fleet_show_index) │ │ │ │ ╭────────────────────────────────────────────── locals ───────────────────────────────────────────────╮ │ │ │ self = <campaign.campaign_main.campaign_1_1_affinity_farming.Campaign object at 0x000002C6D630DBE0> │ │ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ d:\AzurLaneAutoScript\module\map\camera.py:301 in update │ │ │ │ 298 │ │ │ │ │ 299 │ │ │ # _update_view() │ │ 300 │ │ │ try: │ │ ❱ 301 │ │ │ │ success = self._update_view() │ │ 302 │ │ │ │ if not success: │ │ 303 │ │ │ │ │ continue │ │ 304 │ │ │ │ logger.attr('view.center_offset', self.view.center_offset) │ │ │ │ ╭──────────────────────────────────────────────────── locals ─────────────────────────────────────────────────────╮ │ │ │ allow_error = False │ │ │ │ camera = True │ │ │ │ error_confirm = Timer(limit=2.041/5, count=0/10) │ │ │ │ is_grid_center = <function Camera.update.<locals>.is_grid_center at 0x000002C686492C10> │ │ │ │ is_still_prev = <function Camera.update.<locals>.is_still_prev at 0x000002C686492D30> │ │ │ │ prev_center_offset = None │ │ │ │ self = <campaign.campaign_main.campaign_1_1_affinity_farming.Campaign object at │ │ │ │ 0x000002C6D630DBE0> │ │ │ │ swipe_wait_timeout = Timer(limit=2.041/0.35, count=1/1) │ │ │ │ swiped = True │ │ │ │ wait_swipe = False │ │ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ d:\AzurLaneAutoScript\module\map\camera.py:204 in _update_view │ │ │ │ 201 │ │ │ │ string = str(e) │ │ 202 │ │ │ │ logger.warning(string) │ │ 203 │ │ │ │ x, y = string.split('=')[1].strip('() ').split(',') │ │ ❱ 204 │ │ │ │ self._map_swipe((-int(x.strip()), -int(y.strip()))) │ │ 205 │ │ │ # Finally check if game is alive │ │ 206 │ │ │ elif not self.device.app_is_running(): │ │ 207 │ │ │ │ logger.error('Trying to update camera but game died') │ │ │ │ ╭─────────────────────────────────────────────── locals ────────────────────────────────────────────────╮ │ │ │ self = <campaign.campaign_main.campaign_1_1_affinity_farming.Campaign object at 0x000002C6D630DBE0> │ │ │ │ string = 'Camera outside map: offset=(0, 1)' │ │ │ │ x = '0' │ │ │ │ y = ' 1' │ │ │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ d:\AzurLaneAutoScript\module\map\camera.py:62 in _map_swipe │ │ │ │ 59 │ │ │ self.device.swipe_vector(vector, name=name, box=box, │ │ whitelist_area=whitelist, blacklist_area=blacklist) │ │ 60 │ │ │ # Donno why initial commit have a sleep here │ │ 61 │ │ │ # self.device.sleep(0.3) │ │ ❱ 62 │ │ │ self.update(wait_swipe=True) │ │ 63 │ │ │ return True │ │ 64 │ │ else: │ │ 65 │ │ │ # Drop swipe │ │ │ │ ╭───────────────────────────────────────────────── locals ─────────────────────────────────────────────────╮ │ │ │ blacklist = [] │ │ │ │ box = (123, 159, 1175, 628) │ │ │ │ distance = array([132.9728301 , 95.02502329]) │ │ │ │ name = 'MAP_SWIPE_0_-1' │ │ │ │ self = <campaign.campaign_main.campaign_1_1_affinity_farming.Campaign object at 0x000002C6D630DBE0> │ │ │ │ vector = array([-0. , 95.02502329]) │ │ │ │ whitelist = [] │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ d:\AzurLaneAutoScript\module\map\camera.py:308 in update │ │ │ │ 305 │ │ │ │ if wait_swipe and not swipe_wait_timeout.reached() and success: │ │ 306 │ │ │ │ │ # If first screenshot is still prev view │ │ 307 │ │ │ │ │ # must getting out of grid center once and re-focusing center │ │ ❱ 308 │ │ │ │ │ if is_still_prev(): │ │ 309 │ │ │ │ │ │ swiped = False │ │ 310 │ │ │ │ │ if is_grid_center(): │ │ 311 │ │ │ │ │ │ if swiped: │ │ │ │ ╭──────────────────────────────────────────────────── locals ─────────────────────────────────────────────────────╮ │ │ │ allow_error = False │ │ │ │ camera = True │ │ │ │ error_confirm = Timer(limit=1.317/5, count=0/10) │ │ │ │ is_grid_center = <function Camera.update.<locals>.is_grid_center at 0x000002C686492B80> │ │ │ │ is_still_prev = <function Camera.update.<locals>.is_still_prev at 0x000002C686492F70> │ │ │ │ prev_center_offset = None │ │ │ │ self = <campaign.campaign_main.campaign_1_1_affinity_farming.Campaign object at │ │ │ │ 0x000002C6D630DBE0> │ │ │ │ success = True │ │ │ │ swipe_wait_timeout = Timer(limit=1.317/0.35, count=2/1) │ │ │ │ swiped = True │ │ │ │ wait_swipe = True │ │ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ d:\AzurLaneAutoScript\module\map\camera.py:285 in is_still_prev │ │ │ │ 282 │ │ │ │ 283 │ │ def is_still_prev(): │ │ 284 │ │ │ # Still the same as prev view │ │ ❱ 285 │ │ │ return np.linalg.norm(self.view.center_offset - prev_center_offset) < 0.001 │ │ 286 │ │ │ │ 287 │ │ while 1: │ │ 288 │ │ │ # Camera.update() has no skip_first_screenshot │ │ │ │ ╭──────────────────────────────────────────────────── locals ─────────────────────────────────────────────────────╮ │ │ │ prev_center_offset = None │ │ │ │ self = <campaign.campaign_main.campaign_1_1_affinity_farming.Campaign object at │ │ │ │ 0x000002C6D630DBE0> │ │ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'
No response
过时游戏玩法,不再维护
在提问之前...
描述你的问题
1_1_affinity_farming 在<<< MAP INIT >>> 过程中,在 module.map_detection.view.py 的 load函数中,大概率 # Find local view center 出错,小概率正常 后排为竞技神/突击者
如何复现
预期行为
报错如上所示
相关 Logs
截图
No response
还有别的吗?
No response