Skip to content

特殊競技場發生錯誤 #60

@anyuexue77

Description

@anyuexue77
 SPECIALARENA                                   

═════════════════════════════════════════════════════════════════════════════════
INFO 17:39:44.633 │ <<< UI ENSURE >>>
INFO 17:39:44.634 │ UI get current page
INFO 17:39:44.666 │ [UI] page_rookie_arena
INFO 17:39:44.667 │ Goto page_arena
INFO 17:39:44.669 │ <<< UI GOTO PAGE_ARENA >>>
INFO 17:39:44.680 │ Page switch: page_rookie_arena -> page_arena
INFO 17:39:44.681 │ Click ( 41, 1207) @ GOTO_BACK
INFO 17:39:45.553 │ Page arrive: page_arena
INFO 17:39:45.631 │ Click ( 449, 674) @ ARENA_GOTO_SPECIAL_ARENA
INFO 17:39:48.065 │ [Free opportunities remain] True
INFO 17:39:48.067 │ <<< START A COMPETITION >>>
INFO 17:39:48.068 │ [Free opportunities remain] True
INFO 17:39:48.069 │ Secect opponent 3
INFO 17:39:48.178 │ Click ( 590, 1100) @ START_COMPETITION
INFO 17:39:48.996 │ Click ( 490, 1051) @ INTO_COMPETITION
WARNING 17:40:03.313 │ 截图失败:(1400, 'GetClientRect', '無效的視窗控制代碼。')
ERROR 17:40:03.315 │ RuntimeError: 截图失败:(1400, 'GetClientRect',
'無效的視窗控制代碼。')
╭───────────────── Traceback (most recent call last) ──────────────────╮
│ C:\Users\Administrator\Downloads\NKAS_0.3.1\NIKKEAutoScript\module\d │
│ evice\win\automation.py:126 in screenshot │
│ │
│ 121 │ │ # 两次截图间隔时间 │
│ 122 │ │ self._screenshot_interval.wait() │
│ 123 │ │ self._screenshot_interval.reset() │
│ 124 │ │ │
│ 125 │ │ try: │
│ ❱ 126 │ │ │ result = Screenshot.take_screenshot( │
│ 127 │ │ │ │ self.current_window.title, self.current_window │
│ self.config.PCClient_Screens, crop=crop │
│ 128 │ │ │ ) │
│ 129 │ │ │ if result: │
│ 130 │ │ │ │ image, pos, scale = result │
│ 131 │ │ │ │ self.current_window.image = self._handle_orien │
│ self.current_window.resolution) │
│ │
│ ╭───────────────────────────── locals ─────────────────────────────╮ │
│ │ crop = (0, 0, 1, 1) │ │
│ │ self = <module.device.win.device.Device object at │ │
│ │ 0x00000195901A65E0> │ │
│ ╰──────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\Administrator\Downloads\NKAS_0.3.1\NIKKEAutoScript\module\d │
│ evice\win\screenshot.py:83 in take_screenshot │
│ │
│ 78 │ │ │ │ │ int(height * crop[3]), │
│ 79 │ │ │ │ ), │
│ 80 │ │ │ │ allScreens=screens, │
│ 81 │ │ │ ) │
│ 82 │ │ │ │
│ ❱ 83 │ │ │ real_width, _ = Screenshot.get_window_real_resolut │
│ 84 │ │ │ if real_width > resolution[0]: │
│ 85 │ │ │ │ screenshot_scale_factor = resolution[0] / real │
│ 86 │ │ │ │ screenshot = screenshot.resize((int(resolution │
│ int(resolution[1] * crop[3]))) │
│ 87 │ │ │ else: │
│ 88 │ │ │ │ screenshot_scale_factor = 1 │
│ │
│ ╭───────────────────────────── locals ─────────────────────────────╮ │
│ │ crop = (0, 0, 1, 1) │ │
│ │ height = 1280 │ │
│ │ left = 225 │ │
│ │ offset_x = 0 │ │
│ │ offset_y = 0 │ │
│ │ resolution = (720, 1280) │ │
│ │ screens = True │ │
│ │ screenshot = <PIL.Image.Image image mode=RGB size=720x1280 at │ │
│ │ 0x195BEC28CA0> │ │
│ │ title = '勝利女神:妮姬' │ │
│ │ top = 78 │ │
│ │ width = 720 │ │
│ │ window = Win32Window(hWnd=461230) │ │
│ ╰──────────────────────────────────────────────────────────────────╯ │
│ │
│ C:\Users\Administrator\Downloads\NKAS_0.3.1\NIKKEAutoScript\module\d │
│ evice\win\screenshot.py:15 in get_window_real_resolution │
│ │
│ 10 │ │ screen_width, screen_height = pyautogui.size() │
│ 11 │ │ return (window.width, window.height) == (screen_width, │
│ 12 │ │
│ 13 │ @staticmethod
│ 14 │ def get_window_real_resolution(window): │
│ ❱ 15 │ │ left, top, right, bottom = win32gui.GetClientRect(wind │
│ 16 │ │ return right - left, bottom - top │
│ 17 │ │
│ 18 │ @staticmethod
│ 19 │ def get_window_region(window): │
│ 20 │ │ if Screenshot.is_application_fullscreen(window): │
│ │
│ ╭───────────── locals ──────────────╮ │
│ │ window = Win32Window(hWnd=461230) │ │
│ ╰───────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────╯
error: (1400, 'GetClientRect', '無效的視窗控制代碼。')

     During handling of the above exception, another exception occurred:     
                                                                             
     ╭───────────────── Traceback (most recent call last) ──────────────────╮
     │ C:\Users\Administrator\Downloads\NKAS_0.3.1\NIKKEAutoScript\main.py: │
     │ 83 in run                                                            │
     │                                                                      │
     │    78 │   def run(self, command, skip_first_screenshot=False):       │
     │    79 │   │   try:                                                   │
     │    80 │   │   │   # 妮游社任务不需要device                           │
     │    81 │   │   │   if command not in self.config.INDEPENDENT_TASKS_UN │
     │       skip_first_screenshot:                                         │
     │    82 │   │   │   │   self.device.screenshot()                       │
     │ ❱  83 │   │   │   self.__getattribute__(command)()                   │
     │    84 │   │   │   return True                                        │
     │    85 │   │   except TaskEnd:                                        │
     │    86 │   │   │   return True                                        │
     │    87 │   │   except GameStart:                                      │
     │    88 │   │   │   self.start()                                       │
     │                                                                      │
     │ ╭───────────────────────────── locals ─────────────────────────────╮ │
     │ │               command = 'special_arena'                          │ │
     │ │                     e = RuntimeError("截图失败:(1400,           │ │
     │ │                         'GetClientRect',                         │ │
     │ │                         '無效的視窗控制代碼。')")                │ │
     │ │                  self = <main.NikkeAutoScript object at          │ │
     │ │                         0x00000195EF1BE3A0>                      │ │
     │ │ skip_first_screenshot = False                                    │ │
     │ ╰──────────────────────────────────────────────────────────────────╯ │
     │                                                                      │
     │ C:\Users\Administrator\Downloads\NKAS_0.3.1\NIKKEAutoScript\main.py: │
     │ 232 in special_arena                                                 │
     │                                                                      │
     │   227 │   │   RookieArena(config=self.config, device=self.device).ru │
     │   228 │                                                              │
     │   229 │   def special_arena(self):                                   │
     │   230 │   │   from module.special_arena.special_arena import Special │
     │   231 │   │                                                          │
     │ ❱ 232 │   │   SpecialArena(config=self.config, device=self.device).r │
     │   233 │                                                              │
     │   234 │   def champion_arena(self):                                  │
     │   235 │   │   from module.champion_arena.champion_arena import Champ │
     │   236 │   │                                                          │
     │   237 │   │   ChampionArena(config=self.config, device=self.device). │
     │                                                                      │
     │ ╭───────────────────────────── locals ─────────────────────────────╮ │
     │ │         self = <main.NikkeAutoScript object at                   │ │
     │ │                0x00000195EF1BE3A0>                               │ │
     │ │ SpecialArena = <class                                            │ │
     │ │                'module.special_arena.special_arena.SpecialArena… │ │
     │ ╰──────────────────────────────────────────────────────────────────╯ │
     │                                                                      │
     │ C:\Users\Administrator\Downloads\NKAS_0.3.1\NIKKEAutoScript\module\s │
     │ pecial_arena\special_arena.py:175 in run                             │
     │                                                                      │
     │   170 │   │   │   logger.info('There are no free opportunities')     │
     │   171 │                                                              │
     │   172 │   def run(self):                                             │
     │   173 │   │   self.ui_ensure(page_arena)                             │
     │   174 │   │   try:                                                   │
     │ ❱ 175 │   │   │   self.ensure_into_special_arena()                   │
     │   176 │   │   except SpecialArenaIsUnavailable:                      │
     │   177 │   │   │   pass                                               │
     │   178 │   │   self.config.task_delay(server_update=True)             │
     │   179                                                                │
     │                                                                      │
     │ ╭───────────────────────────── locals ─────────────────────────────╮ │
     │ │ self = <module.special_arena.special_arena.SpecialArena object   │ │
     │ │        at 0x00000195BEC12AC0>                                    │ │
     │ ╰──────────────────────────────────────────────────────────────────╯ │
     │                                                                      │
     │ C:\Users\Administrator\Downloads\NKAS_0.3.1\NIKKEAutoScript\module\s │
     │ pecial_arena\special_arena.py:168 in ensure_into_special_arena       │
     │                                                                      │
     │   163 │   │   │                                                      │
     │   164 │   │   │   if self.appear(SPECIAL_ARENA_CHECK, offset=(10, 10 │
     │       confirm_timer.reached():                                       │
     │   165 │   │   │   │   break                                          │
     │   166 │   │                                                          │
     │   167 │   │   if self.free_opportunity_remain:                       │
     │ ❱ 168 │   │   │   self.start_competition()                           │
     │   169 │   │   else:                                                  │
     │   170 │   │   │   logger.info('There are no free opportunities')     │
     │   171 │                                                              │
     │   172 │   def run(self):                                             │
     │   173 │   │   self.ui_ensure(page_arena)                             │
     │                                                                      │
     │ ╭───────────────────────────── locals ─────────────────────────────╮ │
     │ │           click_timer = Timer(limit=17.579/0.3, count=8/0)       │ │
     │ │         confirm_timer = Timer(limit=17.579/2, count=4/3)         │ │
     │ │                  self = <module.special_arena.special_arena.Spe… │ │
     │ │                         object at 0x00000195BEC12AC0>            │ │
     │ │ skip_first_screenshot = False                                    │ │
     │ ╰──────────────────────────────────────────────────────────────────╯ │
     │                                                                      │
     │ C:\Users\Administrator\Downloads\NKAS_0.3.1\NIKKEAutoScript\module\s │
     │ pecial_arena\special_arena.py:93 in start_competition                │
     │                                                                      │
     │    88 │   │                                                          │
     │    89 │   │   while 1:                                               │
     │    90 │   │   │   if skip_first_screenshot:                          │
     │    91 │   │   │   │   skip_first_screenshot = False                  │
     │    92 │   │   │   else:                                              │
     │ ❱  93 │   │   │   │   self.device.screenshot()                       │
     │    94 │   │   │                                                      │
     │    95 │   │   │   if not already_start and click_timer.reached() and │
     │       and self.free_opportunity_remain:                              │
     │    96 │   │   │   │   # 根据策略选择                                 │
     │    97 │   │   │   │   opponent_id = 3                                │
     │    98 │   │   │   │   if self.config.OpponentSelection_Enable:       │
     │                                                                      │
     │ ╭───────────────────────────── locals ─────────────────────────────╮ │
     │ │         already_start = False                                    │ │
     │ │           click_timer = Timer(limit=14.209/0.3, count=184/0)     │ │
     │ │         click_timer_2 = Timer(limit=15.14/5, count=47/0)         │ │
     │ │         confirm_timer = Timer(limit=14.209/1, count=0/5)         │ │
     │ │              opponent = (590, 1100)                              │ │
     │ │           opponent_id = 3                                        │ │
     │ │                  self = <module.special_arena.special_arena.Spe… │ │
     │ │                         object at 0x00000195BEC12AC0>            │ │
     │ │ skip_first_screenshot = False                                    │ │
     │ ╰──────────────────────────────────────────────────────────────────╯ │
     │                                                                      │
     │ C:\Users\Administrator\Downloads\NKAS_0.3.1\NIKKEAutoScript\module\d │
     │ evice\win\device.py:59 in screenshot                                 │
     │                                                                      │
     │    54 │   │                                                          │
     │    55 │   │   Returns:                                               │
     │    56 │   │   │   np.ndarray:                                        │
     │    57 │   │   """                                                    │
     │    58 │   │   self.stuck_record_check()                              │
     │ ❱  59 │   │   super().screenshot()                                   │
     │    60 │   │   self.image = self.current_window.image                 │
     │    61 │   │   return self.image                                      │
     │    62 │                                                              │
     │    63 │   def handle_control_check(self, button: Button):            │
     │    64 │   │   """                                                    │
     │                                                                      │
     │ ╭───────────────────────────── locals ─────────────────────────────╮ │
     │ │ self = <module.device.win.device.Device object at                │ │
     │ │        0x00000195901A65E0>                                       │ │
     │ ╰──────────────────────────────────────────────────────────────────╯ │
     │                                                                      │
     │ C:\Users\Administrator\Downloads\NKAS_0.3.1\NIKKEAutoScript\module\d │
     │ evice\win\automation.py:141 in screenshot                            │
     │                                                                      │
     │   136 │   │   │   │   return result                                  │
     │   137 │   │   │   else:                                              │
     │   138 │   │   │   │   raise RuntimeError(f'没有找到窗口              │
     │       {self.current_window.name}:{self.current_window.title}')       │
     │   139 │   │   except Exception as e:                                 │
     │   140 │   │   │   logger.warning(f'截图失败:{e}')                   │
     │ ❱ 141 │   │   │   raise RuntimeError(f'截图失败:{e}')               │
     │   142 │                                                              │
     │   143 │   @cached_property                                           │
     │   144 │   def screenshot_deque(self):                                │
     │   145 │   │   return deque(maxlen=int(self.config.Error_ScreenshotLe │
     │   146                                                                │
     │                                                                      │
     │ ╭───────────────────────────── locals ─────────────────────────────╮ │
     │ │ crop = (0, 0, 1, 1)                                              │ │
     │ │ self = <module.device.win.device.Device object at                │ │
     │ │        0x00000195901A65E0>                                       │ │
     │ ╰──────────────────────────────────────────────────────────────────╯ │
     ╰──────────────────────────────────────────────────────────────────────╯
     RuntimeError: 截图失败:(1400, 'GetClientRect', '無效的視窗控制代碼。') 

WARNING 17:40:03.585 │ Saving error: ./log/error/1757842803585

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions