瀏覽代碼

feat(RichMan): 千物宝箱新增唤妖借处获取樱灯饰功能

- config: 新增 earn_money 配置项控制是否执行借处流程
- thousand_things: 新增 tt_earn_money 方法,实现借出式神并领取500樱灯饰
- assets: 新增 borrow/configure/confirm/shikigami 等图像匹配资源
- i18n: 补充 zh-CN 国际化文案
yuyuyuyuyu 3 月之前
父節點
當前提交
c90ac04a22

+ 3 - 1
assets/i18n/zh-CN.json

@@ -45,5 +45,7 @@
   "check_true_orochi_enable": "是否在结束后检测真蛇",
   "check_true_orochi_enable_help": "开启后会在任务结束后检测是否出现真蛇, 若出现则自动拉起真蛇",
   "enable_book_auto": "自动选择",
-  "enable_book_auto_help": "游戏内是否开启自动选择御魂"
+  "enable_book_auto_help": "游戏内是否开启自动选择御魂",
+  "earn_money": "获取樱灯饰",
+  "earn_money_help": "通过放置借处式神获取500樱灯饰\n开启前确保已放置借出式神"
 }

+ 12 - 0
tasks/RichMan/assets.py

@@ -397,6 +397,18 @@ class RichManAssets:
 	I_TT_BUY_UP = RuleImage(roi_front=(755,427,59,57), roi_back=(740,386,80,146), threshold=0.8, method="Template matching", file="./tasks/RichMan/tt/tt_tt_buy_up.png")
 	# description 
 	I_TT_BUY_CONFIRM = RuleImage(roi_front=(584,512,53,53), roi_back=(553,487,169,115), threshold=0.8, method="Template matching", file="./tasks/RichMan/tt/tt_tt_buy_confirm.png")
+	# 唤妖借处 
+	I_TT_BORROW = RuleImage(roi_front=(1043,262,39,149), roi_back=(960,169,208,309), threshold=0.8, method="Template matching", file="./tasks/RichMan/tt/tt_tt_borrow.png")
+	# 配置式神 
+	I_TT_CONFIGURE = RuleImage(roi_front=(1129,608,42,44), roi_back=(1036,523,240,197), threshold=0.8, method="Template matching", file="./tasks/RichMan/tt/tt_tt_configure.png")
+	# 确认配置 
+	I_TT_CONFIRM = RuleImage(roi_front=(1129,608,42,44), roi_back=(1036,523,240,197), threshold=0.8, method="Template matching", file="./tasks/RichMan/tt/tt_tt_confirm.png")
+	# 选择式神(第四个) 
+	I_TT_SHIKIGAMI = RuleImage(roi_front=(682,257,15,14), roi_back=(652,221,151,148), threshold=0.7, method="Template matching", file="./tasks/RichMan/tt/tt_tt_shikigami.png")
+	# 替换式神 
+	I_TT_SHIKIGAMI_REPLACE = RuleImage(roi_front=(755,641,57,19), roi_back=(703,580,148,134), threshold=0.7, method="Template matching", file="./tasks/RichMan/tt/tt_tt_shikigami_replace.png")
+	# 借出确认 
+	I_TT_BORROW_CONFIRM = RuleImage(roi_front=(960,508,50,53), roi_back=(886,444,222,194), threshold=0.8, method="Template matching", file="./tasks/RichMan/tt/tt_tt_borrow_confirm.png")
 
 
 	# Ocr Rule Assets

+ 1 - 0
tasks/RichMan/config.py

@@ -12,6 +12,7 @@ from tasks.Utils.config_enum import DemonClass
 class ThousandThings(BaseModel):
     # 千物宝箱
     enable: bool = Field(title='Enable', default=False)
+    earn_money: bool = Field(title='Earn Money', default=False, description='earn_money_help')
     mystery_amulet: bool = Field(title='Mystery Amulet', default=False)
     black_daruma_fragment: bool = Field(title='Black Daruma Fragment', default=False)
     ap: bool = Field(title='AP', default=False, description='ap_help')

