ljxun 2 лет назад
Родитель
Сommit
38b1abdca2

+ 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_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

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",
     "threshold": 0.8,
     "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
         if con.friend_love:
             self.run_friend_love()
+            self.run_luck_msg()
+
         if con.store_sign:
             self.run_store_sign()
         self.set_next_run('DailyTrifles', success=True, finish=False)
@@ -41,6 +43,34 @@ class ScriptTask(GameUi, Summon, DailyTriflesAssets):
     def run_guild_wish(self):
         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 friend love')
+                break
+            if check_timer.reached():
+                logger.warning('There is no any love')
+                break
+
+        self.ui_click(self.I_UI_BACK_RED, self.I_CHECK_MAIN)
+
     def run_friend_love(self):
         self.ui_get_current_page()
         self.ui_goto(page_friends)
@@ -104,10 +134,10 @@ if __name__ == '__main__':
     from module.config.config import Config
     from module.device.device import Device
 
-    c = Config('oas1')
+    c = Config('du')
     d = Device(c)
     t = ScriptTask(c, d)
 
     # t.run_one_summon()
-    t.run_store_sign()
+    t.run_luck_msg()