38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
"""领取商城英雄招募限时 UP 的神灯任务与免费神灯。"""
|
|
import argparse
|
|
import sys
|
|
import time
|
|
from pathlib import Path
|
|
|
|
from automation.engine import Matcher, load_flow
|
|
from automation.offers import MacGameDesktop
|
|
from automation.recruit import RecruitRunner
|
|
|
|
ROOT = Path(__file__).resolve().parent
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description='英雄招募签到:领取限时 UP 神灯任务和免费神灯')
|
|
parser.add_argument('--dry-run', action='store_true')
|
|
args = parser.parse_args()
|
|
if sys.platform != 'darwin':
|
|
print('当前脚本仅完成 macOS 实机适配。', file=sys.stderr)
|
|
return 2
|
|
try:
|
|
desktop = MacGameDesktop()
|
|
desktop.activate()
|
|
print('3 秒后开始;请保持游戏在前台。', flush=True)
|
|
time.sleep(3)
|
|
return_code = RecruitRunner(
|
|
desktop, Matcher(ROOT / 'assets'), load_flow(ROOT / 'workflows/recruit_signin.json'),
|
|
desktop.region_for).run(args.dry_run)
|
|
print('流程结果:' + return_code)
|
|
return 0
|
|
except Exception as error:
|
|
print('流程停止:' + str(error), file=sys.stderr)
|
|
return 1
|
|
|
|
|
|
if __name__ == '__main__':
|
|
raise SystemExit(main())
|