+ 27 - 0
tasks/RichMan/thousand_things.py

@@ -25,6 +25,10 @@ class ThousandThings(GameUi, RichManAssets):
         self.ui_get_current_page()
         self.ui_goto(page_travel)
 
+        if con.earn_money:
+            logger.info('Start Earn Money')
+            self.tt_earn_money()
+
         while 1:
             self.screenshot()
             if self.appear(self.I_TT_CHECK):
@@ -167,6 +171,29 @@ class ThousandThings(GameUi, RichManAssets):
                 continue
         return True
 
+    def tt_earn_money(self):
+
+        # 进入界面
+        self.ui_click(self.I_TT_BORROW, self.I_TT_CONFIGURE)
+        self.ui_click(self.I_TT_CONFIGURE, self.I_TT_CONFIRM)
+        #替换式神
+        self.ui_click(self.I_TT_SHIKIGAMI, self.I_TT_SHIKIGAMI_REPLACE)
+        while 1:
+            self.screenshot()
+            if not self.appear(self.I_TT_SHIKIGAMI_REPLACE):
+                break
+            if self.appear_then_click(self.I_UI_CONFIRM):
+                continue
+            if self.appear_then_click(self.I_TT_SHIKIGAMI_REPLACE):
+                continue
+        self.ui_click(self.I_TT_CONFIRM, self.I_TT_BORROW_CONFIRM)
+
+        # 获取奖励
+        self.ui_get_reward(self.I_TT_BORROW_CONFIRM)
+
+        # 退出界面
+        self.ui_click(self.I_UI_BACK_RED, self.I_TT_ENTER)
+
 
 if __name__ == '__main__':
     from module.config.config import Config

+ 54 - 0
tasks/RichMan/tt/image.json

@@ -61,5 +61,59 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"
+  },
+  {
+    "itemName": "tt_borrow",
+    "imageName": "tt_tt_borrow.png",
+    "roiFront": "1043,262,39,149",
+    "roiBack": "960,169,208,309",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "唤妖借处"
+  },
+  {
+    "itemName": "tt_configure",
+    "imageName": "tt_tt_configure.png",
+    "roiFront": "1129,608,42,44",
+    "roiBack": "1036,523,240,197",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "配置式神"
+  },
+  {
+    "itemName": "tt_confirm",
+    "imageName": "tt_tt_confirm.png",
+    "roiFront": "1129,608,42,44",
+    "roiBack": "1036,523,240,197",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "确认配置"
+  },
+  {
+    "itemName": "tt_shikigami",
+    "imageName": "tt_tt_shikigami.png",
+    "roiFront": "682,257,15,14",
+    "roiBack": "652,221,151,148",
+    "method": "Template matching",
+    "threshold": 0.7,
+    "description": "选择式神(第四个)"
+  },
+  {
+    "itemName": "tt_shikigami_replace",
+    "imageName": "tt_tt_shikigami_replace.png",
+    "roiFront": "755,641,57,19",
+    "roiBack": "703,580,148,134",
+    "method": "Template matching",
+    "threshold": 0.7,
+    "description": "替换式神"
+  },
+  {
+    "itemName": "tt_borrow_confirm",
+    "imageName": "tt_tt_borrow_confirm.png",
+    "roiFront": "960,508,50,53",
+    "roiBack": "886,444,222,194",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "借出确认"
   }
 ]

二進制
tasks/RichMan/tt/tt_tt_borrow.png


二進制
tasks/RichMan/tt/tt_tt_borrow_confirm.png


二進制
tasks/RichMan/tt/tt_tt_configure.png


二進制
tasks/RichMan/tt/tt_tt_confirm.png


二進制
tasks/RichMan/tt/tt_tt_shikigami.png


二進制
tasks/RichMan/tt/tt_tt_shikigami_replace.png