فهرست منبع

Merge pull request #384 from yEs1do/fix(RyouToppa)

修复:寮突未开且玩家为寮普通成员则会卡住
huangrunheng 2 سال پیش
والد
کامیت
838fc43c86
4فایلهای تغییر یافته به همراه25 افزوده شده و 5 حذف شده
  1. 2 0
      tasks/RyouToppa/assets.py
  2. 9 0
      tasks/RyouToppa/res/image.json
  3. BIN
      tasks/RyouToppa/res/res_no_select_ryou.png
  4. 14 5
      tasks/RyouToppa/script_task.py

+ 2 - 0
tasks/RyouToppa/assets.py

@@ -120,6 +120,8 @@ class RyouToppaAssets:
 	I_RYOU_TOPPA = RuleImage(roi_front=(1191,352,78,116), roi_back=(1161,323,118,193), threshold=0.6, method="Template matching", file="./tasks/RyouToppa/res/res_ryou_toppa.png")
 	# 寮突选择阴阳寮按钮 
 	I_SELECT_RYOU_BUTTON = RuleImage(roi_front=(560,577,156,46), roi_back=(560,577,156,46), threshold=0.8, method="Template matching", file="./tasks/RyouToppa/res/res_select_ryou_button.png")
+	# 寮突未选择阴阳寮 
+	I_NO_SELECT_RYOU = RuleImage(roi_front=(554,180,100,167), roi_back=(554,180,100,167), threshold=0.8, method="Template matching", file="./tasks/RyouToppa/res/res_no_select_ryou.png")
 	# 开始寮突按钮 
 	I_START_TOPPA_BUTTON = RuleImage(roi_front=(832,279,130,43), roi_back=(1,1,1055,718), threshold=0.8, method="Template matching", file="./tasks/RyouToppa/res/res_start_toppa_button.png")
 	# 寮击破奖励 

+ 9 - 0
tasks/RyouToppa/res/image.json

@@ -17,6 +17,15 @@
     "threshold": 0.8,
     "description": "寮突选择阴阳寮按钮"
   },
+  {
+    "itemName": "no_select_ryou",
+    "imageName": "res_no_select_ryou.png",
+    "roiFront": "554,180,100,167",
+    "roiBack": "554,180,100,167",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "寮突未选择阴阳寮"
+  },
   {
     "itemName": "start_toppa_button",
     "imageName": "res_start_toppa_button.png",

BIN
tasks/RyouToppa/res/res_no_select_ryou.png


+ 14 - 5
tasks/RyouToppa/script_task.py

@@ -118,6 +118,10 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, RyouToppaAssets):
             elif self.appear(self.I_SELECT_RYOU_BUTTON, threshold=0.8):
                 ryou_toppa_start_flag = False
                 break
+            # 出现晴明说明寮突未开
+            elif self.appear(self.I_NO_SELECT_RYOU, threshold=0.8):
+                ryou_toppa_start_flag = False
+                break
             # 出现寮奖励, 说明寮突已开
             elif self.appear(self.I_RYOU_REWARD, threshold=0.8) or self.appear(self.I_RYOU_REWARD_90, threshold=0.8):
                 ryou_toppa_start_flag = True
@@ -125,11 +129,16 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, RyouToppaAssets):
 
         logger.attr('ryou_toppa_start_flag', ryou_toppa_start_flag)
         logger.attr('ryou_toppa_success_penetration', ryou_toppa_success_penetration)
-        # 寮突未开 并且有权限, 开开寮突
-        if not ryou_toppa_start_flag and ryou_config.raid_config.ryou_access:
-            # 作为寮管理,开启今天的寮突
-            logger.info("As the manager of the ryou, try to start ryou toppa.")
-            self.start_ryou_toppa()
+        # 寮突未开 并且有权限, 开开寮突,没有权限则标记失败
+        if not ryou_toppa_start_flag:
+            if ryou_config.raid_config.ryou_access:
+                # 作为寮管理,开启今天的寮突
+                logger.info("As the manager of the ryou, try to start ryou toppa.")
+                self.start_ryou_toppa()
+            else:
+                logger.info("The ryou toppa is not open and you are a ryou member.")
+                self.set_next_run(task='RyouToppa', finish=True, server=True, success=False)
+                raise TaskEnd
 
         # 100% 攻破, 第二天再执行
         if ryou_toppa_success_penetration: