diff --git a/assets/i18n/zh-CN.json b/assets/i18n/zh-CN.json index a679ecceb..4124db762 100644 --- a/assets/i18n/zh-CN.json +++ b/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开启前确保已放置借出式神" } diff --git a/tasks/BondlingFairyland/script_task.py b/tasks/BondlingFairyland/script_task.py index 5bab62154..f9c6e58ab 100644 --- a/tasks/BondlingFairyland/script_task.py +++ b/tasks/BondlingFairyland/script_task.py @@ -290,6 +290,8 @@ def switch_ball(self): elif bondling_config.bondling_search_enable and bondling_config.user_status == UserStatus.ALONE: if self.run_search(bondling_config, limit_cnt=random.randint(5, 20)): logger.info('Bondling search finish, try to run catch') + # 切御魂 + self._switch_soul_capture() continue else: break # 时间到了或次数到了直接退出 @@ -345,19 +347,24 @@ def run_stone(self, bondling_stone_enable: bool): self.ui_click_until_disappear(self.I_STONE_CLOSE, interval=1.2) logger.warning(f'已经没有鸣契石召唤契灵了') return False + cnt = 0 while 1: self.screenshot() if not self.appear(self.I_STONE_SURE): sleep(random.uniform(1.5, 2)) # 等待购买后的动画, 否则已经买了但是下次再点击还会出现该界面 return True + if cnt >= 6: + logger.warning("") + return False for i in range(3): if self.appear_then_click(self.I_BUY_PLUS, interval=1): sleep(0.5) if self.appear_then_click(self.I_GI_SURE, interval=1): continue - if self.appear_then_click(self.I_STONE_SURE, interval=1): + if self.appear_then_click(self.I_STONE_SURE, interval=2): continue + def run_search(self, bondling_config: BondlingConfig, limit_cnt: int = None): """ 运行探查 @@ -368,6 +375,7 @@ def run_search(self, bondling_config: BondlingConfig, limit_cnt: int = None): (4) 打满对应limit_cnt次, (探查界面)返回True """ self.lock_team() + self._switch_soul_search() while 1: # 检查是不是在探查界面, if not self.in_search_ui(screenshot=True): @@ -816,6 +824,37 @@ def do_switch_soul(ts: str, g: str | int, te: str | int): type_str, (group, team) = bondling_switch_soul.get_switch_by_name('search_switch') do_switch_soul(type_str, group, team) + def _switch_soul_to(self, ts, g, te): + def _do_switch_soul(ts: str, g: str | int, te: str | int): + if ts is None: + raise ValueError(f'Invalid switch soul config on {self.config.bondling_fairyland.bondling_config.bondling_stone_class.value}') + if ts == 'int': + self.run_switch_soul((g, te)) + if ts == 'str': + self.run_switch_soul_by_name(g, te) + + if ts is None: + logger.warning('Switch soul preset not configured, skip') + return + + self.goto_shikigami_records(self.I_GOTO_SHIKIGAMI_COMMON) + _do_switch_soul(ts, g, te) + self.exit_shikigami_records() + + + def _switch_soul_search(self): + logger.info("切换御魂-探查") + if not self.config.bondling_fairyland.bondling_switch_soul.enable: return + ts, (g, te) = self.config.bondling_fairyland.bondling_switch_soul.get_switch_by_name('search_switch') + self._switch_soul_to(ts, g, te) + + def _switch_soul_capture(self): + logger.info("切换御魂-捕获") + cong = self.config.bondling_fairyland + if not cong.bondling_switch_soul.enable: return + ts, (g, te) = cong.bondling_switch_soul.get_switch_by_enum(cong.bondling_config.bondling_stone_class) + self._switch_soul_to(ts, g, te) + if __name__ == '__main__': from module.config.config import Config @@ -824,7 +863,7 @@ def do_switch_soul(ts: str, g: str | int, te: str | int): config = Config('oas1') device = Device(config) t = ScriptTask(config, device) - # t.run() + t.run() t.ui_get_current_page() t.ui_goto(page_bondling_fairyland) # image = task.screenshot() diff --git a/tasks/Component/Buy/assets.py b/tasks/Component/Buy/assets.py index a20e6d929..281c4ed2b 100644 --- a/tasks/Component/Buy/assets.py +++ b/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") diff --git a/tasks/Component/Buy/buy/click.json b/tasks/Component/Buy/buy/click.json index 0c3528ff2..bdcf37970 100644 --- a/tasks/Component/Buy/buy/click.json +++ b/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" }, { diff --git a/tasks/Component/Buy/buy/ocr.json b/tasks/Component/Buy/buy/ocr.json index ddf2b0402..b7eedcaf5 100644 --- a/tasks/Component/Buy/buy/ocr.json +++ b/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": "", diff --git a/tasks/Component/SwitchAccount/login_account.py b/tasks/Component/SwitchAccount/login_account.py index 827ebd54b..8bd0366d3 100644 --- a/tasks/Component/SwitchAccount/login_account.py +++ b/tasks/Component/SwitchAccount/login_account.py @@ -90,7 +90,7 @@ def switch_character(self, characterName: str): """ logger.info("start switch_character") # 改成对比是否出现 已有角色 - self.ui_click(self.C_SA_LOGIN_FORM_SWITCH_SVR_BTN, self.O_SA_CHECK_SELCET_SVR) + self.ui_click(self.C_SA_LOGIN_FORM_SWITCH_SVR_BTN, self.O_SA_CHECK_SELECT_SVR) # 展开底部角色列表,显示角色所属服务器 self.screenshot() while (not self.appear(self.I_SA_CHECK_SELECT_SVR_2)) and self.appear(self.I_SA_CHECK_SELECT_SVR_1): diff --git a/tasks/Component/SwitchSoul/assets.py b/tasks/Component/SwitchSoul/assets.py index c6a4dc63e..309852f28 100644 --- a/tasks/Component/SwitchSoul/assets.py +++ b/tasks/Component/SwitchSoul/assets.py @@ -66,6 +66,8 @@ class SwitchSoulAssets: I_SOU_CLICK_PRESENT = RuleImage(roi_front=(978,304,25,26), roi_back=(965,142,48,480), threshold=0.9, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_sou_click_present.png") # 误触点到式神检查 I_CHECK_BLOCK = RuleImage(roi_front=(572,408,137,49), roi_back=(572,408,137,49), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_check_block.png") + # 通用进入式神录 + I_GOTO_SHIKIGAMI_COMMON = RuleImage(roi_front=(1037,567,36,36), roi_back=(617,503,487,134), threshold=0.8, method="Template matching", file="./tasks/Component/SwitchSoul/ss/ss_goto_shikigami_common.png") # Ocr Rule Assets diff --git a/tasks/Component/SwitchSoul/ss/image.json b/tasks/Component/SwitchSoul/ss/image.json index 08933021c..e2034f4a2 100644 --- a/tasks/Component/SwitchSoul/ss/image.json +++ b/tasks/Component/SwitchSoul/ss/image.json @@ -160,5 +160,14 @@ "method": "Template matching", "threshold": 0.8, "description": "误触点到式神检查" + }, + { + "itemName": "goto_shikigami_common", + "imageName": "ss_goto_shikigami_common.png", + "roiFront": "1037,567,36,36", + "roiBack": "617,503,487,134", + "method": "Template matching", + "threshold": 0.8, + "description": "通用进入式神录" } ] \ No newline at end of file diff --git a/tasks/Component/SwitchSoul/ss/ss_goto_shikigami_common.png b/tasks/Component/SwitchSoul/ss/ss_goto_shikigami_common.png new file mode 100644 index 000000000..91be2dd35 Binary files /dev/null and b/tasks/Component/SwitchSoul/ss/ss_goto_shikigami_common.png differ diff --git a/tasks/Component/SwitchSoul/switch_soul.py b/tasks/Component/SwitchSoul/switch_soul.py index 7a4a736f3..efe89e361 100644 --- a/tasks/Component/SwitchSoul/switch_soul.py +++ b/tasks/Component/SwitchSoul/switch_soul.py @@ -8,11 +8,14 @@ from module.atom.long_click import RuleLongClick from module.atom.ocr import RuleOcr from module.base.timer import Timer +from module.logger import logger + from tasks.base_task import BaseTask +from tasks.GameUi.assets import GameUiAssets from tasks.Component.GeneralInvite.assets import GeneralInviteAssets from tasks.Component.GeneralInvite.config_invite import InviteConfig, InviteNumber, FindMode from tasks.Component.SwitchSoul.assets import SwitchSoulAssets -from module.logger import logger + def switch_parser(switch_str: str) -> tuple: @@ -24,6 +27,32 @@ def switch_parser(switch_str: str) -> tuple: class SwitchSoul(BaseTask, SwitchSoulAssets): + def goto_shikigami_records(self, button): + """ + 进入式神录 + """ + while 1: + self.screenshot() + if self.appear(GameUiAssets.I_CHECK_RECORDS): + break + if self.appear_then_click(button, interval=1.5): + continue + logger.info('Entry shikigami records') + + def exit_shikigami_records(self) -> None: + """ + 退出式神录的界面 + :return: + """ + while 1: + self.screenshot() + if not self.appear(self.I_SOU_CHECK_IN): + break + if self.appear_then_click(self.I_RECORD_SOUL_BACK, interval=3.5): + continue + logger.info('Exit shikigami records') + + def run_switch_soul(self, target: tuple | list[tuple] | str): """ 保证在式神录的界面 @@ -153,19 +182,6 @@ def switch_souls(self, target: tuple or list[tuple]) -> None: team = int(team) self.switch_soul_one(group, team) - def exit_shikigami_records(self) -> None: - """ - 退出式神录的界面 - :return: - """ - while 1: - self.screenshot() - if not self.appear(self.I_SOU_CHECK_IN): - break - if self.appear_then_click(self.I_RECORD_SOUL_BACK, interval=3.5): - continue - logger.info('Exit shikigami records') - def run_switch_soul_by_name(self, groupName, teamName): """ 保证在式神录的界面 diff --git a/tasks/HeroTest/script_task.py b/tasks/HeroTest/script_task.py index 5e59db8fd..e4392eac0 100644 --- a/tasks/HeroTest/script_task.py +++ b/tasks/HeroTest/script_task.py @@ -170,8 +170,15 @@ def hero2_skill_wait(self): SkillMode.PVP: pvp_skill, } target_skills = target_skill_dict[self.conf.herotest.skill_mode] + timer = Timer(10).start() while True: self.screenshot() + if timer.reached_and_reset(): + if self.appear(self.I_BCMJ_SKILL_ADD_CONFIRM): + logger.warning('No skill selected for 10s, panel still open, retrying') + continue + logger.warning('Skill selection panel closed unexpectedly, exit') + break if any(self.appear_then_click(ts, interval=1) for ts in target_skills): break self.ui_click_until_disappear(self.I_BCMJ_SKILL_ADD_CONFIRM, interval=1.5) diff --git a/tasks/Orochi/config.py b/tasks/Orochi/config.py index c1acbb484..65bc74d2a 100644 --- a/tasks/Orochi/config.py +++ b/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) diff --git a/tasks/Orochi/script_task.py b/tasks/Orochi/script_task.py index 020fe1483..18d0adad5 100644 --- a/tasks/Orochi/script_task.py +++ b/tasks/Orochi/script_task.py @@ -14,11 +14,12 @@ 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 @@ def run(self) -> bool: 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() diff --git a/tasks/RichMan/assets.py b/tasks/RichMan/assets.py index a05f97651..200306870 100644 --- a/tasks/RichMan/assets.py +++ b/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 diff --git a/tasks/RichMan/config.py b/tasks/RichMan/config.py index 205c40cd4..e6bceb75a 100644 --- a/tasks/RichMan/config.py +++ b/tasks/RichMan/config.py @@ -12,6 +12,7 @@ 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') diff --git a/tasks/RichMan/mall/scales.py b/tasks/RichMan/mall/scales.py index d1b581331..d48f6179f 100644 --- a/tasks/RichMan/mall/scales.py +++ b/tasks/RichMan/mall/scales.py @@ -340,10 +340,16 @@ def _scales_sea(self, buy_number: int, buy_rule: str='auto'): 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) diff --git a/tasks/RichMan/mall/scales/image.json b/tasks/RichMan/mall/scales/image.json index f7676b68b..a2eb52003 100644 --- a/tasks/RichMan/mall/scales/image.json +++ b/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": "获得的六星" diff --git a/tasks/RichMan/mall/scales/ocr.json b/tasks/RichMan/mall/scales/ocr.json index 7d711b388..dbba87c13 100644 --- a/tasks/RichMan/mall/scales/ocr.json +++ b/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": "", diff --git a/tasks/RichMan/mall/scales/scales_sca_picture_book.png b/tasks/RichMan/mall/scales/scales_sca_picture_book.png index 18588da73..79bd20ffc 100644 Binary files a/tasks/RichMan/mall/scales/scales_sca_picture_book.png and b/tasks/RichMan/mall/scales/scales_sca_picture_book.png differ diff --git a/tasks/RichMan/thousand_things.py b/tasks/RichMan/thousand_things.py index 47c138a3e..03eda4e05 100644 --- a/tasks/RichMan/thousand_things.py +++ b/tasks/RichMan/thousand_things.py @@ -25,6 +25,10 @@ def execute_tt(self, con: ConfigThousandThings) -> None: 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 @@ def tt_get_reward(self, image_button): 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 diff --git a/tasks/RichMan/tt/image.json b/tasks/RichMan/tt/image.json index d46438687..3493b47d4 100644 --- a/tasks/RichMan/tt/image.json +++ b/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": "借出确认" } ] \ No newline at end of file diff --git a/tasks/RichMan/tt/tt_tt_borrow.png b/tasks/RichMan/tt/tt_tt_borrow.png new file mode 100644 index 000000000..e63bbd8f9 Binary files /dev/null and b/tasks/RichMan/tt/tt_tt_borrow.png differ diff --git a/tasks/RichMan/tt/tt_tt_borrow_confirm.png b/tasks/RichMan/tt/tt_tt_borrow_confirm.png new file mode 100644 index 000000000..c0b6cbf09 Binary files /dev/null and b/tasks/RichMan/tt/tt_tt_borrow_confirm.png differ diff --git a/tasks/RichMan/tt/tt_tt_configure.png b/tasks/RichMan/tt/tt_tt_configure.png new file mode 100644 index 000000000..00553918a Binary files /dev/null and b/tasks/RichMan/tt/tt_tt_configure.png differ diff --git a/tasks/RichMan/tt/tt_tt_confirm.png b/tasks/RichMan/tt/tt_tt_confirm.png new file mode 100644 index 000000000..48b949b2d Binary files /dev/null and b/tasks/RichMan/tt/tt_tt_confirm.png differ diff --git a/tasks/RichMan/tt/tt_tt_shikigami.png b/tasks/RichMan/tt/tt_tt_shikigami.png new file mode 100644 index 000000000..9b1f892de Binary files /dev/null and b/tasks/RichMan/tt/tt_tt_shikigami.png differ diff --git a/tasks/RichMan/tt/tt_tt_shikigami_replace.png b/tasks/RichMan/tt/tt_tt_shikigami_replace.png new file mode 100644 index 000000000..da6aa25c3 Binary files /dev/null and b/tasks/RichMan/tt/tt_tt_shikigami_replace.png differ