Przeglądaj źródła

feat(task): Save WeeklyTrifles because secret hasn't started yet

runhey 3 lat temu
rodzic
commit
fd6705367a
27 zmienionych plików z 494 dodań i 3 usunięć
  1. BIN
      module/config/i18n/zh_CN.qm
  2. 11 0
      module/config/i18n/zh_CN.ts
  3. 12 0
      tasks/Secret/assets.py
  4. BIN
      tasks/WeeklyTrifles/area_boss/area_boss_wt_ab_jade.png
  5. BIN
      tasks/WeeklyTrifles/area_boss/area_boss_wt_ab_wechat.png
  6. BIN
      tasks/WeeklyTrifles/area_boss/area_boss_wt_day_battle.png
  7. BIN
      tasks/WeeklyTrifles/area_boss/area_boss_wt_no_day.png
  8. BIN
      tasks/WeeklyTrifles/area_boss/area_boss_wt_share_ab.png
  9. 8 0
      tasks/WeeklyTrifles/area_boss/click.json
  10. 47 0
      tasks/WeeklyTrifles/area_boss/image.json
  11. 68 0
      tasks/WeeklyTrifles/assets.py
  12. BIN
      tasks/WeeklyTrifles/broken_amulet/broken_amulet_bm_again.png
  13. BIN
      tasks/WeeklyTrifles/broken_amulet/broken_amulet_bm_confirm.png
  14. BIN
      tasks/WeeklyTrifles/broken_amulet/broken_amulet_bm_enter.png
  15. 29 0
      tasks/WeeklyTrifles/broken_amulet/image.json
  16. 20 0
      tasks/WeeklyTrifles/broken_amulet/ocr.json
  17. 8 0
      tasks/WeeklyTrifles/collect/click.json
  18. BIN
      tasks/WeeklyTrifles/collect/collect_wt_collect.png
  19. BIN
      tasks/WeeklyTrifles/collect/collect_wt_collect_wechat.png
  20. BIN
      tasks/WeeklyTrifles/collect/collect_wt_qr_code.png
  21. BIN
      tasks/WeeklyTrifles/collect/collect_wt_scroll.png
  22. BIN
      tasks/WeeklyTrifles/collect/collect_wt_scroll_1.png
  23. BIN
      tasks/WeeklyTrifles/collect/collect_wt_scroll_2.png
  24. BIN
      tasks/WeeklyTrifles/collect/collect_wt_shikiagmi.png
  25. 65 0
      tasks/WeeklyTrifles/collect/image.json
  26. 7 0
      tasks/WeeklyTrifles/config.py
  27. 219 3
      tasks/WeeklyTrifles/script_task.py

BIN
module/config/i18n/zh_CN.qm


+ 11 - 0
module/config/i18n/zh_CN.ts

@@ -612,4 +612,15 @@ Refresh:直接刷新,如果刷新操作进入CD,将标记为失败并退
 	<message><source>Black Daruma Scrap</source><translation>御行达摩碎片</translation></message>
 	<message><source>Black Daruma Scrap</source><translation>御行达摩碎片</translation></message>
 	<message><source>Black Daruma</source><translation>御行达摩</translation></message>
 	<message><source>Black Daruma</source><translation>御行达摩</translation></message>
 </context>	
 </context>	
+<context>
+    <name>Args</name>
+	<message><source>Share Collect</source><translation>图鉴分享</translation></message>	
+	<message><source>Share Area Boss</source><translation>地鬼分享</translation></message>	
+	<message><source>Share Secret</source><translation>秘闻分享</translation></message>
+	<message><source>share_collect_help</source><translation>每周一张票、不要白不要</translation></message>
+	<message><source>share_area_boss_help</source><translation>没什么建议,勾上就对了</translation></message>
+	<message><source>share_secret_help</source><translation>建议在秘闻结束后再来执行这个任务</translation></message>
+	<message><source>trifles_broken_amulet_help</source><translation>建议设置大点每周清空去</translation></message>
+	<message><source>Trifles</source><translation>启用</translation></message>
+</context>		
 </TS>
 </TS>

+ 12 - 0
tasks/Secret/assets.py

