14 Commits

Author SHA1 Message Date
0bdd1919c4 Refactor event stage row detection and scrolling logic
- Replaced fixed y-position detection of stage rows with dynamic search using color blob detection and OCR for stage numbers.
- Implemented a new `_locate_stage_rows` function to find all visible stage rows and their corresponding buttons.
- Updated `_find_stage_row` to scroll through the stage list based on the detected stage numbers, improving reliability and adaptability to different event layouts.
- Enhanced modal detection logic to avoid false positives by checking the visibility of the header bar.
- Adjusted scanning logic to handle transient misreads and ensure stable readings before concluding the presence of a target stage.
- Improved logging for better debugging and understanding of the scanning process.
2026-10-08 08:10:45 +09:00
6a800f731b feat: batch cafe sparkle patting, add diagnostic capture, verify shop purchases via balance delta
Cafe: find_cafe_sparkles (replacing find_cafe_sparkle) matches every
sparkle in one screenshot instead of the single best one; _pat_current_view
now pats a whole batch per frame and stops after two consecutive empty
rounds instead of a fixed 15-click budget. Cuts an empty room's farming
time from ~100s to ~14s in live testing. _dismiss_rank_up_if_shown also
saves a diagnostic screenshot on its own final failure, since the real
"screen not confirmed" cron failures (100% reproducible in logs, 0%
reproducible live across several debugging sessions) need hard evidence
from the next real occurrence.

shop_utils.confirm_purchase now requires the currency balance to have
actually dropped by the expected spend before reporting success, instead
of trusting a single post-click overlay read -- closes a real false
positive caught live where a cron run logged a successful purchase that
never actually happened.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-19 18:18:51 +09:00
b10824d978 feat: optimize image handling by adding optional image parameter for screenshot functions 2026-08-21 23:53:57 +09:00
a15ac6111e feat: enhance navigation and shop utilities with improved visibility checks and price reading retries 2026-07-31 13:48:25 +09:00
4ddd0d7fba feat: implement AP floor guard for story_sweep, story_sweep_hard, and event_sweep 2026-07-24 23:34:15 +09:00
a3cea4d192 feat(login): implement faster stuck-loading detection with _loading_buffer_visible
- Added _loading_buffer_visible function to detect the loading spinner badge
- Updated _wait_for_home to utilize the new detection for early recovery
- Introduced configuration options for loading buffer detection parameters
- Improved handling of stuck loading state to reduce wait time

fix(cron): make ba_cron_run.sh executable

- Changed file mode of ba_cron_run.sh to 755 to ensure it is executable
- Verified that cron can now execute the script as intended

fix(navigation): prevent crash in return_to_home when window disappears

- Added guard to return_to_home to check if the game window exists before focusing
- Ensured robustness in cleanup path during game exit
2026-07-20 01:21:53 +09:00
a9f0bbe42f Implement login flow from title screen to home screen
- Added `login.py` to handle the login process, including detection of various states such as the title screen, network error notices, loading transitions, daily attendance cards, and the home screen.
- Integrated a recovery mechanism to relaunch the game if it gets stuck during loading.
- Updated `ba_daily.py` to include the login task in the default execution order, ensuring it runs first to navigate to the home screen before other tasks.
- Fixed a bug in the home detection logic to accurately identify when the user is on the true home screen.
- Live-tested and calibrated the login flow against real game states, confirming functionality and addressing any issues encountered during testing.
2026-07-16 11:07:43 +09:00
bb0215cb04 fix(cafe): resolve invite ticket cooldown handling and improve rank-up cutscene detection 2026-07-15 14:09:55 +09:00
84790ecb27 refactor(navigation): enhance overlay handling and unify back navigation logic across tasks 2026-07-14 19:53:22 +09:00
c5873f4e58 Refactor arena and lesson tasks for improved efficiency and reliability
- Updated arena.py to allow multiple battles per invocation, looping until tickets are exhausted or a rank-1 condition is met. Introduced _fight_one function for single battle logic and added cooldown handling between fights.
- Enhanced lesson.py to implement a tiered priority system for scheduling lessons based on student slots available, replacing the previous highest affection value selection. Introduced functions for scanning all regions and building a priority queue for lesson scheduling.
- Centralized return-to-home logic in ba_daily.py to ensure the game returns to the home screen before and after each task, improving robustness against navigation issues.
- Added retry mechanism for returning to home, allowing for transient navigation issues to be handled gracefully without aborting tasks.
2026-07-13 10:32:53 +09:00
af0a784bcd fix(event_sweep): implement wrong/stale event page detection and shared navigation return to home functionality 2026-07-10 12:33:22 +09:00
a8ff95d6f5 feat: Implement OCR-driven story AP sweep with deterministic stage targeting
- Added `wait_for_state` function in `navigation.py` for state monitoring and reaction handling.
- Updated `mapping.md` to reflect changes in story sweep implementation and OCR usage.
- Refactored `story_sweep.py` to utilize OCR for region and stage identification, replacing random selection with configured targets.
- Enhanced modal handling and confirmation checks for AP usage in `story_sweep.py`.
- Updated setup script to require `tesseract` for OCR functionality and included installation instructions.
- Revised `plan.md` to document the transition from heuristic to OCR-based stage targeting and the associated findings from live testing.
2026-07-06 01:41:58 +09:00
3a4534f205 Migrate cafe and mailbox tasks to Python: replace legacy Bash scripts, implement state verification, and integrate sparkle detection. 2026-07-05 16:31:26 +09:00
398b936c64 Migrate to Python-first architecture: implement mailbox and cafe tasks, replace Bash scripts with Python CLI, and establish configuration and driver modules. 2026-07-05 16:02:02 +09:00