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

Merge pull request #454 from yEs1do/feat(DailyTrifles)

每日琐事增加吉闻祝福
huangrunheng 2 лет назад
Родитель
Сommit
43ce58c61c

+ 8 - 0
tasks/DailyTrifles/assets.py

@@ -17,6 +17,14 @@ class DailyTriflesAssets:
 	I_L_LOVE = RuleImage(roi_front=(123,625,67,72), roi_back=(123,625,67,72), threshold=0.9, method="Template matching", file="./tasks/DailyTrifles/love/love_l_love.png")
 	I_L_LOVE = RuleImage(roi_front=(123,625,67,72), roi_back=(123,625,67,72), threshold=0.9, method="Template matching", file="./tasks/DailyTrifles/love/love_l_love.png")
 	# 一键收取 
 	# 一键收取 
 	I_L_COLLECT = RuleImage(roi_front=(47,537,129,56), roi_back=(47,537,129,56), threshold=0.8, method="Template matching", file="./tasks/DailyTrifles/love/love_l_collect.png")
 	I_L_COLLECT = RuleImage(roi_front=(47,537,129,56), roi_back=(47,537,129,56), threshold=0.8, method="Template matching", file="./tasks/DailyTrifles/love/love_l_collect.png")
+	# 吉闻 
+	I_LUCK_MSG = RuleImage(roi_front=(22,47,46,27), roi_back=(22,47,46,27), threshold=0.8, method="Template matching", file="./tasks/DailyTrifles/love/Screenshots_luck_msg.png")
+	# 一键祝福 
+	I_ONE_CLICK_BLESS = RuleImage(roi_front=(1115,500,93,33), roi_back=(1115,500,93,33), threshold=0.8, method="Template matching", file="./tasks/DailyTrifles/love/Screenshots_one_click_bless.png")
+	# 点击祝福 
+	I_CLICK_BLESS = RuleImage(roi_front=(617,442,92,39), roi_back=(617,442,92,39), threshold=0.8, method="Template matching", file="./tasks/DailyTrifles/love/Screenshots_click_bless.png")
+	# 吉闻页 
+	I_LUCK_TITLE = RuleImage(roi_front=(600,52,131,67), roi_back=(600,52,131,67), threshold=0.8, method="Template matching", file="./tasks/DailyTrifles/love/Screenshots_luck_title.png")
 
 
 
 
 	# Image Rule Assets
 	# Image Rule Assets

+ 1 - 0
tasks/DailyTrifles/config.py

@@ -12,6 +12,7 @@ class DailyTriflesConfig(BaseModel):
     one_summon: bool = Field(title='One Summon', default=False)
     one_summon: bool = Field(title='One Summon', default=False)
     guild_wish: bool = Field(title='Guild Wish', default=False)
     guild_wish: bool = Field(title='Guild Wish', default=False)
     friend_love: bool = Field(title='Friend Love', default=False)
     friend_love: bool = Field(title='Friend Love', default=False)
+    luck_msg: bool = Field(title='Luck Msg', default=False)
     store_sign: bool = Field(title='Store Sign', default=False, description='store_sign_help')
     store_sign: bool = Field(title='Store Sign', default=False, description='store_sign_help')
 
 
 
 

BIN
tasks/DailyTrifles/love/Screenshots_click_bless.png


BIN
tasks/DailyTrifles/love/Screenshots_luck_msg.png


BIN
tasks/DailyTrifles/love/Screenshots_luck_title.png


BIN
tasks/DailyTrifles/love/Screenshots_one_click_bless.png


+ 36 - 0
tasks/DailyTrifles/love/image.json

@@ -25,5 +25,41 @@
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "一键收取"
     "description": "一键收取"
+  },
+  {
+    "itemName": "luck_msg",
+    "imageName": "Screenshots_luck_msg.png",
+    "roiFront": "22,47,46,27",
+    "roiBack": "22,47,46,27",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "吉闻"
+  },
+  {
+    "itemName": "one_click_bless",
+    "imageName": "Screenshots_one_click_bless.png",
+    "roiFront": "1115,500,93,33",
+    "roiBack": "1115,500,93,33",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "一键祝福"
+  },
+  {
+    "itemName": "click_bless",
+    "imageName": "Screenshots_click_bless.png",
+    "roiFront": "617,442,92,39",
+    "roiBack": "617,442,92,39",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "点击祝福"
+  },
+  {
+    "itemName": "luck_title",
+    "imageName": "Screenshots_luck_title.png",
+    "roiFront": "600,52,131,67",
+    "roiBack": "600,52,131,67",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "吉闻页"
   }
   }
 ]
 ]

+ 32 - 2
tasks/DailyTrifles/script_task.py

@@ -27,6 +27,8 @@ class ScriptTask(GameUi, Summon, DailyTriflesAssets):
             pass
             pass
         if con.friend_love:
         if con.friend_love:
             self.run_friend_love()
             self.run_friend_love()
+        if con.luck_msg:
+            self.run_luck_msg()
         if con.store_sign:
         if con.store_sign:
             self.run_store_sign()
             self.run_store_sign()
         self.set_next_run('DailyTrifles', success=True, finish=False)
         self.set_next_run('DailyTrifles', success=True, finish=False)
@@ -41,6 +43,34 @@ class ScriptTask(GameUi, Summon, DailyTriflesAssets):
     def run_guild_wish(self):
     def run_guild_wish(self):
         pass
         pass
 
 
+    def run_luck_msg(self):
+        self.ui_get_current_page()
+        self.ui_goto(page_friends)
+        while 1:
+            self.screenshot()
+            if self.appear(self.I_LUCK_TITLE):
+                break
+            if self.appear_then_click(self.I_LUCK_MSG, interval=1):
+                continue
+        logger.info('Start luck msg')
+        check_timer = Timer(2)
+        check_timer.start()
+        while 1:
+            self.screenshot()
+
+            if self.appear_then_click(self.I_CLICK_BLESS, interval=1):
+                continue
+            if self.appear_then_click(self.I_ONE_CLICK_BLESS, interval=1):
+                continue
+            if self.ui_reward_appear_click():
+                logger.info('Get reward of luck msg')
+                break
+            if check_timer.reached():
+                logger.warning('There is no any luck msg')
+                break
+
+        self.ui_click(self.I_UI_BACK_RED, self.I_CHECK_MAIN)
+
     def run_friend_love(self):
     def run_friend_love(self):
         self.ui_get_current_page()
         self.ui_get_current_page()
         self.ui_goto(page_friends)
         self.ui_goto(page_friends)
@@ -104,10 +134,10 @@ if __name__ == '__main__':
     from module.config.config import Config
     from module.config.config import Config
     from module.device.device import Device
     from module.device.device import Device
 
 
-    c = Config('oas1')
+    c = Config('du')
     d = Device(c)
     d = Device(c)
     t = ScriptTask(c, d)
     t = ScriptTask(c, d)
 
 
     # t.run_one_summon()
     # t.run_one_summon()
-    t.run_store_sign()
+    t.run_luck_msg()