Browse Source

fix(Restart): 兼容 8+ 与 16+ 登录页标识

(cherry picked from commit a26cae7eae6a1ae2aa1f836deeae347ec903888d)
weirj2016-ai 2 days ago
parent
commit
47a75dfacb

+ 3 - 1
tasks/Restart/assets.py

@@ -104,8 +104,10 @@ class RestartAssets:
 	I_LOGIN_RED_CLOSE = RuleImage(roi_front=(800,0,480,290), roi_back=(800,0,480,290), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_login_red_close.png")
 	# description 
 	I_LOGIN_YELLOW_CLOSE = RuleImage(roi_front=(29,17,46,44), roi_back=(0,0,94,86), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_login_yellow_close.png")
-	# 用于判断是否出现登录选区的 
+	# Login server selection screen with the 8+ age rating icon
 	I_LOGIN_8 = RuleImage(roi_front=(178,572,53,60), roi_back=(1,547,241,105), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_login_8.png")
+	# Login server selection screen with the 16+ age rating icon
+	I_LOGIN_16 = RuleImage(roi_front=(8,558,64,80), roi_back=(1,547,241,105), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_login_16.png")
 	# 指定角色进入游戏,默认第一个 
 	I_LOGIN_SPECIFIC_SERVE = RuleImage(roi_front=(0,0,120,120), roi_back=(0,0,120,120), threshold=0.8, method="Template matching", file="./tasks/Restart/login/login_login_specific_serve.png")
 	# 下载插画 

+ 3 - 4
tasks/Restart/login.py

@@ -156,15 +156,14 @@ class LoginHandler(BaseTask, RestartAssets, GameUiAssets, GeneralBuffAssets):
                 logger.warning('Appear create account')
                 raise GameStuckError('Appear create account')
 
-            # 点击“进入游戏”速度过快会进入区服设置,同时需在检测I_LOGIN_8之前检测,因为新服图标会让I_LOGIN_8向右偏移导致永远无法检测成功
-            # 同时修复了点击位置(之前是点击I_CHARACTARS而不是左边的区域)
+            # Handle server selection before checking the rating badge because the new-server icon can shift it.
             if self.appear(self.I_CHARACTARS, interval=1):
                 logger.info('误入区服设置')
                 # https://github.com/runhey/OnmyojiAutoScript/issues/585
                 self.device.click(x=106, y=535)
                 
-            # 点击’进入游戏‘
-            if not self.appear(self.I_LOGIN_8):
+            # Accept either age-rating badge used by the login screen.
+            if not (self.appear(self.I_LOGIN_8) or self.appear(self.I_LOGIN_16)):
                 continue
             
             # 登录体验服时,点击“进入游戏”速度过快,可能会出现体验服的弹窗

+ 10 - 1
tasks/Restart/login/image.json

@@ -51,7 +51,16 @@
     "roiBack": "1,547,241,105",
     "method": "Template matching",
     "threshold": 0.8,
-    "description": "用于判断是否出现登录选区的"
+    "description": "Login server selection screen with the 8+ age rating icon"
+  },
+  {
+    "itemName": "login_16",
+    "imageName": "login_login_16.png",
+    "roiFront": "8,558,64,80",
+    "roiBack": "1,547,241,105",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "Login server selection screen with the 16+ age rating icon"
   },
   {
     "itemName": "login_specific_serve",

BIN
tasks/Restart/login/login_login_16.png