runhey / OnmyojiAutoScript

Onmyoji Auto Script | 阴阳师脚本
https://runhey.github.io/OnmyojiAutoScript-website/
GNU General Public License v3.0
1.86k stars 184 forks source link

百鬼夜行 AttributeError: 'Device' object has no attribute 'emulator_instance' #536

Closed xwq999sir closed 1 week ago

xwq999sir commented 1 week ago

在提问之前...

描述你的问题

已经勾选了Onnxruntime 和 FP32,但是百鬼进入后会识别失败

如何复现

勾选百鬼夜行任务稳定复现

预期行为

No response

相关 Logs

════════════════════════════════════════════════════════════════════════════════
───────────────────────────────── HYAKKIYAKOU ──────────────────────────────────
════════════════════════════════════════════════════════════════════════════════
2024-11-15 23:02:19.307 |        connection.py:0306 |     INFO | Connecting to local emulator, using host 192.168.1.103                                         
2024-11-15 23:02:19.309 |        connection.py:0338 |     INFO | Reverse server listening on 192.168.1.103:20578, client can send data to 192.168.1.103:20578   
2024-11-15 23:02:19.317 |        connection.py:0353 |     INFO | sdk_ver: 32                                                                                    
2024-11-15 23:02:19.338 |            logger.py:0284 |     INFO | [nc command] ['nc']                                                                            
2024-11-15 23:02:19.610 |            logger.py:0284 |     INFO | [Screen_size] 1280x720                                                                         
2024-11-15 23:02:19.612 |            script.py:0350 |     INFO | module_path:                                                                                   
F:\脚本合集\阴阳师\OnmyojiAutoScript-easy-install\tasks\Hyakkiyakou\script_task.py, module_name: script_task                                                    
2024-11-15 23:02:19.791 |           game_ui.py:0097 |     INFO | UI get current page                                                                            
2024-11-15 23:02:19.803 |            logger.py:0284 |     INFO | [UI] page_town                                                                                 
2024-11-15 23:02:19.804 |            logger.py:0276 |     INFO | <<< UI GOTO PAGE_HYAKKIYAKOU >>>                                                               
2024-11-15 23:02:19.814 |             image.py:0077 |     INFO | roi_front size changed to 66x75                                                                
2024-11-15 23:02:19.836 |           game_ui.py:0245 |     INFO | Page switch: page_town -> page_hyakkiyakou                                                     
2024-11-15 23:02:19.838 |           control.py:0074 |     INFO | Click ( 913,  222) @ PAGE_TOWN_GOTO_HYAKKIYAKOU                                                
2024-11-15 23:02:20.637 |           game_ui.py:0222 |     INFO | Page arrive: page_hyakkiyakou                                                                  
──────────────────────────────── INVITE FRIEND ─────────────────────────────────
2024-11-15 23:02:20.639 |            logger.py:0274 |     INFO | INVITE FRIEND                                                                                  
2024-11-15 23:02:20.989 |           control.py:0074 |     INFO | Click ( 184,  616) @ HYA_HINVITE                                                               
2024-11-15 23:02:22.162 |           control.py:0074 |     INFO | Click ( 527,  256) @ friend_1                                                                  
2024-11-15 23:02:22.477 |         hya_slave.py:0246 |     INFO | Invite friend done                                                                             
2024-11-15 23:02:22.762 |           control.py:0074 |     INFO | Click (1151,  615) @ HYA_HACCESS                                                               
2024-11-15 23:02:24.851 |           control.py:0074 |     INFO | Click (1122,  620) @ HYA_HSTART                                                                
2024-11-15 23:02:25.174 |           control.py:0074 |     INFO | Click ( 203,  400) @ hselect_1                                                                 
2024-11-15 23:02:26.987 |           control.py:0074 |     INFO | Click (1123,  651) @ HYA_HSTART                                                                
2024-11-15 23:02:27.889 |            device.py:0113 |     INFO | Add stuck record: BATTLE_STATUS_S                                                              
2024-11-15 23:02:27.891 |            logger.py:0276 |     INFO | <<< START HYAKKIYAKOU >>>                                                                      
2024-11-15 23:02:27.891 |          debugger.py:0114 |     INFO | Reset Debugger Thread Environment                                                              
2024-11-15 23:02:27.892 |          debugger.py:0092 |     INFO | Continuous Learning Mode Enabled                                                               
2024-11-15 23:02:27.893 |          debugger.py:0097 |     INFO | Hyakkiyakou Save Result Mode Enabled                                                           
2024-11-15 23:02:27.895 |          debugger.py:0126 |     INFO | OAS Track Debugger show image start                                                            
2024-11-15 23:02:27.897 |            logger.py:0318 |    ERROR | AttributeError: 'Device' object has no attribute 'emulator_instance'                           
┌───────────────────────────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────────────────────────┐
│ F:\脚本合集\阴阳师\OnmyojiAutoScript-easy-install\script.py:352 in run                                                                                       │
│                                                                                                                                                              │
│   349 │   │   │   module_path = str(Path.cwd() / 'tasks' / command / (module_name+'.py'))                                                                    │
│   350 │   │   │   logger.info(f'module_path: {module_path}, module_name: {module_name}')                                                                     │
│   351 │   │   │   task_module = load_module(module_name, module_path)                                                                                        │
│ > 352 │   │   │   task_module.ScriptTask(config=self.config, device=self.device).run()                                                                       │
│   353 │   │   except TaskEnd:                                                                                                                                │
│   354 │   │   │   return True                                                                                                                                │
│   355 │   │   except GameNotRunningError as e:                                                                                                               │
│                                                                                                                                                              │
│ ┌─────────────────────────────────────────────────────────────── locals ───────────────────────────────────────────────────────────────┐                     │
│ │     command = 'Hyakkiyakou'                                                                                                          │                     │
│ │           e = AttributeError("'Device' object has no attribute 'emulator_instance'")                                                 │                     │
│ │ module_name = 'script_task'                                                                                                          │                     │
│ │ module_path = 'F:\\脚本合集\\阴阳师\\OnmyojiAutoScript-easy-install\\tasks\\Hyakkiyakou\\script_task.py'                             │                     │
│ │        self = <script.Script object at 0x0000023ED000F5B0>                                                                           │                     │
│ │ task_module = <module 'script_task' from 'F:\\脚本合集\\阴阳师\\OnmyojiAutoScript-easy-install\\tasks\\Hyakkiyakou\\script_task.py'> │                     │
│ └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘                     │
│                                                                                                                                                              │
│ F:\脚本合集\阴阳师\OnmyojiAutoScript-easy-install\tasks\Hyakkiyakou\script_task.py:139 in run                                                                │
│                                                                                                                                                              │
│   136 │   │   │   │   logger.info('Hyakkiyakou time limit out')                                                                                              │
│   137 │   │   │   │   break                                                                                                                                  │
│   138 │   │   │                                                                                                                                              │
│ > 139 │   │   │   self.one()                                                                                                                                 │
│   140 │   │   │   hya_count += 1                                                                                                                             │
│   141 │   │                                                                                                                                                  │
│   142 │   │   while 1:                                                                                                                                       │
│                                                                                                                                                              │
│ ┌────────────────────────────── locals ──────────────────────────────┐                                                                                       │
│ │  hya_count = 0                                                     │                                                                                       │
│ │ limit_time = Time(1, 0)                                            │                                                                                       │
│ │       self = <script_task.ScriptTask object at 0x0000023EF17682E0> │                                                                                       │
│ └────────────────────────────────────────────────────────────────────┘                                                                                       │
│                                                                                                                                                              │
│ F:\脚本合集\阴阳师\OnmyojiAutoScript-easy-install\tasks\Hyakkiyakou\script_task.py:181 in one                                                                │
│                                                                                                                                                              │
│   178 │   │   if self._config.debug_config.hya_show:                                                                                                         │
│   179 │   │   │   self.debugger.show_start()                                                                                                                 │
│   180 │   │   while 1:                                                                                                                                       │
│ > 181 │   │   │                                                                                                                                              │
│       self.fast_screenshot(screenshot=self._config.debug_config.hya_screenshot_method)                                                                       │
│   182 │   │   │   if self.appear(self.I_HEND):                                                                                                               │
│   183 │   │   │   │   break                                                                                                                                  │
│   184 │   │   │   if not self.appear(self.I_CHECK_RUN):                                                                                                      │
│                                                                                                                                                              │
│ ┌────────────────────────────────── locals ───────────────────────────────────┐                                                                              │
│ │   click_button = <module.atom.click.RuleClick object at 0x0000023EF153AA10> │                                                                              │
│ │ init_bean_flag = False                                                      │                                                                              │
│ │    last_action = [0, 0, False, 10]                                          │                                                                              │
│ │           self = <script_task.ScriptTask object at 0x0000023EF17682E0>      │                                                                              │
│ └─────────────────────────────────────────────────────────────────────────────┘                                                                              │
│                                                                                                                                                              │
│ F:\脚本合集\阴阳师\OnmyojiAutoScript-easy-install\tasks\Hyakkiyakou\slave\hya_device.py:33 in fast_screenshot                                                │
│                                                                                                                                                              │
│   30 │   def fast_screenshot(self, screenshot: ScreenshotMethod):                                                                                            │
│   31 │   │   self.hya_screenshot_interval.wait()                                                                                                             │
│   32 │   │   self.hya_screenshot_interval.reset()                                                                                                            │
│ > 33 │   │   self.device.image = self.device.screenshot_window_background() if screenshot ==                                                                 │
│      ScreenshotMethod.WINDOW_BACKGROUND else self.device.screenshot_nemu_ipc()                                                                               │
│   34 │   │   if image_black(self.device.image):                                                                                                              │
│   35 │   │   │   logger.error('Screenshot image is black, try again')                                                                                        │
│   36 │   │   │   raise RequestHumanTakeover('Screenshot image is black, try again')                                                                          │
│                                                                                                                                                              │
│ ┌────────────────────────────── locals ──────────────────────────────┐                                                                                       │
│ │ screenshot = <ScreenshotMethod.NEMU_IPC: 'nemu_ipc'>               │                                                                                       │
│ │       self = <script_task.ScriptTask object at 0x0000023EF17682E0> │                                                                                       │
│ └────────────────────────────────────────────────────────────────────┘                                                                                       │
│                                                                                                                                                              │
│ F:\脚本合集\阴阳师\OnmyojiAutoScript-easy-install\module\device\method\nemu_ipc.py:496 in screenshot_nemu_ipc                                                │
│                                                                                                                                                              │
│   493 │   │   logger.info('nemu_ipc released')                                                                                                               │
│   494 │                                                                                                                                                      │
│   495 │   def screenshot_nemu_ipc(self):                                                                                                                     │
│ > 496 │   │   image = self.nemu_ipc.screenshot()                                                                                                             │
│   497 │   │                                                                                                                                                  │
│   498 │   │   image = cv2.cvtColor(image, cv2.COLOR_BGRA2BGR)                                                                                                │
│   499 │   │   cv2.flip(image, 0, dst=image)                                                                                                                  │
│                                                                                                                                                              │
│ ┌───────────────────────────── locals ──────────────────────────────┐                                                                                        │
│ │ self = <module.device.device.Device object at 0x0000023EF12EC280> │                                                                                        │
│ └───────────────────────────────────────────────────────────────────┘                                                                                        │
│                                                                                                                                                              │
│ F:\脚本合集\阴阳师\OnmyojiAutoScript-easy-install\module\base\decorator.py:103 in __get__                                                                    │
│                                                                                                                                                              │
│   100 │   │   if obj is None:                                                                                                                                │
│   101 │   │   │   return self                                                                                                                                │
│   102 │   │                                                                                                                                                  │
│ > 103 │   │   value = obj.__dict__[self.func.__name__] = self.func(obj)                                                                                      │
│   104 │   │   return value                                                                                                                                   │
│   105                                                                                                                                                        │
│   106 def del_cached_property(obj, name):                                                                                                                    │
│                                                                                                                                                              │
│ ┌────────────────────────────────── locals ───────────────────────────────────┐                                                                              │
│ │  cls = <class 'module.device.device.Device'>                                │                                                                              │
│ │  obj = <module.device.device.Device object at 0x0000023EF12EC280>           │                                                                              │
│ │ self = <module.base.decorator.cached_property object at 0x0000023EF1293220> │                                                                              │
│ └─────────────────────────────────────────────────────────────────────────────┘                                                                              │
│                                                                                                                                                              │
│ F:\脚本合集\阴阳师\OnmyojiAutoScript-easy-install\module\device\method\nemu_ipc.py:464 in nemu_ipc                                                           │
│                                                                                                                                                              │
│   461 │   │   # Search emulator instance                                                                                                                     │
│   462 │   │   # with E:\ProgramFiles\MuMuPlayer-12.0\shell\MuMuPlayer.exe                                                                                    │
│   463 │   │   # installation path is E:\ProgramFiles\MuMuPlayer-12.0                                                                                         │
│ > 464 │   │   if self.emulator_instance is None:                                                                                                             │
│   465 │   │   │   logger.error('Unable to use NemuIpc because emulator instance not found')                                                                  │
│   466 │   │   │   raise RequestHumanTakeover                                                                                                                 │
│   467 │   │   try:                                                                                                                                           │
│                                                                                                                                                              │
│ ┌───────────────────────────── locals ──────────────────────────────┐                                                                                        │
│ │ self = <module.device.device.Device object at 0x0000023EF12EC280> │                                                                                        │
│ └───────────────────────────────────────────────────────────────────┘                                                                                        │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
AttributeError: 'Device' object has no attribute 'emulator_instance'                                                                                            
2024-11-15 23:02:28.553 |            script.py:0096 |  WARNING | Saving error: ./log/error/1731682948553

截图

2024-11-15_23-02-27-888442

还有别的吗?

No response

runhey commented 1 week ago

image