@@ -0,0 +1,12 @@
+from module.atom.image import RuleImage
+from module.atom.click import RuleClick
+from module.atom.long_click import RuleLongClick
+from module.atom.swipe import RuleSwipe
+from module.atom.ocr import RuleOcr
+from module.atom.list import RuleList
+
+# This file was automatically generated by ./dev_tools/assets_extract.py.
+# Don't modify it manually.
+class SecretAssets: 
+	pass
+

BIN
tasks/WeeklyTrifles/area_boss/area_boss_wt_ab_jade.png


BIN
tasks/WeeklyTrifles/area_boss/area_boss_wt_ab_wechat.png


BIN
tasks/WeeklyTrifles/area_boss/area_boss_wt_day_battle.png


BIN
tasks/WeeklyTrifles/area_boss/area_boss_wt_no_day.png


BIN
tasks/WeeklyTrifles/area_boss/area_boss_wt_share_ab.png


+ 8 - 0
tasks/WeeklyTrifles/area_boss/click.json

@@ -0,0 +1,8 @@
+[
+  {
+    "itemName": "wt_ab_click",
+    "roiFront": "168,362,68,72",
+    "roiBack": "168,362,68,72",
+    "description": "进入已经挑战的第一个"
+  }
+]

+ 47 - 0
tasks/WeeklyTrifles/area_boss/image.json

@@ -0,0 +1,47 @@
+[
+  {
+    "itemName": "wt_day_battle",
+    "imageName": "area_boss_wt_day_battle.png",
+    "roiFront": "40,365,65,66",
+    "roiBack": "40,365,65,66",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "今日挑战"
+  },
+  {
+    "itemName": "wt_no_day",
+    "imageName": "area_boss_wt_no_day.png",
+    "roiFront": "167,360,72,69",
+    "roiBack": "167,360,72,69",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "今天一个都没有打"
+  },
+  {
+    "itemName": "wt_share_ab",
+    "imageName": "area_boss_wt_share_ab.png",
+    "roiFront": "1131,429,45,39",
+    "roiBack": "1131,429,45,39",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "地鬼分享"
+  },
+  {
+    "itemName": "wt_ab_jade",
+    "imageName": "area_boss_wt_ab_jade.png",
+    "roiFront": "922,554,44,47",
+    "roiBack": "922,554,44,47",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "分享勾玉"
+  },
+  {
+    "itemName": "wt_ab_wechat",
+    "imageName": "area_boss_wt_ab_wechat.png",
+    "roiFront": "1032,643,50,56",
+    "roiBack": "1032,643,50,56",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "微信分享"
+  }
+]

+ 68 - 0
tasks/WeeklyTrifles/assets.py

