fix: import complete sash combine chains and sync isolated db prototypes

This commit is contained in:
shen
2026-10-17 04:55:26 -07:00
parent 790037729f
commit 108fe17127
5 changed files with 66 additions and 19 deletions
+19 -14
View File
@@ -82,6 +82,10 @@ def names():
for k in range(PENDANT_STEPS):result[base+k]='%s+%d'%(n,k)
for base,n in RINGS.items():
for k in range(10):result[base+k]='%s+%d'%(n,k)
# Combine consumes two sashes and advances to the next grade; import every step.
for base,label in ((85001,'领主'),(85005,'大师'),(85011,'王朝'),(85015,'皇家')):
for grade,suffix in enumerate(('普通','精致','高级','个人')):
result[base+grade]=label+'披风('+suffix+')'
result.update({50348:'属性锁定符',50349:'属性解锁符'})
for month in range(1,13):result[25149+month]='%d月战令票'%month
return result
@@ -154,31 +158,32 @@ def pack_index(pack_maker):
index.setdefault(archived.lower().replace('\\','/'),pack_maker.parent/source)
return index
def server_proto(ava,filename):
path=ava/'2. Backup SF+SRC and SQL/home/srv1/db'/filename
if path.is_file():return path.read_bytes()
with tarfile.open(ava/'2. Backup SF+SRC and SQL/FILES+SRC.tgz','r:gz') as source:
member=source.extractfile('home/srv1/db/'+filename)
if member is None:raise ValueError('AVA2 archive has no '+filename)
return member.read()
def prepare(ava,proto_reader,locale,output,tool,packer,wrap=lambda text:text):
"""wrap: the locale's itemdesc line wrapping (build_zh_locale.wrap_description)."""
E=enums(proto_reader);zh=names();wanted=set(zh)
db=ava/'2. Backup SF+SRC and SQL/home/srv1/db';pack_maker=ava/'1. Client DEV/pack_maker'
rows={}
proto=db/'item_proto.txt'
if proto.is_file():raw=proto.read_bytes()
else:
# The checked-out reference normally contains the original archive,
# not somebody else's AVA2/TEST extraction directory.
with tarfile.open(ava/'2. Backup SF+SRC and SQL/FILES+SRC.tgz','r:gz') as source:
member=source.extractfile('home/srv1/db/item_proto.txt')
if member is None:raise ValueError('AVA2 archive has no item_proto.txt')
raw=member.read()
raw=server_proto(ava,'item_proto.txt')
for line in raw.splitlines():
cols=line.split(b'\t')
if cols[0].strip().isdigit() and int(cols[0]) in wanted:rows[int(cols[0])]=[x.decode('latin1') for x in cols]
# The archived server DB omits the lock materials even though its gameplay
# code registers them. AVA2's client DumpProto ships their actual definitions.
if not {50348,50349}<=rows.keys():
# The archived server DB omits lock materials and lower sash grades.
# Fill missing requested rows from AVA2's original client definitions.
if wanted-rows.keys():
dump=ava/'3. Source BIN/Tools/DumpProto/Release/item_proto.txt'
if not dump.is_file():dump=ava.parent/'3. Source BIN/Tools/DumpProto/Release/item_proto.txt'
for line in dump.read_bytes().splitlines():
cols=line.split(b'\t')
if cols[0] in (b'50348',b'50349'):rows[int(cols[0])]=[x.decode('latin1') for x in cols]
if cols[0].strip().isdigit() and int(cols[0]) in wanted-rows.keys():
rows[int(cols[0])]=[x.decode('latin1') for x in cols]
assert rows.keys()==wanted,sorted(wanted-rows.keys())
listrows={}
for line in (pack_maker/'locale/locale/es/item_list.txt').read_bytes().splitlines():
@@ -218,7 +223,7 @@ def prepare(ava,proto_reader,locale,output,tool,packer,wrap=lambda text:text):
(output/'items-server.tsv').write_bytes(b'\n'.join(server)+b'\n')
(output/'items-client.tsv').write_bytes(b'\n'.join(client)+b'\n')
mobs={}
for line in (db/'mob_proto.txt').read_bytes().splitlines():
for line in server_proto(ava,'mob_proto.txt').splitlines():
cols=line.split(b'\t')
if cols[0].strip().isdigit() and int(cols[0]) in MOUNT_MOBS:
v=int(cols[0]);cols[1]=MOUNT_MOBS[v][0].encode('gbk');mobs[v]=b'\t'.join(cols)