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

Merge pull request #1717 from LGG686/dev-RichMan

Dev rich man
huangrunheng 3 месяцев назад
Родитель
Сommit
11ae64ddb4

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

@@ -41,5 +41,11 @@
   "emulator_startup_lead_time": "模拟器预热时间",
   "emulator_startup_lead_time_help": "在开始运行任务之前提前启动模拟器的时间",
   "exit_four_help": "支持打九退四,保证稳定57级,要求设置好战斗主题,即 脚本->全局配置->游戏装饰自定义->战斗主题",
-  "costume_main_15": "茨心乐园"
+  "costume_main_15": "茨心乐园",
+  "check_true_orochi_enable": "是否在结束后检测真蛇",
+  "check_true_orochi_enable_help": "开启后会在任务结束后检测是否出现真蛇, 若出现则自动拉起真蛇",
+  "enable_book_auto": "自动选择",
+  "enable_book_auto_help": "游戏内是否开启自动选择御魂",
+  "earn_money": "获取樱灯饰",
+  "earn_money_help": "通过放置借处式神获取500樱灯饰\n开启前确保已放置借出式神"
 }

+ 2 - 2
tasks/Component/Buy/assets.py

@@ -14,7 +14,7 @@ class BuyAssets:
 	# description 
 	C_BUY_ONE = RuleClick(roi_front=(551,506,174,36), roi_back=(551,506,174,36), name="buy_one")
 	# description 
-	C_BUY_MORE = RuleClick(roi_front=(551,540,174,40), roi_back=(551,540,174,40), name="buy_more")
+	C_BUY_MORE = RuleClick(roi_front=(551,563,174,17), roi_back=(551,563,174,17), name="buy_more")
 	# 取消购买 
 	C_BUY_CANCEL = RuleClick(roi_front=(121,2,100,22), roi_back=(121,2,100,22), name="buy_cancel")
 
@@ -34,6 +34,6 @@ class BuyAssets:
 
 	# Ocr Rule Assets
 	# Ocr-description 
-	O_BUY_NUMBER = RuleOcr(roi=(578,416,52,46), area=(578,416,52,46), mode="Digit", method="Default", keyword="", name="buy_number")
+	O_BUY_NUMBER = RuleOcr(roi=(578,416,52,71), area=(578,416,52,71), mode="Digit", method="Default", keyword="", name="buy_number")
 
 

+ 2 - 2
tasks/Component/Buy/buy/click.json

