Refactor code structure for improved readability and maintainability

This commit is contained in:
Nik Afiq 2026-09-24 13:51:00 +09:00
parent 9e06b34a54
commit 0f3a1c9410
2 changed files with 35 additions and 5 deletions

View File

@ -653,15 +653,45 @@ EVENT_QUEST_TAB = (1416, 165)
# needed for this task's stages-9-12 target range. # needed for this task's stages-9-12 target range.
EVENT_STAGE_LIST_SCROLL_POINT = (1400, 700) EVENT_STAGE_LIST_SCROLL_POINT = (1400, 700)
EVENT_STAGE_LIST_SCROLL_CLICKS = 25 EVENT_STAGE_LIST_SCROLL_CLICKS = 25
EVENT_STAGE_ROW_Y = (366, 538, 710, 883, 1055) # **Recalibrated 2026-09-24**: these were calibrated against the event
# running at the time ("鉄道爆走事件"). A brand-new, unrelated event
# ("It's our Engine!", 2026.09.23 11:00-2026.10.07 10:59) replaced it and
# shifted this same bottom-scrolled row layout down by a consistent ~12-13px
# -- confirmed live via pixel-column scanning of the actual digit glyphs
# (not guessed): row centers measured at 379/550/722/893 (previously
# 366/538/710/883), a steady +12 to +13px offset across all four rows. The
# 5th slot (previously 1055) no longer lands on a stage row at all for this
# event -- only 4 stages (9-12) fit in the bottom-scrolled view now, with
# the event-points progress bar's own "4799/15000" digits sitting in
# roughly that vertical area instead; keeping a 5th slot there risked
# misreading those digits as a stage number, so it's dropped rather than
# guessed at. `_scan_stage_rows_once` loops over however many entries this
# tuple has, so 4 instead of 5 needs no other code change. Root-caused with
# `detector.read_int_bordered` itself returning None/garbage at the OLD
# positions on the live page (matching the user's own reported log
# verbatim) before re-measuring -- not assumed from the symptom alone. If a
# future event shifts this again, re-run the same pixel-column-scan
# approach (scratchpad probe, sample the actual glyph pixel extents) rather
# than guessing a new offset.
EVENT_STAGE_ROW_Y = (379, 550, 722, 893)
EVENT_STAGE_ENTER_X = 1698 EVENT_STAGE_ENTER_X = 1698
# Stage-number OCR crop (e.g. "09", "12"), offset from a row's known center # Stage-number OCR crop (e.g. "09", "12"), offset from a row's known center
# y -- rect = (x1, row_y - top_pad, x2, row_y + bottom_pad). Pixel-scanned # y -- rect = (x1, row_y - top_pad, x2, row_y + bottom_pad). Pixel-scanned
# live across all 5 bottom-extreme row positions; tight enough to exclude # live across all bottom-extreme row positions; tight enough to exclude the
# the 3-star rating row rendered just below each number. # 3-star rating row rendered just below each number.
#
# **Widened from (30, 5) to (20, 20) alongside the 2026-09-24 row-position
# recalibration above**: the old asymmetric pad assumed the digit glyph sat
# mostly ABOVE row_y (true for the old event, digit center measured ~8px
# above row_y); the new event's digit center sits ~16px BELOW row_y instead
# (measured band e.g. 363-395 around center 379, i.e. +-16px), so a
# symmetric pad was chosen instead of just re-flipping the asymmetry --
# comfortably covers the ~32px-tall digit glyph with a few px of margin on
# both sides without reaching into the star-rating row (~13px further below
# the digit's own bottom edge in every measured row).
EVENT_STAGE_NUMBER_OCR_X = (1055, 1145) EVENT_STAGE_NUMBER_OCR_X = (1055, 1145)
EVENT_STAGE_NUMBER_OCR_Y_PAD = (30, 5) EVENT_STAGE_NUMBER_OCR_Y_PAD = (20, 20)
# 任務情報 (stage info) modal. Corner probe is pixel-identical to # 任務情報 (stage info) modal. Corner probe is pixel-identical to
# story_sweep's STAGE_MODAL_PROBE (same dark-backdrop dialog component) but # story_sweep's STAGE_MODAL_PROBE (same dark-backdrop dialog component) but

File diff suppressed because one or more lines are too long