ba-auto-daily/ba_daily.py
Nik Afiq e67d28513e Implement Bounty Task (指名手配) - Ported from module/rewarded_task.py
- Created ba_auto/tasks/bounty.py to handle the Bounty task, simplifying the original reference's per-call loop to a single area sweep based on date-ordinal-modulo rotation.
- Live-calibrated against nik-gpu on 2026-07-11, ensuring zero real tickets were spent during testing.
- Adjusted entry point to directly access the Work-hub card for Bounty, eliminating unnecessary navigation steps.
- Implemented logic to confirm the latest stage available in each area, ensuring all stages are SSS-cleared.
- Fixed bugs related to ticket count handling and result button detection, preventing unintended real-currency prompts.
- Updated ba_daily.py to include the new bounty task in the task flow.
- Documented the implementation and testing process in plan.md, detailing live tests and fixes applied.
2026-07-11 23:19:57 +09:00

59 lines
1.9 KiB
Python

#!/usr/bin/env python3
"""Python CLI entry point: ba_dailies.sh -> ba_daily.py -> ba_auto/tasks/*.py"""
import sys
from ba_auto import config, driver
from ba_auto.tasks import arena, bounty, cafe, event_sweep, lesson, mailbox, shop_common, shop_tactical, stamina, story_sweep
TASKS = {
"mailbox": mailbox.run,
"cafe": cafe.run,
"stamina": stamina.run,
"story_sweep": story_sweep.run,
"event_sweep": event_sweep.run,
"shop_common": shop_common.run,
"shop_tactical": shop_tactical.run,
"lesson": lesson.run,
"arena": arena.run,
"bounty": bounty.run,
}
# story_sweep, event_sweep, both shop tasks, lesson, arena, and bounty are
# opt-in only (not in the default flow): they spend AP/credits/tactical
# coin/lesson tickets/an arena ticket/a bounty ticket on an automated choice
# rather than reclaiming something free, which is a real resource decision
# the default unattended run shouldn't make blindly. Arena specifically
# fights a real ranked PvP battle each run -- see ba_auto/tasks/arena.py's
# module docstring.
DEFAULT_ORDER = ["mailbox", "cafe", "stamina"]
def main(argv):
args = argv[1:]
if args and args[0] == "--list-commands":
# Machine-readable command list for shell completion (see
# completions/ba_dailies.bash) -- kept as a thin read of TASKS
# itself so the completion list can never drift from what's
# actually dispatchable.
print(" ".join(TASKS.keys()))
return 0
if not args:
for name in DEFAULT_ORDER:
TASKS[name](driver, config)
print("All done.")
return 0
command = args[0]
if command not in TASKS:
print(f"Unknown phase: {command}", file=sys.stderr)
print(f"Valid phases: {' '.join(TASKS.keys())}", file=sys.stderr)
return 1
TASKS[command](driver, config)
return 0
if __name__ == "__main__":
sys.exit(main(sys.argv))