feat(port): complete live client rendering support for xxf 5-zone client (MSM races, acce/sash, UI compat)
This commit is contained in:
@@ -13,6 +13,7 @@ import os
|
||||
import sys
|
||||
import shutil
|
||||
import subprocess
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
REPO = Path(__file__).resolve().parents[1]
|
||||
@@ -32,6 +33,55 @@ EXCLUDE_FILES = {
|
||||
"shiningtable - 副本.txt",
|
||||
}
|
||||
|
||||
FALLBACK_LOGIN_FAILURES = {
|
||||
b'LOGIN_FAILURE_NOTELEBLOCK': '电话密保验证失败'.encode('gbk'),
|
||||
b'LOGIN_FAILURE_PASERR1': '密保卡密码错误'.encode('gbk'),
|
||||
b'LOGIN_FAILURE_PASERR2': '密保卡坐标错误'.encode('gbk'),
|
||||
b'LOGIN_FAILURE_PASERR3': '密保卡验证超时'.encode('gbk'),
|
||||
b'LOGIN_FAILURE_PASERR4': '密保卡已锁定'.encode('gbk'),
|
||||
b'LOGIN_FAILURE_PASERR5': '密保卡验证失败'.encode('gbk'),
|
||||
b'LOGIN_FAILURE_SHUTDOWN_TIME': '服务器维护中'.encode('gbk'),
|
||||
b'LOGIN_FAILURE_TIMEOUT': '连接超时'.encode('gbk'),
|
||||
b'LOGIN_FAILURE_WRONG_SOCIALID': '身份证号错误'.encode('gbk'),
|
||||
}
|
||||
|
||||
def normalize_locale_text_file(path: Path):
|
||||
if not path.is_file():
|
||||
return
|
||||
raw = path.read_bytes()
|
||||
lines = raw.splitlines()
|
||||
out = []
|
||||
keys_present = set()
|
||||
modified = False
|
||||
for line in lines:
|
||||
s = line.strip(b'\r\n')
|
||||
if not s or s.startswith(b'#') or s.startswith(b'-'):
|
||||
continue
|
||||
if b'\t' in s:
|
||||
parts = s.split(b'\t')
|
||||
keys_present.add(parts[0])
|
||||
if len(parts) >= 3 and parts[2].strip() not in (b'SA', b'SNA'):
|
||||
parts[2] = b'SA'
|
||||
s = b'\t'.join(parts)
|
||||
modified = True
|
||||
out.append(s + b'\n')
|
||||
else:
|
||||
m = re.match(rb'^([A-Za-z0-9_]+)[\s\t]*(.*)$', s)
|
||||
if m:
|
||||
k, v = m.group(1), m.group(2)
|
||||
keys_present.add(k)
|
||||
out.append(k + b'\t' + v + b'\n')
|
||||
modified = True
|
||||
else:
|
||||
out.append(s + b'\n')
|
||||
if path.name == "locale_game.txt":
|
||||
for k, v in FALLBACK_LOGIN_FAILURES.items():
|
||||
if k not in keys_present:
|
||||
out.append(k + b'\t' + v + b'\n')
|
||||
modified = True
|
||||
if modified:
|
||||
path.write_bytes(b''.join(out))
|
||||
|
||||
def stage_files():
|
||||
if STAGE_DIR.exists():
|
||||
shutil.rmtree(STAGE_DIR)
|
||||
@@ -59,6 +109,9 @@ def stage_files():
|
||||
src_f = Path(root) / f
|
||||
shutil.copy2(src_f, dst_newcibn / rel / f)
|
||||
shutil.copy2(src_f, dst_zh / rel / f)
|
||||
if f.endswith(".txt"):
|
||||
normalize_locale_text_file(dst_newcibn / rel / f)
|
||||
normalize_locale_text_file(dst_zh / rel / f)
|
||||
file_count += 1
|
||||
|
||||
print(f"Staged {file_count} files for locale/newcibn and locale/zh.")
|
||||
|
||||
Reference in New Issue
Block a user