Files
windroost/tools/fullgame/record_text.py
T
wushenghua 682404f7f6 content: 167 unique record texts + QA (L5 polish)
Continued FULL_GAME_GOAL. Records were template placeholders (A001 + category).
- record_text.py: 5 concrete milestone wordings per category x 9 categories,
  cycled with order so all 167 records get a distinct zh/en title + description
  (334 keys per locale), merged into ui_text and bundled runtime data.
- Side records tab now shows the real title/description instead of an ID.
- content_qa enforces all 167 records have non-empty title+desc in both locales
  and that en_US contains no Chinese.

All gates pass; P2_CHECKS_PASS. prototype/ untracked.
2026-11-18 17:36:26 +08:00

117 lines
6.6 KiB
Python

#!/usr/bin/env python3
"""Generate real titles/descriptions for all 167 records (L5 content polish).
Each category has a bank of concrete milestone wordings; records in a category
cycle through them with an order suffix so all 167 are distinct and readable,
not 'category/theme/order' placeholders. zh_CN + en_US merged into ui_text.
"""
from __future__ import annotations
import json
from pathlib import Path
from typing import Any, Dict
ROOT = Path(__file__).resolve().parents[2]
PACK = ROOT / "data" / "full_game_content.json"
# category -> list of (zh title, zh desc, en title, en desc)
BANK: Dict[str, list] = {
"推进": [
("越过航标", "点亮第 {n} 个航标,航线向前延伸", "Pass the beacon", "Light beacon {n}; the route extends"),
("踏平营地", "清除第 {n} 座浮岛营地", "Clear the camp", "Clear floating camp {n}"),
("翻开新章", "推进到第 {n} 章的疆域", "New chapter", "Reach the frontier of chapter {n}"),
("跨越地区", "踏足第 {n} 个地区", "Cross a region", "Set foot in region {n}"),
("裂隙回声", "抵达第 {n} 层裂隙", "Rift echo", "Reach rift layer {n}"),
],
"战斗": [
("击溃敌群", "累计击败第 {n} 波敌人", "Rout the foe", "Defeat wave {n}"),
("首领倒下", "第 {n} 次击倒地区首领", "Boss felled", "Fell a regional boss {n} time(s)"),
("战术奏效", "第 {n} 次用弱点击穿护甲", "Tactic works", "Break armor via weakness {n} time(s)"),
("绝境翻盘", "第 {n} 次从残血反败为胜", "Comeback", "Win from low health {n} time(s)"),
("状态掌控", "第 {n} 次叠加满层状态", "Status mastery", "Stack a status to full {n} time(s)"),
],
"英雄": [
("新同伴", "招募第 {n} 名英雄", "New ally", "Recruit hero {n}"),
("星光淬炼", "将英雄升至第 {n} 星", "Star forged", "Raise a hero to star {n}"),
("觉醒之力", "完成第 {n} 次觉醒", "Awakening", "Complete awakening {n}"),
("阵容轮换", "第 {n} 次更换出战阵容", "Roster shift", "Rotate the battle roster {n} time(s)"),
("签名共鸣", "第 {n} 次激活签名共鸣", "Signature resonance", "Trigger signature resonance {n} time(s)"),
],
"Build": [
("羁绊成形", "点亮第 {n} 条羁绊", "Bond formed", "Light up bond {n}"),
("签名雕琢", "强化第 {n} 次签名方向", "Signature honed", "Hone signature direction {n}"),
("装备成型", "装备第 {n} 件本轮装备", "Gear set", "Equip gear piece {n}"),
("遗物共鸣", "收集第 {n} 件长期遗物", "Relic resonance", "Collect relic {n}"),
("律动构建", "形成第 {n} 套 Build 方向", "Build rhythm", "Form build direction {n}"),
],
"转生": [
("重整旗鼓", "第 {n} 次重建冒险团", "Rebuild", "Rebuild the company {n} time(s)"),
("新天空", "第 {n} 次开启新天空", "New sky", "Open a new sky {n} time(s)"),
("誓约生效", "激活第 {n} 个核心誓约", "Oath in effect", "Activate core oath {n}"),
("律令颁布", "颁布第 {n} 条风之律令", "Edict declared", "Declare wind edict {n}"),
("轮回传承", "带着第 {n} 轮积累开启新周期", "Cycle legacy", "Begin cycle with {n} inheritances"),
],
"经济": [
("金币满仓", "累计赚取第 {n} 笔金币", "Gold hoard", "Earn gold payout {n}"),
("材料入库", "囤积第 {n} 份锻造材料", "Stockpile", "Stockpile material batch {n}"),
("风晶汇聚", "收集第 {n} 枚风晶", "Crystal flow", "Collect crystal {n}"),
("黑市识途", "完成第 {n} 次黑市交易", "Market savvy", "Complete market trade {n}"),
("商路畅通", "第 {n} 次跑通商路", "Trade route", "Run the trade route {n} time(s)"),
],
"伙伴": [
("委托达成", "完成伙伴第 {n} 项委托", "Commission done", "Complete partner commission {n}"),
("专长精进", "伙伴等级达到第 {n} 级", "Expertise", "Partner reaches level {n}"),
("救援归来", "第 {n} 次让伙伴执行复活任务", "Rescue return", "Send partner on revive task {n}"),
("报告归档", "收到第 {n} 份资源报告", "Report filed", "Receive resource report {n}"),
("驻扎有序", "第 {n} 次安排驻扎", "Garrison orderly", "Arrange garrison {n} time(s)"),
],
"收集": [
("图鉴增辉", "图鉴收录第 {n} 项", "Codex shine", "Codex entry {n}"),
("外观收藏", "获得第 {n} 件外观", "Cosmetic", "Obtain cosmetic {n}"),
("遗物齐备", "集齐第 {n} 组遗物", "Relic set", "Complete relic set {n}"),
("装备图册", "收录第 {n} 件装备图样", "Gear catalogue", "Catalogue gear blueprint {n}"),
("珍稀发现", "发现第 {n} 件稀有收藏", "Rare find", "Discover rare collectible {n}"),
],
"终局": [
("神殿之门", "抵达天空神殿第 {n} 层", "Temple gate", "Reach sky temple layer {n}"),
("裂隙深处", "突破裂隙第 {n} 层", "Rift depth", "Break through rift layer {n}"),
("挑战词缀", "完成第 {n} 项终局挑战", "Challenge affix", "Complete endgame challenge {n}"),
("巨像封印", "第 {n} 次撼动巨像封印", "Colossus seal", "Shake colossus seal {n} time(s)"),
("终章回响", "第 {n} 次见证结局回响", "Final echo", "Witness ending echo {n} time(s)"),
],
}
def generate(pack: Dict[str, Any]) -> Dict[str, Dict[str, str]]:
out = {"zh_CN": {}, "en_US": {}}
for r in pack["records"]:
cat = r["category"]
order = int(r["order"])
bank = BANK[cat]
zh_t, zh_d, en_t, en_d = bank[(order - 1) % len(bank)]
# add order so duplicate bank entries stay distinct
key_t = f"record.{r['id']}.title"
key_d = f"record.{r['id']}.desc"
out["zh_CN"][key_t] = f"{zh_t} {order}"
out["zh_CN"][key_d] = zh_d.format(n=order)
out["en_US"][key_t] = f"{en_t} {order}"
out["en_US"][key_d] = en_d.format(n=order)
return out
def main() -> int:
pack = json.loads(PACK.read_text(encoding="utf-8"))
texts = generate(pack)
for loc in ("zh_CN", "en_US"):
p = ROOT / "data" / f"ui_text.{loc}.json"
data = json.loads(p.read_text(encoding="utf-8"))
for k, v in texts[loc].items():
data["strings"][k] = v
p.write_text(json.dumps(data, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
print(f"{loc}: +{len(texts[loc])} record keys (total {len(data['strings'])})")
return 0
if __name__ == "__main__":
raise SystemExit(main())