ba-auto-daily/ba_auto/tasks/shop_common.py

32 lines
1.2 KiB
Python

"""Common Shop (通常アイテム) daily task. Ported from baas-reference
module/shop/common_shop.py's implement() -- see shop_utils.py for the
shared checkbox-grid-then-bulk-buy control flow both shop tabs use."""
from ba_auto import navigation
from ba_auto.tasks import shop_utils
def run(driver, config):
driver.focus_game()
driver.click(*config.SHOP_ICON)
driver.wait(2)
if not navigation.is_on_subscreen(driver):
print("[shop_common] could not confirm shop opened, aborting without pressing further keys")
return
shop_utils.run_shop_tab(
driver, config,
tab_button=config.SHOP_TAB_COMMON,
targets=config.COMMON_SHOP_TARGETS,
balance_rect=config.CREDIT_BALANCE_OCR_RECT,
currency_label="credits",
)
# navigation.return_to_home over a bare click -- verified + carries the
# XIGNCODE-overlay recovery escalation return_to_home has (see its
# docstring); an unverified click here was a real gap found in a
# 2026-07-12 audit of every direct BACK_BUTTON usage in this project.
if not navigation.return_to_home(driver):
print("[shop_common] warning: could not confirm return to home screen")
print("[shop_common] Done.")