@@ -7,8 +7,8 @@
   },
   {
     "itemName": "buy_more",
-    "roiFront": "551,540,174,40",
-    "roiBack": "551,540,174,40",
+    "roiFront": "551,563,174,17",
+    "roiBack": "551,563,174,17",
     "description": "description"
   },
   {

+ 2 - 2
tasks/Component/Buy/buy/ocr.json

@@ -1,8 +1,8 @@
 [
   {
     "itemName": "buy_number",
-    "roiFront": "578,416,52,46",
-    "roiBack": "578,416,52,46",
+    "roiFront": "578,416,52,71",
+    "roiBack": "578,416,52,71",
     "mode": "Digit",
     "method": "Default",
     "keyword": "",

+ 2 - 0
tasks/Orochi/config.py

@@ -45,6 +45,8 @@ class OrochiConfig(ConfigBase):
     limit_count: int = Field(default=30, description='limit_count_help')
     # 是否开启御魂加成
     soul_buff_enable: bool = Field(default=False, description='soul_buff_enable_help')
+    # 是否御魂结束检测是否出现真蛇
+    check_true_orochi_enable: bool = Field(default=False, description='check_true_orochi_enable_help')
 
 class SwitchSoulConfig(BaseSwitchSoulConfig):
     enable: bool = Field(default=False)

+ 12 - 1
tasks/Orochi/script_task.py

@@ -14,11 +14,12 @@ from tasks.GameUi.game_ui import GameUi
 from tasks.GameUi.page import page_main, page_soul_zones, page_shikigami_records
 from tasks.Orochi.assets import OrochiAssets
 from tasks.Orochi.config import Orochi, UserStatus, Layer
+from tasks.TrueOrochi.assets import TrueOrochiAssets
 from module.logger import logger
 from module.exception import TaskEnd
 
 
-class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi, SwitchSoul, OrochiAssets):
+class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi, SwitchSoul, OrochiAssets, TrueOrochiAssets):
 
     def run(self) -> bool:
         # 御魂切换方式一
@@ -59,6 +60,16 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
             case UserStatus.WILD: success = self.run_wild()
             case _: logger.error('Unknown user status')
 
+        # 御魂结束后检测是否出现真蛇
+        if config.orochi_config.check_true_orochi_enable:
+            self.ui_get_current_page()
+            self.ui_goto(page_soul_zones)
+            self.orochi_enter()
+            self.screenshot()
+            if self.appear(self.I_FIND_TS):
+                logger.info('Find true orochi after orochi battle, set TrueOrochi task to run now')
+                self.set_next_run(task='TrueOrochi', success=False, finish=False, server=False, target=datetime.now())
+        self.ui_goto(page_main)
         # 记得关掉
         if config.orochi_config.soul_buff_enable:
             self.open_buff()

+ 15 - 3
tasks/RichMan/assets.py

@@ -282,7 +282,7 @@ class RichManAssets:
 	# description 
 	I_SCA_SELECT_3 = RuleImage(roi_front=(972,517,123,50), roi_back=(972,517,123,50), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/scales/scales_sca_select_3.png")
 	# 获得的六星 
-	I_SCA_SIX_STAR = RuleImage(roi_front=(120,216,97,22), roi_back=(113,102,1057,157), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/scales/scales_sca_six_star.png")
+	I_SCA_SIX_STAR = RuleImage(roi_front=(120,216,97,22), roi_back=(113,102,1056,257), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/scales/scales_sca_six_star.png")
 	# 点击屏幕继续 
 	I_SCA_REWARD = RuleImage(roi_front=(584,503,100,100), roi_back=(584,503,100,100), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/scales/scales_sca_reward.png")
 	# 点击兑换 
@@ -297,7 +297,7 @@ class RichManAssets:
 	# 首领御魂剩余可买的 
 	O_SCA_NUMBER_DEMON = RuleOcr(roi=(627,319,30,25), area=(627,319,30,25), mode="Quantity", method="Default", keyword="", name="sca_number_demon")
 	# 永生之海 
-	O_SCA_NUMBER_SEA = RuleOcr(roi=(926,321,30,23), area=(926,321,30,23), mode="Quantity", method="Default", keyword="", name="sca_number_sea")
+	O_SCA_NUMBER_SEA = RuleOcr(roi=(920,320,36,22), area=(920,320,36,22), mode="Quantity", method="Default", keyword="", name="sca_number_sea")
 	# 多少号位 
 	O_SCA_DEMON_POSTION = RuleOcr(roi=(960,244,88,41), area=(960,244,88,41), mode="Single", method="Default", keyword="", name="sca_demon_postion")
 	# 朴素的御魂 
@@ -305,7 +305,7 @@ class RichManAssets:
 	# 首领御魂数量 
 	O_SCA_RES_DEMON = RuleOcr(roi=(968,11,102,35), area=(968,11,102,35), mode="Digit", method="Default", keyword="", name="sca_res_demon")
 	# 永生之海 
-	O_SCA_RES_SEA = RuleOcr(roi=(1136,11,88,38), area=(1136,11,88,38), mode="Digit", method="Default", keyword="", name="sca_res_sea")
+	O_SCA_RES_SEA = RuleOcr(roi=(1134,11,100,38), area=(1134,11,100,38), mode="Digit", method="Default", keyword="", name="sca_res_sea")
 
 
 	# Image Rule Assets
@@ -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

+ 2 - 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')
@@ -29,6 +30,7 @@ class Scales(BaseModel):
     demon_class: DemonClass = Field(title='DemonClass', default=DemonClass.TSUCHIGUMO, description='demon_class_help')
     demon_position: int = Field(title='Demon Position', default=1, description='demon_position_help')
     picture_book_scrap: int = Field(title='Picture Book Scrap', default=30, description='picture_book_scrap_help')
+    enable_book_auto: bool = Field(title='Enable Book Auto', default=False, description='enable_book_auto_help')
     picture_book_rule: str = Field(title='Picture Book Rule', default='auto', description='picture_book_rule_help')
 
 

+ 8 - 2
tasks/RichMan/mall/scales.py

@@ -340,10 +340,16 @@ class Scales(Buy, MallNavbar):
             buy_res_number = buy_number
         if buy_cycles_number:
             for i in range(buy_cycles_number):
-                self._scales_buy_sea_more(self.I_SCA_PICTURE_BOOK)
+                if self.config.rich_man.scales.enable_book_auto:
+                    self._scales_buy_more(self.I_SCA_PICTURE_BOOK)
+                else:
+                    self._scales_buy_sea_more(self.I_SCA_PICTURE_BOOK)
                 time.sleep(0.5)
         if buy_res_number and buy_res_number >= 2:
-            self._scales_buy_sea_more(self.I_SCA_PICTURE_BOOK, buy_res_number)
+            if self.config.rich_man.scales.enable_book_auto:
+                self._scales_buy_more(self.I_SCA_PICTURE_BOOK, buy_res_number)
+            else:
+                self._scales_buy_sea_more(self.I_SCA_PICTURE_BOOK, buy_res_number)
             time.sleep(0.5)
 
 

+ 1 - 1
tasks/RichMan/mall/scales/image.json

@@ -111,7 +111,7 @@
     "itemName": "sca_six_star",
     "imageName": "scales_sca_six_star.png",
     "roiFront": "120,216,97,22",
-    "roiBack": "113,102,1057,157",
+    "roiBack": "113,102,1056,257",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "获得的六星"

+ 4 - 4
tasks/RichMan/mall/scales/ocr.json

@@ -19,8 +19,8 @@
   },
   {
     "itemName": "sca_number_sea",
-    "roiFront": "926,321,30,23",
-    "roiBack": "926,321,30,23",
+    "roiFront": "920,320,36,22",
+    "roiBack": "920,320,36,22",
     "mode": "Quantity",
     "method": "Default",
     "keyword": "",
@@ -55,8 +55,8 @@
   },
   {
     "itemName": "sca_res_sea",
-    "roiFront": "1136,11,88,38",
-    "roiBack": "1136,11,88,38",
+    "roiFront": "1134,11,100,38",
+    "roiBack": "1134,11,100,38",
     "mode": "Digit",
     "method": "Default",
     "keyword": "",

BIN
tasks/RichMan/mall/scales/scales_sca_picture_book.png


+ 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": "借出确认"
   }
 ]

BIN
tasks/RichMan/tt/tt_tt_borrow.png


BIN
tasks/RichMan/tt/tt_tt_borrow_confirm.png


BIN
tasks/RichMan/tt/tt_tt_configure.png


BIN
tasks/RichMan/tt/tt_tt_confirm.png


BIN
tasks/RichMan/tt/tt_tt_shikigami.png


BIN
tasks/RichMan/tt/tt_tt_shikigami_replace.png