@@ -90,9 +90,7 @@ def run(self):
9090 out_dokan_timer = Timer (60 )
9191 if not in_dokan :
9292 out_dokan_timer .start ()
93- if not self .goto_dokan_map ():
94- logger .warning ("dokan didn`t started" )
95- is_dokan_activated = False
93+ self .goto_dokan_scene ()
9694
9795 # 是否已击败馆主第一阵容
9896 first_master_killed = False
@@ -130,15 +128,22 @@ def run(self):
130128
131129 # 场景状态:寻找合适道馆中
132130 if current_scene == DokanScene .RYOU_DOKAN_SCENE_FINDING_DOKAN :
133- # NOTE 只在周一尝试建立道馆
134- if datetime .now ().weekday () == 0 :
135- self .creat_dokan ()
136131
137132 # 更新可挑战次数 可挑战次数为<=0,当作道馆成功完成
138133 count = self .update_remain_attack_count ()
139134 if count <= 0 :
140135 is_dokan_activated = True
141136 break
137+
138+ # 如果没有权限,道馆还未开启
139+ try_start_dokan = self .config .dokan .dokan_config .try_start_dokan
140+ if not try_start_dokan :
141+ is_dokan_activated = False
142+ break
143+ # NOTE 只在周一尝试建立道馆
144+ if datetime .now ().weekday () == 0 :
145+ self .creat_dokan ()
146+
142147 # 寻找合适道馆,找不到直接退出
143148 if not self .find_dokan (self .config .dokan .dokan_config .find_dokan_score ):
144149 is_dokan_activated = False
@@ -191,6 +196,7 @@ def run(self):
191196 continue
192197 # 场景状态:检查右下角有没有挑战?通常是失败了,并退出来到集结界面,可重新开始点击右下角挑战进入战斗
193198 if current_scene == DokanScene .RYOU_DOKAN_SCENE_START_CHALLENGE :
199+ self .switch_soul_in_dokan ()
194200 self .click (self .I_RYOU_DOKAN_START_CHALLENGE , interval = 1 )
195201 continue
196202 # 场景状态:馆主第一阵容 且战斗未开始
@@ -511,30 +517,15 @@ def goto_main(self):
511517 self .click (self .I_BACK_Y , interval = 3 )
512518 continue
513519
514- def goto_dokan_map (self ):
515- """
516- 任意场景进入道馆地图
517- # 有权限开启道馆 - 通过神社进入道馆地图
518- # 没有权限开启道馆 - 判断阴阳寮界面左侧的已开启活动列表是否存在道馆
519- """
520- try_start_dokan = self .config .dokan .dokan_config .try_start_dokan
520+ def goto_dokan_scene (self ):
521+ # 截图速度太快会导致在道馆-神社之间一直循环无法退出,故设置截图间隔
522+ self .device .screenshot_interval_set (0.3 )
521523 while 1 :
522524 self .screenshot ()
523525 in_dokan , cur_scene = self .get_current_scene ()
524526 if in_dokan :
525- return True
527+ break
526528 if cur_scene == DokanScene .RYOU_DOKAN_RYOU :
527- if not try_start_dokan :
528- # 等待左侧活动列表弹出
529- self .wait_until_stable (self .I_RYOU_DOKAN_ACTIVATED , Timer (0.5 , 2 ), Timer (5 , 10 ))
530-
531- # 尝试通过已开启活动列表中查找道馆
532- if self .appear (self .I_RYOU_DOKAN_ACTIVATED ):
533- self .ui_click_until_disappear (self .I_RYOU_DOKAN_ACTIVATED )
534- return True
535- # 在已开启活动列表中 没有找到道馆
536- logger .error (f"can not find dokan in activated list,FAILED" )
537- return False
538529 self .ui_click_until_disappear (self .I_RYOU_SHENSHE )
539530 continue
540531 if cur_scene == DokanScene .RYOU_DOKAN_SHENSHE :
@@ -544,6 +535,8 @@ def goto_dokan_map(self):
544535 self .ui_get_current_page ()
545536 self .ui_goto (page_guild )
546537 continue
538+ self .device .screenshot_interval_set ()
539+ return True
547540
548541 def enter_dokan (self ):
549542 """
@@ -671,6 +664,12 @@ def find_challengeable(ignore_score=False):
671664 if item_score > score or item_score < 1.5 :
672665 logger .info ("click to making challenge disappear" )
673666 continue
667+ if p_num < self .config .dokan .dokan_config .min_people_num :
668+ logger .info ("people num too small" )
669+ continue
670+ if bounty < self .config .dokan .dokan_config .min_bounty :
671+ logger .info ("bounty too small" )
672+ continue
674673 # 馆主不是修习等级的
675674 if not self .appear (self .I_CENTER_GUANZHU_XIUXI ):
676675 continue
@@ -889,13 +888,14 @@ def next_run(self, skip_today=False, is_dokan_activated=False):
889888 # 道馆没有开启
890889 now = datetime .now ()
891890 ser_time : Time = self .config .dokan .scheduler .server_update
891+ ser_time = datetime .combine (now .date (), ser_time )
892892 if not is_dokan_activated :
893893 # 在服务器时间之前,设置为服务器时间
894- if now . hour < ser_time . hour or ( now . hour == ser_time . hour and now . minute < ser_time . minute ) :
894+ if now < ser_time :
895895 self .set_next_run (task = "Dokan" , target = now .replace (hour = ser_time .hour , minute = ser_time .minute ))
896896 return
897897 # 在服务器时间之后,如超过两小时,则直接当作成功;未超过则当作失败
898- if now . hour - ser_time . hour > 2 :
898+ if now - ser_time > timedelta ( hours = 2 ) :
899899 self .set_next_run (task = "Dokan" , finish = False , success = True , server = True )
900900 return
901901 # 时间在道馆开启时间附近,3分钟后执行
0 commit comments