按台账修镜牢: 饰品弹窗兜底、按键扫描码、卡包按体系加分
按 docs/ISSUES.md 处理本机回归后待修/待数据的条目:
- I-06/R-04 开局「获得E.G.O饰品」弹窗死循环: 确认模板连续第 3 次命中起改点
按钮中心(勾号 +76/1440), 连续 20 次还在就记 [ERROR]、抛 TaskAbort 结束任务
(上游 continue 跳过了循环计数)。单测执行上游真实 select_init_ego_gift。
- I-05/R-03 键盘寻路 0 成功: 前台按键改发带扫描码和扩展键标志的 keybd_event,
各模式按住 0.12 秒(上游注释: Unity 6 校验扫描码/扩展键); 连续 3 个节点进不去
就本次任务停用键盘寻路(方案 B)。MCP key 工具前台同样处理。LCP_KEY_HOLD=0 关。
- I-07/R-02 事件表 6 -> 9 条: 蜘蛛巢、归乡路途两段(拿「归途」), 按 wiki.gg 核对结果;
全表按本机装的零协 release 2026111301 重新核对唯一性。
- I-13 复查 5992827: 「进入」先模板确认再 OCR(原来每轮都跑一次整屏 OCR);
选队页重试重新截图; 入场切队失败记 [ERROR] 且本局不再重翻列表。
- R-01/I-08 卡包按体系加分: wiki.gg 122 个卡包(楼层/专属饰品/Featured 分类) +
零协中文名生成 lc_mcp/data/theme_pack_systems.json(scripts/build_theme_pack_systems.py);
灰机 wiki 对云端 403、BWIKI 无卡包条目, 中文社区攻略用 codex CLI 联网检索,
推荐/避开并入表的 community。选卡包时临时加到 AALC 权重上, 按当前难度只看会出现
的卡包; 审计记 system_bonus。LCP_THEME_PACK_SYSTEMS=0 关。
- 文档: ISSUES/BACKLOG/README 更新, 新增 docs/feedback/2026-11-15/REGRESSION.md
(本轮回归清单)和 theme-pack-research.md(检索记录)。
单测 703 个全过(Linux)。实机未验。
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,157 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""生成 lc_mcp/data/theme_pack_systems.json: 镜牢卡包 → 体系(BACKLOG R-01)。
|
||||||
|
|
||||||
|
用法:
|
||||||
|
python scripts/build_theme_pack_systems.py <LLC_zh-CN 目录> <LLC EN 目录> [-o 输出文件]
|
||||||
|
|
||||||
|
两个目录分别是零协汉化的中文包(游戏里的 LimbusCompany_Data/Lang/LLC_zh-CN, 或 release 解压出来的同名目录)
|
||||||
|
和 LocalizeLimbusCompany 仓库里的 EN 目录, 只用其中的 MirrorDungeonTheme*.json(卡包 id → 名字)。
|
||||||
|
|
||||||
|
卡包数据来自 Limbus Company Wiki(https://limbuscompany.wiki.gg, CC BY-SA 4.0), 运行时在线读取:
|
||||||
|
- 各卡包条目的 {{ThemePackInfo}}: 出现楼层(normal/hard)、专属饰品(unique);
|
||||||
|
- 条目里「Featured Gifts」用的饰品分类: 是体系名(Burn/Charge/...)的就是体系包;
|
||||||
|
- Module:EgoGift/data: 每件饰品的体系(category)。
|
||||||
|
|
||||||
|
边狱巴士 BWIKI(wiki.biligame.com/limbuscompany)2026-11-15 查过: 699 个页面里没有卡包条目, 所以不用它。
|
||||||
|
"""
|
||||||
|
import argparse
|
||||||
|
import glob
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
import urllib.parse
|
||||||
|
import urllib.request
|
||||||
|
|
||||||
|
API = 'https://limbuscompany.wiki.gg/api.php'
|
||||||
|
RAW = 'https://limbuscompany.wiki.gg/index.php'
|
||||||
|
USER_AGENT = 'research-script/1.0 (python-urllib)'
|
||||||
|
CATEGORY = 'Category:Floor Theme Pack Pages'
|
||||||
|
SYSTEMS = {'Burn': 'burn', 'Bleed': 'bleed', 'Tremor': 'tremor', 'Rupture': 'rupture', 'Sinking': 'sinking',
|
||||||
|
'Poise': 'poise', 'Charge': 'charge', 'Slash': 'slash', 'Pierce': 'pierce', 'Blunt': 'blunt'}
|
||||||
|
# 零协 EN 文件里还没有英文名、或者写法和 wiki 条目名不一样的卡包
|
||||||
|
EN_OVERRIDES = {
|
||||||
|
1028: 'Storefront Campout', 1029: 'An Anarchy of Colors', 1030: 'Creed of Preservation',
|
||||||
|
1031: 'Readvent of Gluttony', 1111: 'Line 4 - Section 3', 1112: 'Line 4 - Section 4',
|
||||||
|
1129: 'The Wedge in the Wake of Dawnbreak',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def fetch(url, params):
|
||||||
|
request = urllib.request.Request(url + '?' + urllib.parse.urlencode(params), headers={'User-Agent': USER_AGENT})
|
||||||
|
with urllib.request.urlopen(request, timeout=60) as response:
|
||||||
|
return response.read().decode('utf-8')
|
||||||
|
|
||||||
|
|
||||||
|
def theme_pack_pages():
|
||||||
|
titles, cont = [], {}
|
||||||
|
while True:
|
||||||
|
data = json.loads(fetch(API, {'action': 'query', 'list': 'categorymembers', 'cmtitle': CATEGORY,
|
||||||
|
'cmlimit': '500', 'format': 'json', **cont}))
|
||||||
|
titles += [m['title'] for m in data['query']['categorymembers'] if m['title'].endswith(' Theme Pack')]
|
||||||
|
if 'continue' not in data:
|
||||||
|
break
|
||||||
|
cont = {'cmcontinue': data['continue']['cmcontinue']}
|
||||||
|
pages = {}
|
||||||
|
for i in range(0, len(titles), 40):
|
||||||
|
data = json.loads(fetch(API, {'action': 'query', 'prop': 'revisions', 'rvprop': 'content', 'rvslots': 'main',
|
||||||
|
'titles': '|'.join(titles[i:i + 40]), 'format': 'json', 'formatversion': '2'}))
|
||||||
|
for page in data['query']['pages']:
|
||||||
|
if 'revisions' in page:
|
||||||
|
pages[page['title'][:-len(' Theme Pack')]] = page['revisions'][0]['slots']['main']['content']
|
||||||
|
time.sleep(1)
|
||||||
|
return pages
|
||||||
|
|
||||||
|
|
||||||
|
def gift_categories():
|
||||||
|
lua = fetch(RAW, {'title': 'Module:EgoGift/data', 'action': 'raw'})
|
||||||
|
gifts = {}
|
||||||
|
for match in re.finditer(r'^\s*\["([^"]+)"\]\s*=\s*\{(.*)\},?\s*$', lua, re.M):
|
||||||
|
category = re.search(r'category\s*=\s*"([^"]*)"', match.group(2))
|
||||||
|
gifts[match.group(1)] = category.group(1) if category else None
|
||||||
|
return gifts
|
||||||
|
|
||||||
|
|
||||||
|
def parse_pack(text, gifts):
|
||||||
|
info = re.search(r'\{\{ThemePackInfo(.*?)\n\}\}', text, re.S)
|
||||||
|
fields = dict(re.findall(r'\|\s*(\w+)\s*=\s*([^\n|]*)', info.group(1))) if info else {}
|
||||||
|
unique = {}
|
||||||
|
for gift in (g.strip() for g in fields.get('unique', '').split(';')):
|
||||||
|
category = gifts.get(gift, gifts.get(gift.replace("'", '’'))) if gift else None
|
||||||
|
if category in SYSTEMS:
|
||||||
|
unique[SYSTEMS[category]] = unique.get(SYSTEMS[category], 0) + 1
|
||||||
|
featured = sorted({SYSTEMS[c] for c in re.findall(r'\{\{#invoke:GiftList\|Category\|([^}|]+)\}\}', text)
|
||||||
|
if c in SYSTEMS})
|
||||||
|
return {'normal': fields.get('normal', '').replace(' ', ''), 'hard': fields.get('hard', '').replace(' ', ''),
|
||||||
|
'featured': featured, 'unique': dict(sorted(unique.items()))}
|
||||||
|
|
||||||
|
|
||||||
|
def theme_names(directory):
|
||||||
|
names = {}
|
||||||
|
for path in glob.glob(os.path.join(directory, 'MirrorDungeonTheme*.json')):
|
||||||
|
with open(path, encoding='utf-8-sig') as fh:
|
||||||
|
for entry in json.load(fh).get('dataList', []):
|
||||||
|
names[entry['id']] = entry.get('name', '')
|
||||||
|
return names
|
||||||
|
|
||||||
|
|
||||||
|
def key(name):
|
||||||
|
return re.sub(r'[^0-9a-z]', '', name.lower())
|
||||||
|
|
||||||
|
|
||||||
|
def build(zh_dir, en_dir):
|
||||||
|
zh, en = theme_names(zh_dir), theme_names(en_dir)
|
||||||
|
en.update(EN_OVERRIDES)
|
||||||
|
gifts = gift_categories()
|
||||||
|
wiki = {key(title): (title, parse_pack(text, gifts)) for title, text in theme_pack_pages().items()}
|
||||||
|
packs, unmatched = [], []
|
||||||
|
for pack_id in sorted(zh):
|
||||||
|
title, data = wiki.get(key(en.get(pack_id, '')), (None, None))
|
||||||
|
if data is None:
|
||||||
|
unmatched.append('%d %s' % (pack_id, zh[pack_id]))
|
||||||
|
continue
|
||||||
|
packs.append({'id': pack_id, 'zh': zh[pack_id], 'en': title, **data})
|
||||||
|
return packs, unmatched
|
||||||
|
|
||||||
|
|
||||||
|
def _rows(items, indent):
|
||||||
|
return ['%s%s%s' % (indent, json.dumps(item, ensure_ascii=False), ',' if i < len(items) - 1 else '')
|
||||||
|
for i, item in enumerate(items)]
|
||||||
|
|
||||||
|
|
||||||
|
def dump_table(table):
|
||||||
|
"""写回 JSON: 卡包和社区条目每条一行, 好看 diff。"""
|
||||||
|
notes = json.dumps(table['_说明'], ensure_ascii=False, indent=1).replace('\n', '\n ')
|
||||||
|
lines = ['{', ' "_说明": %s,' % notes, ' "bonus": %s,' % json.dumps(table['bonus'], ensure_ascii=False)]
|
||||||
|
community = table.get('community')
|
||||||
|
if community:
|
||||||
|
lines += [' "community": {',
|
||||||
|
' "_说明": %s,' % json.dumps(community['_说明'], ensure_ascii=False, indent=1).replace('\n', '\n '),
|
||||||
|
' "recommend": ['] + _rows(community['recommend'], ' ') + \
|
||||||
|
[' ],', ' "avoid": ['] + _rows(community['avoid'], ' ') + [' ]', ' },']
|
||||||
|
lines += [' "packs": ['] + _rows(table['packs'], ' ') + [' ]', '}']
|
||||||
|
return '\n'.join(lines) + '\n'
|
||||||
|
|
||||||
|
|
||||||
|
def main(argv):
|
||||||
|
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||||
|
parser.add_argument('zh_dir')
|
||||||
|
parser.add_argument('en_dir')
|
||||||
|
parser.add_argument('-o', '--output', default=os.path.join(os.path.dirname(__file__), '..', 'lc_mcp', 'data',
|
||||||
|
'theme_pack_systems.json'))
|
||||||
|
args = parser.parse_args(argv)
|
||||||
|
packs, unmatched = build(args.zh_dir, args.en_dir)
|
||||||
|
with open(args.output, encoding='utf-8') as fh:
|
||||||
|
table = json.load(fh) # 保留手写的 _说明、bonus、community, 只换 packs
|
||||||
|
table['packs'] = packs
|
||||||
|
with open(args.output, 'w', encoding='utf-8') as fh:
|
||||||
|
fh.write(dump_table(table))
|
||||||
|
print('卡包 %d 个写入 %s' % (len(packs), args.output))
|
||||||
|
if unmatched:
|
||||||
|
print('wiki 上没对上的: %s' % ', '.join(unmatched))
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
sys.exit(main(sys.argv[1:]))
|
||||||
Reference in New Issue
Block a user