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

Merge pull request #84 from runhey/dev

Dev
huangrunheng 3 лет назад
Родитель
Сommit
722312a4cf

BIN
tasks/ActivityShikigami/as/as_ap.png


BIN
tasks/ActivityShikigami/as/as_ap_activity.png


BIN
tasks/ActivityShikigami/as/as_back_green.png


BIN
tasks/ActivityShikigami/as/as_battle.png


BIN
tasks/ActivityShikigami/as/as_fire.png


BIN
tasks/ActivityShikigami/as/as_lock.png


BIN
tasks/ActivityShikigami/as/as_shi.png


BIN
tasks/ActivityShikigami/as/as_switch.png


BIN
tasks/ActivityShikigami/as/as_unlock.png


+ 13 - 13
tasks/ActivityShikigami/as/image.json

@@ -2,8 +2,8 @@
   {
   {
     "itemName": "shi",
     "itemName": "shi",
     "imageName": "as_shi.png",
     "imageName": "as_shi.png",
-    "roiFront": "135,146,64,53",
-    "roiBack": "80,132,1029,76",
+    "roiFront": "136,237,59,42",
+    "roiBack": "85,170,1029,142",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.7,
     "threshold": 0.7,
     "description": "进入活动"
     "description": "进入活动"
@@ -11,8 +11,8 @@
   {
   {
     "itemName": "back_green",
     "itemName": "back_green",
     "imageName": "as_back_green.png",
     "imageName": "as_back_green.png",
-    "roiFront": "23,18,49,49",
-    "roiBack": "23,18,49,49",
+    "roiFront": "13,18,49,49",
+    "roiBack": "13,18,49,49",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "左上角返回"
     "description": "左上角返回"
@@ -20,8 +20,8 @@
   {
   {
     "itemName": "battle",
     "itemName": "battle",
     "imageName": "as_battle.png",
     "imageName": "as_battle.png",
-    "roiFront": "568,171,52,177",
-    "roiBack": "568,171,52,177",
+    "roiFront": "150,312,52,177",
+    "roiBack": "150,312,52,177",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "进入爬塔"
     "description": "进入爬塔"
@@ -38,8 +38,8 @@
   {
   {
     "itemName": "lock",
     "itemName": "lock",
     "imageName": "as_lock.png",
     "imageName": "as_lock.png",
-    "roiFront": "806,642,30,32",
-    "roiBack": "806,642,30,32",
+    "roiFront": "793,654,30,32",
+    "roiBack": "793,654,30,32",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "上锁图标"
     "description": "上锁图标"
@@ -47,8 +47,8 @@
   {
   {
     "itemName": "unlock",
     "itemName": "unlock",
     "imageName": "as_unlock.png",
     "imageName": "as_unlock.png",
-    "roiFront": "807,640,27,35",
-    "roiBack": "807,640,27,35",
+    "roiFront": "795,650,27,35",
+    "roiBack": "795,650,27,35",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "还未上锁图片"
     "description": "还未上锁图片"
@@ -74,8 +74,8 @@
   {
   {
     "itemName": "ap_activity",
     "itemName": "ap_activity",
     "imageName": "as_ap_activity.png",
     "imageName": "as_ap_activity.png",
-    "roiFront": "1109,502,27,27",
-    "roiBack": "1109,502,27,27",
+    "roiFront": "1120,510,27,27",
+    "roiBack": "1120,510,27,27",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "活动体力"
     "description": "活动体力"
@@ -93,7 +93,7 @@
     "itemName": "buy_jade",
     "itemName": "buy_jade",
     "imageName": "as_buy_jade.png",
     "imageName": "as_buy_jade.png",
     "roiFront": "836,619,38,42",
     "roiFront": "836,619,38,42",
-    "roiBack": "789,614,143,52",
+    "roiBack": "836,619,38,42",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "购买活动的体力"
     "description": "购买活动的体力"

+ 2 - 2
tasks/ActivityShikigami/as/ocr.json

@@ -1,8 +1,8 @@
 [
 [
   {
   {
     "itemName": "remain_ap",
     "itemName": "remain_ap",
-    "roiFront": "1120,671,90,30",
-    "roiBack": "1120,671,90,30",
+    "roiFront": "1126,690,87,28",
+    "roiBack": "1126,690,87,28",
     "mode": "DigitCounter",
     "mode": "DigitCounter",
     "method": "Default",
     "method": "Default",
     "keyword": "",
     "keyword": "",

+ 8 - 8
tasks/ActivityShikigami/assets.py

@@ -12,27 +12,27 @@ class ActivityShikigamiAssets:
 
 
 	# Image Rule Assets
 	# Image Rule Assets
 	# 进入活动 
 	# 进入活动 
-	I_SHI = RuleImage(roi_front=(135,146,64,53), roi_back=(80,132,1029,76), threshold=0.7, method="Template matching", file="./tasks/ActivityShikigami/as/as_shi.png")
+	I_SHI = RuleImage(roi_front=(136,237,59,42), roi_back=(85,170,1029,142), threshold=0.7, method="Template matching", file="./tasks/ActivityShikigami/as/as_shi.png")
 	# 左上角返回 
 	# 左上角返回 
-	I_BACK_GREEN = RuleImage(roi_front=(23,18,49,49), roi_back=(23,18,49,49), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_back_green.png")
+	I_BACK_GREEN = RuleImage(roi_front=(13,18,49,49), roi_back=(13,18,49,49), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_back_green.png")
 	# 进入爬塔 
 	# 进入爬塔 
-	I_BATTLE = RuleImage(roi_front=(568,171,52,177), roi_back=(568,171,52,177), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_battle.png")
+	I_BATTLE = RuleImage(roi_front=(150,312,52,177), roi_back=(150,312,52,177), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_battle.png")
 	# 归鹿之途 
 	# 归鹿之途 
 	I_DRUM = RuleImage(roi_front=(902,379,41,43), roi_back=(902,379,41,43), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_drum.png")
 	I_DRUM = RuleImage(roi_front=(902,379,41,43), roi_back=(902,379,41,43), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_drum.png")
 	# 上锁图标 
 	# 上锁图标 
-	I_LOCK = RuleImage(roi_front=(806,642,30,32), roi_back=(806,642,30,32), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_lock.png")
+	I_LOCK = RuleImage(roi_front=(793,654,30,32), roi_back=(793,654,30,32), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_lock.png")
 	# 还未上锁图片 
 	# 还未上锁图片 
-	I_UNLOCK = RuleImage(roi_front=(807,640,27,35), roi_back=(807,640,27,35), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_unlock.png")
+	I_UNLOCK = RuleImage(roi_front=(795,650,27,35), roi_back=(795,650,27,35), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_unlock.png")
 	# 点击战斗 
 	# 点击战斗 
 	I_FIRE = RuleImage(roi_front=(1123,563,106,116), roi_back=(1123,563,106,116), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_fire.png")
 	I_FIRE = RuleImage(roi_front=(1123,563,106,116), roi_back=(1123,563,106,116), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_fire.png")
 	# 体力按钮 
 	# 体力按钮 
 	I_AP = RuleImage(roi_front=(1116,498,27,37), roi_back=(1116,498,27,37), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_ap.png")
 	I_AP = RuleImage(roi_front=(1116,498,27,37), roi_back=(1116,498,27,37), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_ap.png")
 	# 活动体力 
 	# 活动体力 
-	I_AP_ACTIVITY = RuleImage(roi_front=(1109,502,27,27), roi_back=(1109,502,27,27), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_ap_activity.png")
+	I_AP_ACTIVITY = RuleImage(roi_front=(1120,510,27,27), roi_back=(1120,510,27,27), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_ap_activity.png")
 	# 切换按键 
 	# 切换按键 
 	I_SWITCH = RuleImage(roi_front=(1207,505,33,30), roi_back=(1207,505,33,30), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_switch.png")
 	I_SWITCH = RuleImage(roi_front=(1207,505,33,30), roi_back=(1207,505,33,30), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_switch.png")
 	# 购买活动的体力 
 	# 购买活动的体力 
-	I_BUY_JADE = RuleImage(roi_front=(836,619,38,42), roi_back=(789,614,143,52), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_buy_jade.png")
+	I_BUY_JADE = RuleImage(roi_front=(836,619,38,42), roi_back=(836,619,38,42), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_buy_jade.png")
 	# 增加到最大 
 	# 增加到最大 
 	I_ADD_MAX = RuleImage(roi_front=(974,524,57,54), roi_back=(974,524,57,54), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_add_max.png")
 	I_ADD_MAX = RuleImage(roi_front=(974,524,57,54), roi_back=(974,524,57,54), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_add_max.png")
 	# description 
 	# description 
@@ -41,7 +41,7 @@ class ActivityShikigamiAssets:
 
 
 	# Ocr Rule Assets
 	# Ocr Rule Assets
 	# 体力的数量检测 
 	# 体力的数量检测 
-	O_REMAIN_AP = RuleOcr(roi=(1120,671,90,30), area=(1120,671,90,30), mode="DigitCounter", method="Default", keyword="", name="remain_ap")
+	O_REMAIN_AP = RuleOcr(roi=(1126,690,87,28), area=(1126,690,87,28), mode="DigitCounter", method="Default", keyword="", name="remain_ap")
 	# 活动体力的剩余检测 
 	# 活动体力的剩余检测 
 	O_REMAIN_AP_ACTIVITY = RuleOcr(roi=(884,20,106,34), area=(884,20,106,34), mode="DigitCounter", method="Default", keyword="", name="remain_ap_activity")
 	O_REMAIN_AP_ACTIVITY = RuleOcr(roi=(884,20,106,34), area=(884,20,106,34), mode="DigitCounter", method="Default", keyword="", name="remain_ap_activity")
 	# 还有多少次购买体力的机会 
 	# 还有多少次购买体力的机会 

+ 1 - 1
tasks/AreaBoss/assets.py

@@ -18,7 +18,7 @@ class AreaBossAssets:
 	# 蓝色的返回 
 	# 蓝色的返回 
 	I_BACK_BLUE = RuleImage(roi_front=(51,30,51,52), roi_back=(4,1,128,110), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/res_back_blue.png")
 	I_BACK_BLUE = RuleImage(roi_front=(51,30,51,52), roi_back=(4,1,128,110), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/res_back_blue.png")
 	# 右上边选中鬼王的 
 	# 右上边选中鬼王的 
-	I_FILTER = RuleImage(roi_front=(1106,29,48,49), roi_back=(1106,29,48,49), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/res_filter.png")
+	I_FILTER = RuleImage(roi_front=(1108,31,48,49), roi_back=(1096,19,78,67), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/res_filter.png")
 	# 选中第一个鬼王的 
 	# 选中第一个鬼王的 
 	I_BATTLE_1 = RuleImage(roi_front=(1066,210,100,100), roi_back=(1066,210,100,100), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/res_battle_1.png")
 	I_BATTLE_1 = RuleImage(roi_front=(1066,210,100,100), roi_back=(1066,210,100,100), threshold=0.8, method="Template matching", file="./tasks/AreaBoss/res/res_battle_1.png")
 	# 选中第二个鬼王的 
 	# 选中第二个鬼王的 

+ 2 - 2
tasks/AreaBoss/res/image.json

@@ -29,8 +29,8 @@
   {
   {
     "itemName": "filter",
     "itemName": "filter",
     "imageName": "res_filter.png",
     "imageName": "res_filter.png",
-    "roiFront": "1106,29,48,49",
-    "roiBack": "1106,29,48,49",
+    "roiFront": "1108,31,48,49",
+    "roiBack": "1096,19,78,67",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "右上边选中鬼王的"
     "description": "右上边选中鬼王的"

BIN
tasks/AreaBoss/res/res_filter.png


+ 4 - 0
tasks/Delegation/assets.py

@@ -58,6 +58,10 @@ class DelegationAssets:
 	I_REWARDS_GET = RuleImage(roi_front=(444,78,100,100), roi_back=(444,78,100,100), threshold=0.8, method="Template matching", file="./tasks/Delegation/rewards/rewards_rewards_get.png")
 	I_REWARDS_GET = RuleImage(roi_front=(444,78,100,100), roi_back=(444,78,100,100), threshold=0.8, method="Template matching", file="./tasks/Delegation/rewards/rewards_rewards_get.png")
 	# description 
 	# description 
 	I_REWARDS_MIN = RuleImage(roi_front=(840,131,44,58), roi_back=(840,131,44,58), threshold=0.8, method="Template matching", file="./tasks/Delegation/rewards/rewards_rewards_min.png")
 	I_REWARDS_MIN = RuleImage(roi_front=(840,131,44,58), roi_back=(840,131,44,58), threshold=0.8, method="Template matching", file="./tasks/Delegation/rewards/rewards_rewards_min.png")
+	# 差强人意 
+	I_REWARDS_FALSE = RuleImage(roi_front=(430,72,100,100), roi_back=(430,72,100,100), threshold=0.8, method="Template matching", file="./tasks/Delegation/rewards/rewards_rewards_false.png")
+	# description 
+	I_CHAT_1 = RuleImage(roi_front=(716,380,318,100), roi_back=(716,380,318,100), threshold=0.8, method="Template matching", file="./tasks/Delegation/rewards/rewards_chat_1.png")
 
 
 
 
 	# Ocr Rule Assets
 	# Ocr Rule Assets

+ 18 - 0
tasks/Delegation/rewards/image.json

@@ -34,5 +34,23 @@
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "description"
     "description": "description"
+  },
+  {
+    "itemName": "rewards_false",
+    "imageName": "rewards_rewards_false.png",
+    "roiFront": "430,72,100,100",
+    "roiBack": "430,72,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "差强人意"
+  },
+  {
+    "itemName": "chat_1",
+    "imageName": "rewards_chat_1.png",
+    "roiFront": "716,380,318,100",
+    "roiBack": "716,380,318,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
   }
   }
 ]
 ]

BIN
tasks/Delegation/rewards/rewards_chat_1.png


BIN
tasks/Delegation/rewards/rewards_rewards_false.png


+ 6 - 0
tasks/Delegation/script_task.py

@@ -97,9 +97,15 @@ class ScriptTask(GameUi, DelegationAssets):
             if self.appear_then_click(self.I_REWARDS_CHAT, interval=1):
             if self.appear_then_click(self.I_REWARDS_CHAT, interval=1):
                 check_timer.reset()
                 check_timer.reset()
                 continue
                 continue
+            if self.appear_then_click(self.I_CHAT_1, interval=1):
+                check_timer.reset()
+                continue
             if self.appear_then_click(self.I_REWARDS_DONE, interval=1):
             if self.appear_then_click(self.I_REWARDS_DONE, interval=1):
                 check_timer.reset()
                 check_timer.reset()
                 continue
                 continue
+            if self.appear_then_click(self.I_REWARDS_FALSE, interval=1):
+                check_timer.reset()
+                continue
 
 
 
 
             if not self.appear(self.I_REWARDS_MIN):
             if not self.appear(self.I_REWARDS_MIN):

+ 2 - 2
tasks/DemonEncounter/script_task.py

@@ -5,7 +5,7 @@ import time
 
 
 from enum import Enum
 from enum import Enum
 from cached_property import cached_property
 from cached_property import cached_property
-from datetime import datetime
+from datetime import datetime, timedelta
 
 
 from module.logger import logger
 from module.logger import logger
 from module.exception import TaskEnd
 from module.exception import TaskEnd
@@ -356,7 +356,7 @@ class ScriptTask(GameUi, GeneralBattle, DemonEncounterAssets):
         elif now.hour >= 22:
         elif now.hour >= 22:
             # 22点之后,推迟到第二天的17:30
             # 22点之后,推迟到第二天的17:30
             logger.info('After 22:00, wait to 17:30')
             logger.info('After 22:00, wait to 17:30')
-            target_time = datetime(now.year, now.month, now.day, 17, 30, 0) + datetime.timedelta(days=1)
+            target_time = datetime(now.year, now.month, now.day, 17, 30, 0) + timedelta(days=1)
             self.set_next_run(task='DemonEncounter', success=False, finish=False, target=target_time)
             self.set_next_run(task='DemonEncounter', success=False, finish=False, target=target_time)
             return False
             return False
         else:
         else:

+ 1 - 1
tasks/GameUi/assets.py

@@ -121,7 +121,7 @@ class GameUiAssets:
 
 
 	# Image Rule Assets
 	# Image Rule Assets
 	# 式神录 
 	# 式神录 
-	I_MAIN_GOTO_SHIKIGAMI_RECORDS = RuleImage(roi_front=(1097,612,56,64), roi_back=(1097,612,56,64), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_main_goto_shikigami_records.png")
+	I_MAIN_GOTO_SHIKIGAMI_RECORDS = RuleImage(roi_front=(1098,611,56,64), roi_back=(1084,589,93,106), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_main_goto_shikigami_records.png")
 	# description 
 	# description 
 	I_MAIN_GOTO_ONMYODO = RuleImage(roi_front=(992,614,51,60), roi_back=(992,614,51,60), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_main_goto_onmyodo.png")
 	I_MAIN_GOTO_ONMYODO = RuleImage(roi_front=(992,614,51,60), roi_back=(992,614,51,60), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_main_goto_onmyodo.png")
 	# description 
 	# description 

+ 2 - 2
tasks/GameUi/page/page_img_3.json

@@ -2,8 +2,8 @@
   {
   {
     "itemName": "main_goto_shikigami_records",
     "itemName": "main_goto_shikigami_records",
     "imageName": "page_main_goto_shikigami_records.png",
     "imageName": "page_main_goto_shikigami_records.png",
-    "roiFront": "1097,612,56,64",
-    "roiBack": "1097,612,56,64",
+    "roiFront": "1098,611,56,64",
+    "roiBack": "1084,589,93,106",
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "式神录"
     "description": "式神录"

BIN
tasks/GameUi/page/page_main_goto_shikigami_records.png


+ 14 - 7
tasks/Hunt/script_task.py

@@ -23,9 +23,6 @@ class ScriptTask(GameUi, GeneralBattle, GeneralInvite, SwitchSoul, HuntAssets):
     def run(self):
     def run(self):
         if not self.check_datetime():
         if not self.check_datetime():
             # 设置下次运行时间 为今天的晚上七点钟
             # 设置下次运行时间 为今天的晚上七点钟
-            now = datetime.now()
-            next_run_time = datetime.combine(now.date(), time(19, 0, 0))
-            self.set_next_run(task='Hunt', success=False, finish=True, target=next_run_time)
             raise TaskEnd('Hunt')
             raise TaskEnd('Hunt')
         con = self.config.hunt.hunt_config
         con = self.config.hunt.hunt_config
         if con.kirin_group_team != '-1,-1' or con.netherworld_group_team != '-1,-1':
         if con.kirin_group_team != '-1,-1' or con.netherworld_group_team != '-1,-1':
@@ -60,11 +57,21 @@ class ScriptTask(GameUi, GeneralBattle, GeneralInvite, SwitchSoul, HuntAssets):
             self.kirin_day = False
             self.kirin_day = False
 
 
 
 
-        if time(18, 59) < now.time() < time(21, 1):
-            return True
+        now = datetime.now()
+        # 如果时间在00:00-19:00 之间则设定时间为当天的19:00,返回False
+        if now.time() < time(19, 0):
+            next_run = datetime.combine(now.date(), time(19, 0))
+            self.set_next_run(task='Hunt', success=False, finish=True, target=next_run)
+            raise TaskEnd('Hunt')
+        # 如果是在21:00-23:59之间则设定时间为明天的19:00,返回False
+        elif now.time() > time(21, 0):
+            next_run = datetime.combine(now.date() + timedelta(days=1), time(19, 0))
+            self.set_next_run(task='Hunt', success=False, finish=True, target=next_run)
+            raise TaskEnd('Hunt')
+        # 如果是在19:00-21:00之间则返回True
         else:
         else:
-            logger.warning('Not in the time period')
-            return False
+            return True
+
 
 
     def kirin(self):
     def kirin(self):
         logger.hr('kirin', 2)
         logger.hr('kirin', 2)