P0-1 补齐镜牢商店必买/必卖/公式合成清单

Browse Source
上游 ebb6629 把图片挪到 assets/images/<主题>/<语言>/ 下,
tasks/mirror/__init__.py 仍按 ./assets/images/share/... 列目录,三个
清单恒为空:11-14 实测进店 51 秒一件没买,弃用饰品识别和公式合成
一起空转。按名字找图的 path_manager 那层没坏。

install_shop_lists() 在 mirror/all 任务里按 AALC 六个图片根合并去重,
原地 extend 三个列表(in_shop 在导入时绑定了列表对象,重新赋值无效);
上游清单已非空时不动,不改 vendor。

验证:执行上游真实 __init__.py 得到 0/0/0,补丁后 5/19/31,且每个
图片名都能在某个图片根下找到;全套 514 项通过。实机待看补丁日志与
进店后的购买动作。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
yws
2026-11-14 05:45:03 +00:00
co-authored by Claude Opus 5.5
parent 5fdb9fd221
commit baa362808c
4 changed files with 189 additions and 2 deletions
+56
View File
@@ -603,3 +603,59 @@ def install_system_team_selection(log=print):
mirror_mod.select_battle_team = select_battle_team mirror_mod.select_battle_team = select_battle_team
log('[lc_mcp] patch: 镜牢按体系名选队') log('[lc_mcp] patch: 镜牢按体系名选队')
return original return original
# ---------------------------------------------------------------- 镜牢商店清单
# 上游 ebb6629 把图片挪到 assets/images/<主题>/<语言>/ 下, tasks/mirror/__init__.py 却仍按
# ./assets/images/share/mirror/shop/... 列目录, 三个清单恒为空。2026-11-14 实测进店 51 秒,
# 打印三次 "开始购买必买项" 一件没买; 弃用饰品识别与公式合成也一起空转。
# 按名字找图(mirror/shop/<清单>/<文件>)由 path_manager 依次搜各主题/语言目录, 那一层没坏。
SHOP_LISTS = ('must_purchase', 'must_be_abandoned', 'fusion_result')
IMAGE_ROOTS = ('dark/zh_cn', 'dark/en', 'dark/share', 'default/zh_cn', 'default/en', 'default/share')
def shop_list_images(kind, images_dir=os.path.join('assets', 'images'), roots=IMAGE_ROOTS):
"""各主题/语言目录下 mirror/shop/<kind> 的图片, 按 AALC 图片名格式去重排序。"""
names = set()
for root in roots:
folder = os.path.join(images_dir, *root.split('/'), 'mirror', 'shop', kind)
try:
entries = os.listdir(folder)
except OSError:
continue
names.update(name for name in entries
if name.lower().endswith('.png') and os.path.isfile(os.path.join(folder, name)))
return ['mirror/shop/%s/%s' % (kind, name) for name in sorted(names)]
def install_shop_lists(log=print, images_dir=os.path.join('assets', 'images')):
"""原地补齐 tasks.mirror 的三个商店清单; 上游清单已非空时不动。
in_shop 用 from tasks.mirror import ... 在导入时绑定列表对象, 所以必须原地 extend,
给模块属性重新赋值对它无效。
"""
try:
import tasks.mirror as mirror_pkg
except Exception as e:
log('[lc_mcp] 商店清单补丁跳过: 无法导入 tasks.mirror: %s' % e)
return {}
try:
from utils.path_manager import PathManager
roots = tuple(PathManager.DEFAULT_ACTIVE_PATHS)
except Exception:
roots = IMAGE_ROOTS
filled = {}
for kind in SHOP_LISTS:
current = getattr(mirror_pkg, kind, None)
if not isinstance(current, list):
log('[lc_mcp] 商店清单补丁跳过 %s: 上游没有这个列表' % kind)
continue
if current:
continue # 上游已修好或已补过
current.extend(shop_list_images(kind, images_dir, roots))
filled[kind] = len(current)
if filled:
log('[lc_mcp] patch: 镜牢商店清单按 assets/images/<主题>/<语言> 补齐: %s'
% ', '.join('%s=%d' % item for item in filled.items()))
return filled
+3 -2
View File
@@ -13,8 +13,8 @@ from . import killswitch, preflight
from .aalc_engine import bootstrap from .aalc_engine import bootstrap
from .aalc_patches import (WindowGuard, driver_click_tasks, headless_hdr_warning, from .aalc_patches import (WindowGuard, driver_click_tasks, headless_hdr_warning,
install_default_battle_team, install_exact_team_match, install_default_battle_team, install_exact_team_match,
install_robust_set_foreground, install_system_team_selection, install_robust_set_foreground, install_shop_lists,
mirror_progress, stop_driver_click) install_system_team_selection, mirror_progress, stop_driver_click)
from .game_lock import GameBusyError, exclusive_game from .game_lock import GameBusyError, exclusive_game
# 任务 -> {参数名: AALC 配置项}; 参数只在本次运行内生效 # 任务 -> {参数名: AALC 配置项}; 参数只在本次运行内生效
@@ -127,6 +127,7 @@ def _run(task, params):
# 镜牢: 编队是自定义名字(体系名), AALC 只会找 "编队#N"; 改成按体系名点选。 # 镜牢: 编队是自定义名字(体系名), AALC 只会找 "编队#N"; 改成按体系名点选。
if task in ('mirror', 'all'): if task in ('mirror', 'all'):
install_system_team_selection(log=log) install_system_team_selection(log=log)
install_shop_lists(log=log)
guard = WindowGuard(screen, cfg, log=log) guard = WindowGuard(screen, cfg, log=log)
guard.start() guard.start()
restore_path = os.environ.get(RESTORE_ENV) restore_path = os.environ.get(RESTORE_ENV)