22# @author runhey
33# github https://github.com/runhey
44from time import sleep
5+ from copy import deepcopy
56from cached_property import cached_property
67
78from module .logger import logger
@@ -134,7 +135,6 @@ def run_leader(self):
134135 while 1 :
135136 self .screenshot ()
136137 scene = self .get_current_scene ()
137- logger .info (f'[run_leader] Current scene: { scene .name } ' ) # TODO 2026.06.22 之后删掉这个刷屏的
138138 # 探索大世界
139139 if scene == Scene .WORLD :
140140 # 打开右边箭头
@@ -337,6 +337,15 @@ def invite_friend(self, name: str = None, find_mode: FindMode = FindMode.AUTO_FI
337337 friend_class [i ] = '跨区'
338338 logger .info (f'Friend class: { friend_class } ' )
339339
340+ # 76e2a874(#1509) 把 I_FLAG_2_ON 的 roi 改到了 tab 标签栏上方的空白区
341+ # (472,82,32,11) / (454,74,56,26),导致第 2 个 tab 的选中态永远匹配不上,
342+ # while index == 1 死循环点满 10 次触发 GameTooManyClickError。
343+ # 这里深拷贝一份并还原成 439be142(#1443) 的 roi,不改动原资源。
344+ # https://github.com/runhey/OnmyojiAutoScript/issues/1844
345+ flag_2_on = deepcopy (self .I_FLAG_2_ON )
346+ flag_2_on .roi_front = [471 , 128 , 54 , 18 ]
347+ flag_2_on .roi_back = (471 , 128 , 54 , 18 )
348+
340349 is_select : bool = False # 是否选中了好友
341350 if find_mode == FindMode .RECENT_FRIEND :
342351 logger .info ('Find recent friend' )
@@ -347,7 +356,7 @@ def invite_friend(self, name: str = None, find_mode: FindMode = FindMode.AUTO_FI
347356 recent_index = friend_class .index ('最近' )
348357 while recent_index == 1 :
349358 self .screenshot ()
350- if self .appear (self . I_FLAG_2_ON ):
359+ if self .appear (flag_2_on ):
351360 break
352361 if self .appear_then_click (self .I_FLAG_2_OFF , interval = 1 ):
353362 continue
@@ -378,7 +387,7 @@ def invite_friend(self, name: str = None, find_mode: FindMode = FindMode.AUTO_FI
378387 continue
379388 while index == 1 :
380389 self .screenshot ()
381- if self . I_FLAG_2_ON .match_mean_color (self .device .image , self .INVITE_FLAG_ON , 10 ):
390+ if flag_2_on .match_mean_color (self .device .image , self .INVITE_FLAG_ON , 10 ):
382391 break
383392 if self .click (self .I_FLAG_2_OFF , interval = 1 ):
384393 continue
0 commit comments