Просмотр исходного кода

revert: 移除一键收获相关功能

lhye 8 месяцев назад
Родитель
Сommit
5db29655b6

+ 18 - 14
tasks/Restart/assets.py

@@ -11,6 +11,14 @@ class RestartAssets:
 
 
 	# Image Rule Assets
+	# 点击勾玉 
+	I_HARVEST_JADE = RuleImage(roi_front=(732,489,34,33), roi_back=(177,451,973,141), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_jade.png")
+	# 签到小图标 
+	I_HARVEST_SIGN = RuleImage(roi_front=(397,500,24,34), roi_back=(70,471,889,89), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_sign.png")
+	# description 
+	I_HARVEST_SIGN_2 = RuleImage(roi_front=(592,135,100,252), roi_back=(592,135,100,252), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_sign_2.png")
+	# 999签到福袋 
+	I_HARVEST_SIGN_999 = RuleImage(roi_front=(345,494,23,29), roi_back=(51,459,888,103), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_sign_999.png")
 	# 邮件小图标 
 	I_HARVEST_MAIL = RuleImage(roi_front=(337,505,37,25), roi_back=(38,465,880,89), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_mail.png")
 	# 全部收取 
@@ -20,15 +28,25 @@ class RestartAssets:
 	# 确认收取邮件 
 	I_HARVEST_MAIL_CONFIRM = RuleImage(roi_front=(687,543,168,64), roi_back=(687,543,168,64), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_mail_confirm.png")
 	# description 
+	I_HARVEST_SOUL = RuleImage(roi_front=(241,497,38,36), roi_back=(68,480,930,72), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_soul.png")
+	# description 
 	I_HARVEST_MAIL_TITLE = RuleImage(roi_front=(520,48,245,41), roi_back=(520,48,245,41), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_mail_title.png")
+	# description 
+	I_HARVEST_AP = RuleImage(roi_front=(721,486,31,38), roi_back=(206,462,970,134), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_ap.png")
 	# 打开聊天频道会自动关闭 
 	I_HARVEST_CHAT_CLOSE = RuleImage(roi_front=(639,309,35,100), roi_back=(639,309,35,100), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_chat_close.png")
+	# 签到 
+	I_HARVEST_SIGN_3 = RuleImage(roi_front=(291,495,33,36), roi_back=(100,473,1014,91), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_sign_3.png")
+	# description 
+	I_HARVEST_SIGN_4 = RuleImage(roi_front=(587,151,100,228), roi_back=(547,123,185,281), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_sign_4.png")
 	# 点击随机御魂 
 	I_HARVEST_SOUL_1 = RuleImage(roi_front=(248,501,34,37), roi_back=(165,389,929,168), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_soul_1.png")
 	# 选择中间第二个御魂 
 	I_HARVEST_SOUL_2 = RuleImage(roi_front=(586,561,112,47), roi_back=(570,547,139,71), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_soul_2.png")
 	# 六星御魂标志 
 	I_HARVEST_SOUL_3 = RuleImage(roi_front=(313,489,188,33), roi_back=(302,472,216,60), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_soul_3.png")
+	# 寮包 
+	I_HARVEST_GUILD_REWARD = RuleImage(roi_front=(244,498,41,42), roi_back=(200,403,817,157), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_guild_reward.png")
 	# 宠物小屋关闭按钮 
 	I_HARVEST_BACK_PET_HOUSE = RuleImage(roi_front=(20,15,70,70), roi_back=(20,15,70,70), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_back_pet_house.png")
 	# 点击庭院阴阳师出现的姿度按钮 
@@ -49,18 +67,6 @@ class RestartAssets:
 	I_READ_ALL_MAIL = RuleImage(roi_front=(180,605,130,35), roi_back=(149,588,182,72), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_read_all_mail.png")
 	# 邮件红点 
 	I_MAIL_RED_POINT = RuleImage(roi_front=(1229,200,16,21), roi_back=(1159,189,100,317), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_mail_red_point.png")
-	# 一键收获按钮 
-	I_HARVEST_ONE_KEY = RuleImage(roi_front=(270,220,23,25), roi_back=(270,220,880,350), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_one_key.png")
-	# 一键收获每日签到 
-	I_HARVEST_ONE_KEY_DAILY = RuleImage(roi_front=(1125,120,62,36), roi_back=(1125,120,100,80), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_one_key_daily.png")
-	# 一键收获完成按钮 
-	I_HARVEST_ONE_KEY_FINISH_BUTTON = RuleImage(roi_front=(1100,570,82,75), roi_back=(1100,570,130,130), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_one_key_finish_button.png")
-	# 万华牌跳过按钮 
-	I_HARVEST_ONE_KEY_WANHUA_CARD_SKIP = RuleImage(roi_front=(1120,0,43,18), roi_back=(1120,0,160,80), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_one_key_wanhua_card_skip.png")
-	# 一键收获取消按钮 
-	I_HARVEST_ONE_KEY_CANCEL = RuleImage(roi_front=(430,230,420,270), roi_back=(430,230,420,270), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_one_key_cancel.png")
-	# 一键收获成功标识 
-	I_HARVEST_ONE_KEY_SUCCESS = RuleImage(roi_front=(280,16,161,35), roi_back=(280,16,230,70), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_one_key_success.png")
 
 
 	# Click Rule Assets
@@ -68,8 +74,6 @@ class RestartAssets:
 	C_LOGIN_ENSURE_LOGIN_CHARACTER_IN_SAME_SVR = RuleClick(roi_front=(600,240,500,400), roi_back=(600,240,500,400), name="login_ensure_login_character_in_same_svr")
 	# 卷轴关闭区域点击(用户新增,用于点击I_LOGIN_SCROOLL_CLOSE的区域而不依赖图片识别) 
 	C_LOGIN_SCROLL_CLOSE_AREA = RuleClick(roi_front=(1181,634,28,39), roi_back=(1162,595,77,112), name="login_scroll_close_area")
-	# 一键收获完成界面关闭区域 
-	C_HARVEST_ONE_KEY_CLOSE_AREA = RuleClick(roi_front=(0,0,230,280), roi_back=(0,0,230,280), name="harvest_one_key_close_area")
 
 
 	# Image Rule Assets

BIN
tasks/Restart/harvest/harvest_harvest_ap.png


BIN
tasks/Restart/harvest/harvest_harvest_guild_reward.png


BIN
tasks/Restart/harvest/harvest_harvest_jade.png


BIN
tasks/Restart/harvest/harvest_harvest_sign.png


BIN
tasks/Restart/harvest/harvest_harvest_sign_2.png


BIN
tasks/Restart/harvest/harvest_harvest_sign_3.png


BIN
tasks/Restart/harvest/harvest_harvest_sign_4.png


BIN
tasks/Restart/harvest/harvest_harvest_sign_999.png


BIN
tasks/Restart/harvest/harvest_harvest_soul.png


+ 81 - 45
tasks/Restart/harvest/image.json

@@ -1,4 +1,40 @@
 [
+  {
+    "itemName": "harvest_jade",
+    "imageName": "harvest_harvest_jade.png",
+    "roiFront": "732,489,34,33",
+    "roiBack": "177,451,973,141",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "点击勾玉"
+  },
+  {
+    "itemName": "harvest_sign",
+    "imageName": "harvest_harvest_sign.png",
+    "roiFront": "397,500,24,34",
+    "roiBack": "70,471,889,89",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "签到小图标"
+  },
+  {
+    "itemName": "harvest_sign_2",
+    "imageName": "harvest_harvest_sign_2.png",
+    "roiFront": "592,135,100,252",
+    "roiBack": "592,135,100,252",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "harvest_sign_999",
+    "imageName": "harvest_harvest_sign_999.png",
+    "roiFront": "345,494,23,29",
+    "roiBack": "51,459,888,103",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "999签到福袋"
+  },
   {
     "itemName": "harvest_mail",
     "imageName": "harvest_harvest_mail.png",
@@ -35,6 +71,15 @@
     "threshold": 0.8,
     "description": "确认收取邮件"
   },
+  {
+    "itemName": "harvest_soul",
+    "imageName": "harvest_harvest_soul.png",
+    "roiFront": "241,497,38,36",
+    "roiBack": "68,480,930,72",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
   {
     "itemName": "harvest_mail_title",
     "imageName": "harvest_harvest_mail_title.png",
@@ -44,6 +89,15 @@
     "threshold": 0.8,
     "description": "description"
   },
+  {
+    "itemName": "harvest_ap",
+    "imageName": "harvest_harvest_ap.png",
+    "roiFront": "721,486,31,38",
+    "roiBack": "206,462,970,134",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
   {
     "itemName": "harvest_chat_close",
     "imageName": "harvest_harvest_chat_close.png",
@@ -53,6 +107,24 @@
     "threshold": 0.8,
     "description": "打开聊天频道会自动关闭"
   },
+  {
+    "itemName": "harvest_sign_3",
+    "imageName": "harvest_harvest_sign_3.png",
+    "roiFront": "291,495,33,36",
+    "roiBack": "100,473,1014,91",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "签到"
+  },
+  {
+    "itemName": "harvest_sign_4",
+    "imageName": "harvest_harvest_sign_4.png",
+    "roiFront": "587,151,100,228",
+    "roiBack": "547,123,185,281",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
   {
     "itemName": "harvest_soul_1",
     "imageName": "harvest_harvest_soul_1.png",
@@ -80,6 +152,15 @@
     "threshold": 0.8,
     "description": "六星御魂标志"
   },
+  {
+    "itemName": "harvest_guild_reward",
+    "imageName": "harvest_harvest_guild_reward.png",
+    "roiFront": "244,498,41,42",
+    "roiBack": "200,403,817,157",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "寮包"
+  },
   {
     "itemName": "harvest_back_pet_house",
     "imageName": "harvest_back_pet_house.png",
@@ -169,50 +250,5 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "邮件红点"
-  },
-  {
-    "itemName": "harvest_one_key",
-    "imageName": "harvest_harvest_one_key.png",
-    "roiFront": "270,220,23,25",
-    "roiBack": "270,220,880,350",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "一键收获按钮"
-  },
-  {
-    "itemName": "harvest_one_key_daily",
-    "imageName": "harvest_harvest_one_key_daily.png",
-    "roiFront": "1125,120,62,36",
-    "roiBack": "1125,120,100,80",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "一键收获每日签到"
-  },
-  {
-    "itemName": "harvest_one_key_finish_button",
-    "imageName": "harvest_harvest_one_key_finish_button.png",
-    "roiFront": "1100,570,82,75",
-    "roiBack": "1100,570,130,130",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "一键收获完成按钮"
-  },
-  {
-    "itemName": "harvest_one_key_wanhua_card_skip",
-    "imageName": "harvest_harvest_one_key_wanhua_card_skip.png",
-    "roiFront": "1120,0,43,18",
-    "roiBack": "1120,0,160,80",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "万华牌跳过按钮"
-  },
-  {
-    "itemName": "harvest_one_key_success",
-    "imageName": "harvest_harvest_one_key_success.png",
-    "roiFront": "280,16,161,35",
-    "roiBack": "280,16,230,70",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "一键收获成功标识"
   }
 ]

+ 35 - 60
tasks/Restart/login.py

@@ -17,7 +17,6 @@ class LoginHandler(BaseTask, RestartAssets, GameUiAssets):
         super().__init__(*wargs, **kwargs)
         self.character = self.config.restart.login_character_config.character
         self.O_LOGIN_SPECIFIC_SERVE.keyword = self.character
-        self._one_key_harvest_done = False
         # self.specific_usr = kwargs['config'].
 
     def _app_handle_login(self) -> bool:
@@ -178,11 +177,6 @@ class LoginHandler(BaseTask, RestartAssets, GameUiAssets):
         while 1:
             self.screenshot()
 
-            # 一键收获流程(替换勾玉、签到、体力、寮包、御魂)
-            if self.harvest_one_key():
-                timer_harvest.reset()
-                continue
-
             # 点击'获得奖励'
             if self.ui_reward_appear_click():
                 timer_harvest.reset()
@@ -221,10 +215,45 @@ class LoginHandler(BaseTask, RestartAssets, GameUiAssets):
                     logger.info('Close zidu')
                 continue
 
+            # 勾玉
+            if self.appear_then_click(self.I_HARVEST_JADE, interval=1.5):
+                timer_harvest.reset()
+                continue
+            # 签到
+            if self.appear_then_click(self.I_HARVEST_SIGN, interval=1.5):
+                self.wait_until_appear(self.I_HARVEST_SIGN_2, wait_time=2)
+                timer_harvest.reset()
+                continue
+            # 某些活动的特殊签到,有空看到就删掉
+            if self.appear_then_click(self.I_HARVEST_SIGN_3, interval=0.7):
+                timer_harvest.reset()
+                continue
+            if self.appear_then_click(self.I_HARVEST_SIGN_4, interval=1):
+                timer_harvest.reset()
+                continue
+            if self.appear_then_click(self.I_HARVEST_SIGN_2, interval=1.5):
+                self.wait_until_appear(self.I_LOGIN_RED_CLOSE, wait_time=2)
+                timer_harvest.reset()
+                continue
+            # 999天的签到福袋
+            if self.appear_then_click(self.I_HARVEST_SIGN_999, interval=1.5):
+                timer_harvest.reset()
+                continue
             # 判断是否勾选了收取邮件(不收取邮件可以查看每日收获)
             if not skip_default and self.config.restart.harvest_config.enable_mail and self.harvest_mail():
                 timer_harvest.reset()
                 continue
+            if self.appear_then_click(self.I_HARVEST_AP, interval=1, threshold=0.7):
+                timer_harvest.reset()
+                continue
+            # 御魂觉醒加成
+            if self.appear_then_click(self.I_HARVEST_SOUL, interval=1):
+                timer_harvest.reset()
+                continue
+            # 寮包
+            if self.appear_then_click(self.I_HARVEST_GUILD_REWARD, interval=2):
+                timer_harvest.reset()
+                continue
             # 自选御魂
             if not skip_default and self.appear(self.I_HARVEST_SOUL_1):
                 logger.info('Select soul 2')
@@ -283,57 +312,3 @@ class LoginHandler(BaseTask, RestartAssets, GameUiAssets):
         self.ui_click_until_disappear(self.I_LOGIN_RED_CLOSE)
         return True
 
-    def harvest_one_key(self) -> bool:
-        """
-        一键收获流程
-        :return: 是否执行了一键收获
-        """
-        if self._one_key_harvest_done:
-            return False
-        
-        if not self.appear(self.I_HARVEST_ONE_KEY):
-            return False
-        
-        logger.info('One key harvest found')
-        self._one_key_harvest_done = True
-        
-        self.appear_then_click(self.I_HARVEST_ONE_KEY, interval=1)
-        logger.info('Click one key harvest button')
-        
-        self.wait_until_appear(self.I_HARVEST_ONE_KEY_FINISH_BUTTON, wait_time=3)
-        
-        if self.appear_then_click(self.I_HARVEST_ONE_KEY_DAILY, interval=1):
-            logger.info('Click one key harvest daily')
-            self.wait_until_appear(self.I_HARVEST_ONE_KEY_FINISH_BUTTON, wait_time=2)
-        
-        self.appear_then_click(self.I_HARVEST_ONE_KEY_FINISH_BUTTON, interval=1)
-        logger.info('Click one key harvest finish button')
-        
-        start_time = time.time()
-        while time.time() - start_time < 5:
-            self.screenshot()
-            if self.appear_then_click(self.I_LOGIN_RED_CLOSE, interval=1):
-                logger.info('Close red close after one key harvest')
-                start_time = time.time()
-                continue
-            
-            if self.appear_then_click(self.I_HARVEST_ONE_KEY_WANHUA_CARD_SKIP, interval=1):
-                logger.info('Click wanhua card skip button')
-                start_time = time.time()
-                continue
-            
-            if self.appear_then_click(self.I_HARVEST_ONE_KEY_CANCEL, interval=1):
-                logger.info('Click one key harvest cancel button')
-                start_time = time.time()
-                continue
-        
-        if self.appear(self.I_HARVEST_ONE_KEY_SUCCESS):
-            self.click(self.C_HARVEST_ONE_KEY_CLOSE_AREA, interval=1)
-            logger.info('Click one key success close area')
-        
-        self.screenshot()
-        if self.appear_then_click(self.I_LOGIN_YELLOW_CLOSE, interval=1):
-            logger.info('Close yellow close after one key harvest')
-        
-        return True
-

BIN
tasks/Restart/login/login_login_red_close.png