@@ -0,0 +1,68 @@
+from module.atom.image import RuleImage
+from module.atom.click import RuleClick
+from module.atom.long_click import RuleLongClick
+from module.atom.swipe import RuleSwipe
+from module.atom.ocr import RuleOcr
+from module.atom.list import RuleList
+
+# This file was automatically generated by ./dev_tools/assets_extract.py.
+# Don't modify it manually.
+class WeeklyTriflesAssets: 
+
+
+	# Click Rule Assets
+	# 进入已经挑战的第一个 
+	C_WT_AB_CLICK = RuleClick(roi_front=(168,362,68,72), roi_back=(168,362,68,72), name="wt_ab_click")
+
+
+	# Image Rule Assets
+	# 今日挑战 
+	I_WT_DAY_BATTLE = RuleImage(roi_front=(40,365,65,66), roi_back=(40,365,65,66), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/area_boss/area_boss_wt_day_battle.png")
+	# 今天一个都没有打 
+	I_WT_NO_DAY = RuleImage(roi_front=(167,360,72,69), roi_back=(167,360,72,69), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/area_boss/area_boss_wt_no_day.png")
+	# 地鬼分享 
+	I_WT_SHARE_AB = RuleImage(roi_front=(1131,429,45,39), roi_back=(1131,429,45,39), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/area_boss/area_boss_wt_share_ab.png")
+	# 分享勾玉 
+	I_WT_AB_JADE = RuleImage(roi_front=(922,554,44,47), roi_back=(922,554,44,47), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/area_boss/area_boss_wt_ab_jade.png")
+	# 微信分享 
+	I_WT_AB_WECHAT = RuleImage(roi_front=(1032,643,50,56), roi_back=(1032,643,50,56), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/area_boss/area_boss_wt_ab_wechat.png")
+
+
+	# Image Rule Assets
+	# 进入普通召唤 
+	I_BM_ENTER = RuleImage(roi_front=(399,601,62,68), roi_back=(399,601,62,68), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/broken_amulet/broken_amulet_bm_enter.png")
+	# 确定 
+	I_BM_CONFIRM = RuleImage(roi_front=(418,620,173,59), roi_back=(418,620,173,59), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/broken_amulet/broken_amulet_bm_confirm.png")
+	# 再次召唤 
+	I_BM_AGAIN = RuleImage(roi_front=(686,617,178,60), roi_back=(686,617,178,60), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/broken_amulet/broken_amulet_bm_again.png")
+
+
+	# Ocr Rule Assets
+	# 左上角的数量 
+	O_BA_AMOUNT_1 = RuleOcr(roi=(360,11,86,36), area=(360,11,86,36), mode="Digit", method="Default", keyword="", name="ba_amount_1")
+	# 召唤的时候的数量 
+	O_BA_AMOUNT_2 = RuleOcr(roi=(762,570,118,35), area=(762,570,118,35), mode="DigitCounter", method="Default", keyword="", name="ba_amount_2")
+
+
+	# Click Rule Assets
+	# 微信分享的点击 
+	C_WT_WECHAT = RuleClick(roi_front=(470,111,337,44), roi_back=(470,111,337,44), name="wt_wechat")
+
+
+	# Image Rule Assets
+	# 点击“式神” 
+	I_WT_SHIKIAGMI = RuleImage(roi_front=(494,650,56,49), roi_back=(494,650,56,49), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/collect/collect_wt_shikiagmi.png")
+	# 点击式神绘卷 
+	I_WT_SCROLL = RuleImage(roi_front=(1128,615,77,67), roi_back=(1128,615,77,67), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/collect/collect_wt_scroll.png")
+	# 点击分享 
+	I_WT_COLLECT = RuleImage(roi_front=(1170,606,78,83), roi_back=(1170,606,78,83), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/collect/collect_wt_collect.png")
+	# 百鬼夜行图 
+	I_WT_SCROLL_1 = RuleImage(roi_front=(1186,28,28,121), roi_back=(1186,28,28,121), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/collect/collect_wt_scroll_1.png")
+	# 百妖风物鉴 
+	I_WT_SCROLL_2 = RuleImage(roi_front=(1186,26,24,122), roi_back=(1186,26,24,122), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/collect/collect_wt_scroll_2.png")
+	# 微信分享 
+	I_WT_COLLECT_WECHAT = RuleImage(roi_front=(640,617,70,63), roi_back=(640,617,70,63), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/collect/collect_wt_collect_wechat.png")
+	# 二维码 
+	I_WT_QR_CODE = RuleImage(roi_front=(473,160,336,96), roi_back=(473,160,336,96), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/collect/collect_wt_qr_code.png")
+
+

BIN
tasks/WeeklyTrifles/broken_amulet/broken_amulet_bm_again.png


BIN
tasks/WeeklyTrifles/broken_amulet/broken_amulet_bm_confirm.png


BIN
tasks/WeeklyTrifles/broken_amulet/broken_amulet_bm_enter.png


+ 29 - 0
tasks/WeeklyTrifles/broken_amulet/image.json

@@ -0,0 +1,29 @@
+[
+  {
+    "itemName": "bm_enter",
+    "imageName": "broken_amulet_bm_enter.png",
+    "roiFront": "399,601,62,68",
+    "roiBack": "399,601,62,68",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "进入普通召唤"
+  },
+  {
+    "itemName": "bm_confirm",
+    "imageName": "broken_amulet_bm_confirm.png",
+    "roiFront": "418,620,173,59",
+    "roiBack": "418,620,173,59",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "确定"
+  },
+  {
+    "itemName": "bm_again",
+    "imageName": "broken_amulet_bm_again.png",
+    "roiFront": "686,617,178,60",
+    "roiBack": "686,617,178,60",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "再次召唤"
+  }
+]

+ 20 - 0
tasks/WeeklyTrifles/broken_amulet/ocr.json

@@ -0,0 +1,20 @@
+[
+  {
+    "itemName": "ba_amount_1",
+    "roiFront": "360,11,86,36",
+    "roiBack": "360,11,86,36",
+    "mode": "Digit",
+    "method": "Default",
+    "keyword": "",
+    "description": "左上角的数量"
+  },
+  {
+    "itemName": "ba_amount_2",
+    "roiFront": "762,570,118,35",
+    "roiBack": "762,570,118,35",
+    "mode": "DigitCounter",
+    "method": "Default",
+    "keyword": "",
+    "description": "召唤的时候的数量"
+  }
+]

+ 8 - 0
tasks/WeeklyTrifles/collect/click.json

@@ -0,0 +1,8 @@
+[
+  {
+    "itemName": "wt_wechat",
+    "roiFront": "470,111,337,44",
+    "roiBack": "470,111,337,44",
+    "description": "微信分享的点击"
+  }
+]

BIN
tasks/WeeklyTrifles/collect/collect_wt_collect.png


BIN
tasks/WeeklyTrifles/collect/collect_wt_collect_wechat.png


BIN
tasks/WeeklyTrifles/collect/collect_wt_qr_code.png


BIN
tasks/WeeklyTrifles/collect/collect_wt_scroll.png


BIN
tasks/WeeklyTrifles/collect/collect_wt_scroll_1.png


BIN
tasks/WeeklyTrifles/collect/collect_wt_scroll_2.png


BIN
tasks/WeeklyTrifles/collect/collect_wt_shikiagmi.png


+ 65 - 0
tasks/WeeklyTrifles/collect/image.json

@@ -0,0 +1,65 @@
+[
+  {
+    "itemName": "wt_shikiagmi",
+    "imageName": "collect_wt_shikiagmi.png",
+    "roiFront": "494,650,56,49",
+    "roiBack": "494,650,56,49",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "点击“式神”"
+  },
+  {
+    "itemName": "wt_scroll",
+    "imageName": "collect_wt_scroll.png",
+    "roiFront": "1128,615,77,67",
+    "roiBack": "1128,615,77,67",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "点击式神绘卷"
+  },
+  {
+    "itemName": "wt_collect",
+    "imageName": "collect_wt_collect.png",
+    "roiFront": "1170,606,78,83",
+    "roiBack": "1170,606,78,83",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "点击分享"
+  },
+  {
+    "itemName": "wt_scroll_1",
+    "imageName": "collect_wt_scroll_1.png",
+    "roiFront": "1186,28,28,121",
+    "roiBack": "1186,28,28,121",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "百鬼夜行图"
+  },
+  {
+    "itemName": "wt_scroll_2",
+    "imageName": "collect_wt_scroll_2.png",
+    "roiFront": "1186,26,24,122",
+    "roiBack": "1186,26,24,122",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "百妖风物鉴"
+  },
+  {
+    "itemName": "wt_collect_wechat",
+    "imageName": "collect_wt_collect_wechat.png",
+    "roiFront": "640,617,70,63",
+    "roiBack": "640,617,70,63",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "微信分享"
+  },
+  {
+    "itemName": "wt_qr_code",
+    "imageName": "collect_wt_qr_code.png",
+    "roiFront": "473,160,336,96",
+    "roiBack": "473,160,336,96",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "二维码"
+  }
+]

+ 7 - 0
tasks/WeeklyTrifles/config.py

@@ -11,7 +11,14 @@ class Scheduler(BaseScheduler):
     success_interval: TimeDelta = Field(default=TimeDelta(days=7), description='success_interval_help')
     success_interval: TimeDelta = Field(default=TimeDelta(days=7), description='success_interval_help')
     failure_interval: TimeDelta = Field(default=TimeDelta(days=7), description='failure_interval_help')
     failure_interval: TimeDelta = Field(default=TimeDelta(days=7), description='failure_interval_help')
 
 
+class Trifles(BaseModel):
+    share_collect: bool = Field(default=True, description='share_collect_help')
+    share_area_boss: bool = Field(default=True, description='share_area_boss_help')
+    share_secret: bool = Field(default=True, description='share_secret_help')
+    broken_amulet: int = Field(title='Broken Amulet', default=100, description='trifles_broken_amulet_help')
+
 
 
 class WeeklyTrifles(ConfigBase):
 class WeeklyTrifles(ConfigBase):
     scheduler: Scheduler = Field(default_factory=Scheduler)
     scheduler: Scheduler = Field(default_factory=Scheduler)
+    trifles: Trifles = Field(default_factory=Trifles)
 
 

+ 219 - 3
tasks/WeeklyTrifles/script_task.py

@@ -1,16 +1,232 @@
 # This Python file uses the following encoding: utf-8
 # This Python file uses the following encoding: utf-8
 # @author runhey
 # @author runhey
 # github https://github.com/runhey
 # github https://github.com/runhey
+import time
+
 from module.exception import TaskEnd
 from module.exception import TaskEnd
 from module.logger import logger
 from module.logger import logger
 from module.base.timer import Timer
 from module.base.timer import Timer
 
 
 from tasks.GameUi.game_ui import GameUi
 from tasks.GameUi.game_ui import GameUi
-from tasks.GameUi.page import page_main, page_team
+from tasks.GameUi.page import page_main, page_collection, page_area_boss, page_secret_zones, page_summon
+from tasks.WeeklyTrifles.config import Trifles
+from tasks.WeeklyTrifles.assets import WeeklyTriflesAssets
 
 
-class ScriptTask(GameUi):
+class ScriptTask(GameUi, WeeklyTriflesAssets):
 
 
     def run(self):
     def run(self):
+        con = self.config.weekly_trifles.trifles
 
 
         self.set_next_run(task='WeeklyTrifles', success=True, finish=True)
         self.set_next_run(task='WeeklyTrifles', success=True, finish=True)
-        raise TaskEnd('WeeklyTrifles')
+        raise TaskEnd('WeeklyTrifles')
+
+
+    def click_share(self, wechat) -> bool:
+        """
+        点击分享
+        :param wechat:
+        :return:
+        """
+        # 点击分享
+        self.ui_click(wechat, self.I_WT_QR_CODE)
+        logger.info('Click share')
+        get_timer = Timer(3)
+        get_timer.start()
+        while 1:
+            self.screenshot()
+            if self.ui_reward_appear_click():
+                logger.info('Get reward')
+                return True
+            if self.appear_then_click(self.I_WT_QR_CODE, self.C_WT_WECHAT, interval=0.8):
+                continue
+            if get_timer.reached():
+                logger.warning('Share timeout. The reward may have been obtained')
+                return False
+
+    def _share_collect(self):
+        """
+        图鉴分享
+        :return:
+        """
+        logger.hr('Share collect')
+        self.ui_get_current_page()
+        self.ui_goto(page_collection)
+        # 一路进去
+        while 1:
+            self.screenshot()
+            if self.appear(self.I_WT_COLLECT):
+                break
+            if self.appear_then_click(self.I_WT_SHIKIAGMI, interval=1):
+                continue
+            if self.appear_then_click(self.I_WT_SCROLL, interval=1):
+                continue
+        # 确认的是百鬼夜行图
+        self.ui_click(self.I_WT_SCROLL_2, self.I_WT_SCROLL_1)
+        logger.info('Confirm the picture is 百妖风物鉴')
+        # 点击分享
+        while 1:
+            self.screenshot()
+            if self.appear(self.I_WT_QR_CODE):
+                break
+            if self.appear_then_click(self.I_WT_COLLECT_WECHAT, interval=1):
+                continue
+            if self.appear_then_click(self.I_WT_COLLECT, interval=1):
+                continue
+        logger.info('Click share')
+        get_timer = Timer(3)
+        get_timer.start()
+        while 1:
+            self.screenshot()
+
+            if self.ui_reward_appear_click():
+                logger.info('Get reward')
+                break
+
+            if self.appear_then_click(self.I_WT_QR_CODE, self.C_WT_WECHAT, interval=0.8):
+                continue
+            if get_timer.reached():
+                logger.warning('Share timeout. The reward may have been obtained')
+                break
+        # 返回
+        while 1:
+            self.screenshot()
+            if self.appear(self.I_WT_SHIKIAGMI):
+                break
+            if self.appear_then_click(self.I_UI_BACK_RED, interval=1):
+                continue
+            if self.appear_then_click(self.I_UI_BACK_BLUE, interval=1):
+                continue
+            if self.appear_then_click(self.I_UI_BACK_YELLOW, interval=1):
+                continue
+
+    def _share_area_boss(self):
+        """
+        地鬼分享
+        :return:
+        """
+        def back_boss():
+            while 1:
+                self.screenshot()
+                if self.appear(self.I_WT_DAY_BATTLE) or self.appear(self.I_CHECK_EXPLORATION):
+                    break
+                if self.appear_then_click(self.I_UI_BACK_RED, interval=1):
+                    continue
+                if self.appear_then_click(self.I_UI_BACK_BLUE, interval=1):
+                    continue
+                if self.appear_then_click(self.I_UI_BACK_YELLOW, interval=1):
+                    continue
+            logger.info('Back to boss')
+        logger.hr('Share area boss')
+        self.ui_get_current_page()
+        self.ui_goto(page_area_boss)
+
+        # 一路进去
+        obtained = False
+        while 1:
+            self.screenshot()
+            if self.appear(self.I_WT_AB_WECHAT):
+                break
+            if self.appear(self.I_WT_NO_DAY):
+                obtained = True
+                break
+            if self.click(self.C_WT_AB_CLICK, interval=1):
+                continue
+            if self.appear_then_click(self.I_WT_DAY_BATTLE, interval=2):
+                continue
+            if self.appear_then_click(self.I_WT_SHARE_AB, interval=1):
+                continue
+        # 再次检查一次这周有没有领取
+        time.sleep(1)
+        self.screenshot()
+        if not self.appear(self.I_WT_AB_JADE):
+            logger.warning('This week has been obtained')
+            obtained = True
+        if obtained:
+            back_boss()
+        # 点击分享
+        self.click_share(self.I_WT_AB_WECHAT)
+        back_boss()
+
+    def _share_secret(self):
+        """
+        TODO 秘闻分享
+        :return:
+        """
+        logger.hr('Share secret')
+        self.ui_get_current_page()
+        self.ui_goto(page_secret_zones)
+
+    def _broken_amulet(self, num: int):
+        """
+
+        :param num:
+        :return:
+        """
+        def click_confirm():
+            self.wait_until_appear(self.I_BM_CONFIRM)
+            while 1:
+                self.screenshot()
+                if not self.appear(self.I_BM_CONFIRM):
+                    break
+                else:
+                    self.appear_then_click(self.I_BM_CONFIRM, interval=1)
+            logger.info('Exit broken amulet')
+
+        logger.hr('Broken amulet')
+        self.ui_get_current_page()
+        self.ui_goto(page_summon)
+        self.screenshot()
+        number = self.O_BA_AMOUNT_1.ocr(self.device.image)
+        if number == 0:
+            logger.warning('No broken amulet')
+            return
+        logger.info(f'Broken amulet: {number}')
+        count = 0
+        self.wait_until_appear(self.I_BM_ENTER)
+        while 1:
+            self.screenshot()
+            if not self.appear(self.I_BM_ENTER):
+                break
+            if self.appear_then_click(self.I_BM_ENTER, interval=1):
+                continue
+        count += 10
+        logger.info('Enter broken amulet')
+        while 1:
+            self.screenshot()
+            time.sleep(0.5)
+
+            if not self.appear(self.I_BM_CONFIRM):
+                continue
+            if count >= num:
+                logger.info(f'Broken amulet finished: {count}')
+                click_confirm()
+                break
+            cu, re, total = self.O_BA_AMOUNT_2.ocr(self.device.image)
+            if cu <= 10 and total == 10:
+                logger.info(f'Broken amulet count: {count}. Current: {cu}. Total: {total}')
+                click_confirm()
+                break
+            if self.appear_then_click(self.I_BM_AGAIN, interval=1):
+                logger.info(f'Broken amulet count: {count}. Current: {cu}')
+                self.device.click_record_clear()
+                count += 10
+                continue
+
+
+
+
+
+
+
+
+if __name__ == '__main__':
+    from module.config.config import Config
+    from module.device.device import Device
+    c = Config('oas1')
+    d = Device(c)
+    t = ScriptTask(c, d)
+    t.screenshot()
+
+    t._broken_amulet(30)
+
+