Merge main into feature/ava2-unlock
Conflicts resolved by keeping both sides: AVA2 attribute lock materials (50348/50349) and battle pass tickets from main alongside the unlock branch's costume enchants, talismans and new rings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,7 @@ Only types/subtypes/flags the 40250 server understands (plus the ported AVA2 sys
|
||||
enchants, talismans, new rings) survive; items of the AVA2-only systems not ported yet (pets, weapon/sash-skin/effect
|
||||
costume enchants, new skill books) become plain ITEM_NONE items. Also writes mobs-server.tsv (MOUNT_MOBS) for install_items.py. Usage: see build_zh_locale.build_ava2_items and --help.
|
||||
"""
|
||||
import argparse,json,re,shutil,subprocess
|
||||
import argparse,json,re,shutil,subprocess,tarfile
|
||||
from pathlib import Path
|
||||
HERE=Path(__file__).resolve().parent
|
||||
RANGES=((54001,54027,'时装强化石'),(54028,54078,'发型强化石'),(54079,54123,'武器外观强化石'),
|
||||
@@ -80,6 +80,8 @@ 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)
|
||||
result.update({50348:'属性锁定符',50349:'属性解锁符'})
|
||||
for month in range(1,13):result[25149+month]='%d月战令票'%month
|
||||
return result
|
||||
|
||||
def convert(cols,E,imported):
|
||||
@@ -88,7 +90,8 @@ def convert(cols,E,imported):
|
||||
t,st=c[2],c[3]
|
||||
kept=t in KEEP_TYPES or (t,st) in KEEP_SUBTYPES or ((t,st)==('ITEM_USE','USE_CHANGE_ATTRIBUTE') and
|
||||
any(lo<=int(c[0])<=hi for lo,hi in ENCHANT_KEEP)) or (
|
||||
(t,st) in (('ITEM_USE','USE_CHANGE_ATTRIBUTE'),('ITEM_USE','USE_ADD_ATTRIBUTE')) and int(c[0]) in PENDANT_SCROLLS)
|
||||
(t,st) in (('ITEM_USE','USE_CHANGE_ATTRIBUTE'),('ITEM_USE','USE_ADD_ATTRIBUTE')) and int(c[0]) in PENDANT_SCROLLS) or (
|
||||
int(c[0]) in (50348,50349) and (t,st)==('ITEM_USE','USE_CHANGE_ATTRIBUTE'))
|
||||
anti=tokens(c[5]);flags=tokens(c[6])
|
||||
if 'ITEM_STACKABLE' in anti:anti.remove('ITEM_STACKABLE');flags.append('ITEM_STACKABLE')
|
||||
anti=[a for a in dict.fromkeys(anti) if a in E['anti']];flags=[f for f in dict.fromkeys(flags) if f in E['flag']]
|
||||
@@ -154,9 +157,26 @@ def prepare(ava,proto_reader,locale,output,tool,packer,wrap=lambda text:text):
|
||||
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={}
|
||||
for line in (db/'item_proto.txt').read_bytes().splitlines():
|
||||
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()
|
||||
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():
|
||||
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]
|
||||
assert rows.keys()==wanted,sorted(wanted-rows.keys())
|
||||
listrows={}
|
||||
for line in (pack_maker/'locale/locale/es/item_list.txt').read_bytes().splitlines():
|
||||
@@ -214,6 +234,9 @@ def prepare(ava,proto_reader,locale,output,tool,packer,wrap=lambda text:text):
|
||||
else:
|
||||
t=rows[v][2].strip()
|
||||
desc=DESC_VNUM.get(v) or DESC_SUB.get((t,rows[v][3].strip()),DESC.get(t,'')) if v in report['kept'] else LOCKED
|
||||
if v==50348:desc='装备有5条普通属性时,可锁定其中一条;最多锁定2组。每次消耗1张。'
|
||||
elif v==50349:desc='解除装备上的属性锁定,每次消耗1张。'
|
||||
elif 25150<=v<=25161:desc='仅限对应月份激活战令,确认后消耗;激活后开始累计任务进度。'
|
||||
result.append(('%d\t%s\t%s'%(v,zh[v],wrap(desc) if desc else '')).encode('gbk'))
|
||||
(target/filename).write_bytes(b'\n'.join(result)+b'\n')
|
||||
subprocess.run([str(packer),str(output/'ava2items'),str(assets),''],check=True)
|
||||
|
||||
@@ -107,8 +107,17 @@ class ConvertTests(unittest.TestCase):
|
||||
del files['d:/ymir work/effect/etc/buff/light010.dds']
|
||||
with self.assertRaises(SystemExit):m.effect_files(files)
|
||||
|
||||
def test_lock_materials_and_monthly_tickets(self):
|
||||
for vnum in (50348,50349):
|
||||
server,client,kept=m.convert(row(vnum,'ITEM_USE','USE_CHANGE_ATTRIBUTE',flags='ITEM_STACKABLE'),self.E,set())
|
||||
self.assertTrue(kept);self.assertEqual(server[2:4],['ITEM_USE','USE_CHANGE_ATTRIBUTE'])
|
||||
for month in range(1,13):
|
||||
server,client,kept=m.convert(row(25149+month,'ITEM_QUEST','QUEST_NONE',values=(str(month),)+('0',)*5),self.E,set())
|
||||
self.assertTrue(kept);self.assertEqual(server[24],str(month));self.assertEqual(client[23],month)
|
||||
|
||||
|
||||
def test_names_cover_ranges(self):
|
||||
n=m.names();self.assertEqual(len(n),514+6*200+4*9);self.assertEqual(n[54100],'武器外观强化石')
|
||||
n=m.names();self.assertEqual(len(n),514+6*200+4*9+14);self.assertEqual(n[54100],'武器外观强化石')
|
||||
self.assertEqual([n[v] for v in (21210,21219,21279)],['暗龙铠甲+0','暗龙铠甲+9','神龙铠甲+9'])
|
||||
self.assertTrue(all(len(v.encode('gbk'))<=24 for v in n.values()))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user