Nik Afiq 51ad297f69 feat: Implement Lesson/Schedule task
- Added `lesson.py` to handle the scheduling of lessons based on affection values.
- Integrated OCR functionality to read affection counts from heart badges.
- Updated `README.md` to include the new lesson task in the task status section.
- Enhanced `config.py` with necessary configurations for the lesson task.
- Modified `detector.py` to include a new function for reading heart badge values accurately.
- Updated `mapping.md` to reflect the new lesson task implementation.
- Adjusted `ba_daily.py` to include the lesson task in the command dispatch.
- Updated `plan.md` to document the completion of the lesson task and its testing outcomes.
- Modified `setup.sh` to include the lesson task in the run command instructions.
2026-07-08 23:45:18 +09:00

7.7 KiB

Reference mapping

Maps each local feature to the corresponding ~/repo/baas-reference/module/... implementation, driver/backend replacements, and current status. Update this before/while implementing or migrating a feature — see CLAUDE.md → "Reference mapping notes" and plan.md → "Reference mapping table".

Local feature Reference file Reference functions/classes Local file Backend replacements Status
Mailbox module/mail.py to_mail, implement ba_auto/tasks/mailbox.py tap/click via xdotool, screenshot via scrot, color.rgb_in_rangedriver.color_at pixel-probe check Migrated: real Python, state-verified via color probe (no legacy bridge)
Cafe module/cafe_reward.py to_cafe (its relationship_rank_up popup-handling now also ported, see below), interaction_for_cafe_solve_method3, collect ba_auto/tasks/cafe.py picture.co_detect/color.rgb_in_rangedriver.color_at pixel-probe checks; sparkle template match ported in-process into ba_auto/detector.py (find_cafe_sparkle, now multi-scale) Migrated: real Python, state-verified via color probes (no legacy bridge). Pat loop now polls for the full attempt budget instead of stopping on the first miss (see plan.md Phase 6 follow-up) — not yet confirmed against a live sparkle since none was available during testing. _dismiss_rank_up_if_shown reuses navigation.is_on_subscreen to detect and clear the full-screen bond-rank-up cutscene after a pat (see plan.md Phase 6 follow-up: rank-up popups) — not yet live-confirmed against a real trigger
Stamina/AP module/collect_daily_free_power.py, module/collect_daily_task_power.py to_tasks/implement (task-power, ported); to_purchase_pyroxenes_menu (free-power, not ported) ba_auto/tasks/stamina.py color.rgb_in_rangedriver.color_at; reference's per-tab claim loop → live UI's single "一括受取" bulk-claim button + Enter Partially migrated: Mission-panel claim done (see plan.md Phase 8). Daily Free Power (real-money purchase menu) deliberately not automated
Normal/Hard story AP sweep module/explore_tasks/sweep_task.py, module/explore_tasks/task_utils.py to_region (ported: OCR region-number readout + delta-click), a scoped-down swipe_search_target_str (ported: OCR stage-row label matching), start_sweep's named-outcome contract (ported via navigation.wait_for_state, this project's scoped co_detect port) ba_auto/tasks/story_sweep.py OCR region/stage-name matching, ported for real (Phase 10) — replaces Phase 9's "next-region arrow stops advancing, then random stage" heuristic; MAX click verified via SWEEP_MINUS_BUTTON_PROBE color check (reused, still correct), modal closed via its own X button (Escape doesn't close it; X-button position re-calibrated per stage-layout variant, see Phase 10) Done (see plan.md Phase 10, supersedes Phase 9). Config-driven exact (region, stage, count) targets (config.STORY_SWEEP_TARGETS), not latest-region/random-stage. Opt-in only, not in default flow
Group/Club AP module/group.py Need to inspect ba_auto/tasks/group.py fixed click + state check via local driver Not started
Bounty module/rewarded_task.py Need to inspect ba_auto/tasks/bounty.py sweep/color/OCR adaptation Not started
Commissions module/clear_special_task_power.py Need to inspect ba_auto/tasks/commission.py sweep/color adaptation Not started
Arena module/arena.py Need to inspect ba_auto/tasks/arena.py auto-fight + OCR + local driver Not started
Common Shop module/shop/common_shop.py, module/shop/shop_utils.py implement, to_common_shop, get_item_position/ensure_choose/buy (shared, see Tactical Shop row) ba_auto/tasks/shop_common.py, ba_auto/tasks/shop_utils.py get_item_position's color+template item-state scan → fixed grid-position targets (config.COMMON_SHOP_TARGETS) + price-digit OCR verify, since the reference's own item-identification here indexes an external static price table (self.static_config.common_shop_price_list, fetched from a remote resource) this repo doesn't have — not per-item OCR, so this isn't an OCR-avoidance shortcut. Purchase-confirm dialog + reward-acquired banner handled via a single overlay-darkness probe (config.SHOP_OVERLAY_PROBE) instead of tracking each dialog's own layout Done. Live-tested with real purchases (all 8 configured targets bought, cost matched exactly). Discovered live: these items have a per-refresh-cycle purchase cap not shown as a visible counter (unlike the 青輝石 tab's "あと1回購入可能" labels) — confirmed by re-running the task after purchase and observing it correctly detect the now-unselectable items (checkbox + individual 購入 button both unresponsive) and safely decline rather than guess. A fresh, everything-available run hasn't been re-verified since the account had already exhausted this cycle's purchases via that same test
Tactical Shop module/shop/tactical_challenge_shop.py, module/shop/shop_utils.py implement, goto_shop_by_name, shared get_item_position/ensure_choose/buy ba_auto/tasks/shop_tactical.py, ba_auto/tasks/shop_utils.py goto_shop_by_name's OCR swipe-search over the shop-tab list → fixed click (config.SHOP_TAB_TACTICAL): this account's tab list is only 7 entries and fits on screen with no scroll needed, confirmed live, so there's nothing to search for — not an OCR-avoidance shortcut. Same grid-position + price-OCR-verify + overlay-probe design as Common Shop, sharing shop_utils.run_shop_tab Done. Live-tested with real purchases (both configured AP-recovery drinks bought; AP and tactical-coin balance changes matched exactly)
Lesson/Schedule module/lesson.py implement, to_lesson_location_select/to_select_location/to_all_locations (nav state machine), get_lesson_region_num/switch_lesson_region_page/to_lesson_region (paged region nav), get_lesson_each_region_status+check_region_availability (per-cell status via isometric-parallelogram pixel scan), get_lesson_relationship_counts (per-cell affection pip count via color count), choose_lesson (selection policy), execute_lesson/to_location_info/start_lesson (click cell -> info panel -> start -> result) ba_auto/tasks/lesson.py picture.co_detect -> navigation.wait_for_state-style bounded Enter-press loop (see below); the reference's paged-arrow region nav (needing OCR to know current position) -> this client renders the 12 regions as a scrollable list instead, which only ever settles at two scroll positions (config.LESSON_REGION_ROW_Y), so navigation is direct index-based clicking with nothing to OCR-locate; the reference's isometric Parallelogram/Triangle per-cell scan (tuned to the reference's own screen layout) -> reading each portrait's heart-shaped affection badge via a dedicated OCR path (detector.read_int_on_heart_badge) needs no isometric geometry at all Done. Config-driven scope only in the sense of the policy (affection-first selection, sweep every unlocked region until tickets/lessons run out, no ticket purchasing, no favor-student targeting) -- unlike shop, no user-specific target list was needed since the reference's own lesson_region_name.JP (embedded directly in its default_config.py, not externally fetched) already names all 12 regions, used here only for logging. Live-tested for real: 5 real tickets spent across 3 regions with correct outcomes (ticket count, cleanup navigation, home-screen return all verified). Two real bugs were found and fixed from that run -- see below and plan.md's Lesson phase

Do not implement a feature without filling at least the relevant row.