feat: add sweep and task reward automation
This commit is contained in:
1 parent
8479cf4981
commit
44d9a617d1
21 files changed
+516
-8
No files matched your search
@@ -0,0 +1,39 @@
|
||||
"""Run from the project root: python claim_tasks.py [--dry-run]."""
|
||||
import argparse
|
||||
import sys
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
from automation.engine import Matcher, WorkflowError, load_flow
|
||||
from automation.offers import MacGameDesktop
|
||||
from automation.tasks import TaskRunner
|
||||
|
||||
ROOT = Path(__file__).resolve().parent
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='首页任务:按红点领取日常和周常奖励并返回首页')
|
||||
parser.add_argument('--dry-run', action='store_true', help='只验证首页并显示计划,不点击')
|
||||
args = parser.parse_args()
|
||||
if sys.platform != 'darwin':
|
||||
print('当前脚本已验证 macOS;Windows 版将在校准入口完成后接入。', file=sys.stderr)
|
||||
return 2
|
||||
try:
|
||||
desktop = MacGameDesktop()
|
||||
desktop.activate()
|
||||
print('3 秒后开始;请保持游戏在前台。鼠标移到主屏幕左上角可紧急停止。', flush=True)
|
||||
time.sleep(3)
|
||||
runner = TaskRunner(desktop, Matcher(ROOT / 'assets'),
|
||||
load_flow(ROOT / 'workflows/task_claim.json'), desktop.region_for)
|
||||
runner.run(args.dry_run)
|
||||
return 0
|
||||
except KeyboardInterrupt:
|
||||
print('已停止。', file=sys.stderr)
|
||||
return 130
|
||||
except Exception as exc:
|
||||
print('流程停止:' + str(exc), file=sys.stderr)
|
||||
return 1
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
raise SystemExit(main())
|
||||
Reference in new issue
Block a user