From 65de042dd3f554e9ffcb732b00525a2e4149a899 Mon Sep 17 00:00:00 2001 From: LmeSzinc Date: Wed, 6 May 2020 23:53:25 +0800 Subject: [PATCH] =?UTF-8?q?Add:=20=E5=A2=9E=E5=8A=A0=E6=8C=82=E6=9C=BA?= =?UTF-8?q?=E6=94=B6=E8=8F=9C=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- alas.py | 7 +++++-- module/config/argparser.py | 6 +++--- module/handler/login.py | 3 +++ module/reward/assets.py | 1 + module/reward/reward.py | 10 ++++++++++ 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/alas.py b/alas.py index 441de3780..34871f274 100644 --- a/alas.py +++ b/alas.py @@ -50,7 +50,7 @@ class AzurLaneAutoScript: logger.hr('Reward Settings saved') from module.reward.reward import Reward az = Reward(self.config) - az.reward() + az.reward_loop() def emulator(self): for key, value in self.config.config['Emulator'].items(): @@ -59,7 +59,10 @@ class AzurLaneAutoScript: logger.hr('Emulator saved') from module.handler.login import LoginHandler az = LoginHandler(self.config) - az.app_ensure_start() + if az.app_ensure_start(): + from module.reward.reward import Reward + az = Reward(self.config) + az.reward() def main(self): """ diff --git a/module/config/argparser.py b/module/config/argparser.py index c747b38b8..c3a127372 100644 --- a/module/config/argparser.py +++ b/module/config/argparser.py @@ -209,7 +209,7 @@ def main(ini_name=''): # ==========收菜设置========== reward_parser = subs.add_parser('收菜设置') - reward_condition = reward_parser.add_argument_group('触发条件', '需要运行一次来保存选项, 运行时会执行一次收菜') + reward_condition = reward_parser.add_argument_group('触发条件', '需要运行一次来保存选项, 运行后会进入挂机收菜模式') reward_condition.add_argument('--启用收获', default=default('--启用收获'), choices=['是', '否']) reward_condition.add_argument('--收菜间隔', default=default('--收菜间隔'), choices=['20', '30', '60'], help='每隔多少分钟触发收菜') @@ -260,9 +260,9 @@ def main(ini_name=''): # ==========设备设置========== emulator_parser = subs.add_parser('设备设置') - emulator = emulator_parser.add_argument_group('模拟器', '需要运行一次来保存选项, 会检查游戏是否启动') + emulator = emulator_parser.add_argument_group('模拟器', '需要运行一次来保存选项, 会检查游戏是否启动\n若启动了游戏, 触发一次收菜') emulator.add_argument('--设备', default=default('--设备'), help='例如 127.0.0.1:62001') - emulator.add_argument('--包名', default=default('--包名'), help='如果不是Biliibli国服, 或者使用了非官方客户端, 需修改') + emulator.add_argument('--包名', default=default('--包名'), help='') debug = emulator_parser.add_argument_group('调试设置', '') debug.add_argument('--出错时保存log和截图', default=default('--出错时保存log和截图'), choices=['是', '否']) diff --git a/module/handler/login.py b/module/handler/login.py index 03746dbdf..2e64c9716 100644 --- a/module/handler/login.py +++ b/module/handler/login.py @@ -48,3 +48,6 @@ class LoginHandler(Combat): if not self.device.app_is_running(): self.device.app_start() self.handle_app_login() + return True + + return False diff --git a/module/reward/assets.py b/module/reward/assets.py index ac490fc21..cb58ea9d0 100644 --- a/module/reward/assets.py +++ b/module/reward/assets.py @@ -21,4 +21,5 @@ REWARD_1 = Button(area=(383, 285, 503, 297), color=(238, 168, 81), button=(383, REWARD_2 = Button(area=(383, 404, 503, 444), color=(233, 165, 67), button=(383, 404, 503, 444), file='./assets/reward/REWARD_2.png') REWARD_3 = Button(area=(383, 546, 503, 586), color=(234, 163, 69), button=(383, 546, 503, 586), file='./assets/reward/REWARD_3.png') REWARD_SAVE_CLICK = Button(area=(415, 184, 496, 214), color=(152, 150, 168), button=(415, 184, 496, 214), file='./assets/reward/REWARD_SAVE_CLICK.png') +TACTICAL_CLASS_CANCEL = Button(area=(818, 590, 990, 648), color=(153, 153, 154), button=(818, 590, 990, 648), file='./assets/reward/TACTICAL_CLASS_CANCEL.png') TACTICAL_CLASS_START = Button(area=(1024, 590, 1197, 648), color=(96, 139, 194), button=(1024, 590, 1197, 648), file='./assets/reward/TACTICAL_CLASS_START.png') diff --git a/module/reward/reward.py b/module/reward/reward.py index 359336142..05b44e4b2 100644 --- a/module/reward/reward.py +++ b/module/reward/reward.py @@ -151,3 +151,13 @@ class Reward(RewardCommission, RewardTacticalClass): self.ui_goto(page_main, skip_first_screenshot=True) return reward + + def reward_loop(self): + logger.hr('Reward loop') + while 1: + if not self.reward(): + break + + logger.info('Reward loop wait') + logger.attr('Reward_loop_wait', f'{self.config.REWARD_INTERVAL} min') + self.device.sleep(self.config.REWARD_INTERVAL * 60)