feat: import AVA2 spirit stone catalogue and Chinese names

This commit is contained in:
shen
2026-10-17 23:32:59 -07:00
parent a4e96a1559
commit e271e4ba49
10 changed files with 2277 additions and 128 deletions
+38
View File
@@ -18,6 +18,30 @@ PENDANT_STEPS=201
RINGS={19500:'红宝石戒指',19520:'石榴石戒指',19540:'祖母绿戒指',19560:'蓝宝石戒指'}
# Talisman attribute items: 71302 / 53996 reroll, 71301 / 53997 add (53996 / 53997 are generic on AVA2).
PENDANT_SCROLLS={53996,53997,71301,71302}
# AVA2 spirit stones: 20 complete grade chains, special stones and the broken-stone marker.
STONE_FAMILIES={0:'屠杀石',4:'偏执石',8:'创伤石',12:'愚钝石',30:'鸡血石',31:'羊脂玉',32:'羚角石',
33:'虹河石',34:'青胆石',35:'精石',36:'鹰翼石',37:'木鱼石',38:'龙骨石',39:'青石',
40:'彩芒石',41:'鹿影石',42:'东海石',43:'帝王石',44:'破碑之石',45:'克首领之石',
46:'普攻强化石',47:'技能强化石',48:'普攻抵抗石',49:'技能抵抗石'}
STONE_IDS={28000+100*grade+family for grade in range(6) for family in range(30,50)} | {28000,28100,28960} | {28000+100*grade+family for grade in range(1,6) for family in (4,8,12)}
def stone_name(v):
if v==28960:return '碎石片'
grade=(v-28000)//100
# AVA2's special stones are not ordinary +0..+5 upgrade chains. Keep their visible grades.
if v in (28100,28104,28304,28404,28504,28108,28308,28408):grade=0
return '%s+%d'%(STONE_FAMILIES[v%100],grade)
def stone_lock_reason(cols, E):
if cols[2] != 'ITEM_METIN':
return '原始数据为占位物品,该灵石暂未开放。' if int(cols[0]) in STONE_IDS else None
applies=[a for a,v in zip(cols[18:24:2],cols[19:24:2]) if a!='APPLY_NONE' and number(v)]
if not applies and int(cols[0])!=28960:return '原始数据未配置属性,该灵石暂未开放。'
if 'APPLY_ATTBONUS_WOLFMAN' in applies:return '狼人职业尚未开放,该灵石暂时无法使用。'
missing=[a for a in applies if a not in E['apply']]
if missing:raise ValueError('unsupported stone applies: '+','.join(missing))
return None
# Models of the armor shapes the 40250 race msm lack (registered by the client's mt_shapes script): shape ->
# model stem ('%s' = race); RACE_PATHS = the ShapeData PathName of each race msm.
ARMOR_SHAPES={32:'%s_7_1'}
@@ -86,6 +110,7 @@ def names():
for base,label in ((85001,'领主'),(85005,'大师'),(85011,'王朝'),(85015,'皇家')):
for grade,suffix in enumerate(('普通','精致','高级','个人')):
result[base+grade]=label+'披风('+suffix+')'
for v in sorted(STONE_IDS):result[v]=stone_name(v)
result.update({50348:'属性锁定符',50349:'属性解锁符'})
for month in range(1,13):result[25149+month]='%d月战令票'%month
return result
@@ -98,6 +123,7 @@ def convert(cols,E,imported):
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) or (
int(c[0]) in (50348,50349) and (t,st)==('ITEM_USE','USE_CHANGE_ATTRIBUTE'))
if stone_lock_reason(c,E):kept=False
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']]
@@ -243,12 +269,24 @@ 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 in STONE_IDS:
desc=stone_lock_reason(rows[v],E) or ('可镶嵌到%s的空孔中。必定成功,每次消耗1颗;同类灵石不能重复镶嵌。'%('武器或铠甲' if 'WEAR_BODY' in rows[v][7] and 'WEAR_WEAPON' in rows[v][7] else '铠甲' if 'WEAR_BODY' in rows[v][7] else '武器'))
if v==28960:desc='镶嵌失败留下的碎石,不能作为普通灵石镶嵌。'
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)
stone_rows=[line for line in server if int(line.split(b'\t',1)[0]) in STONE_IDS]
(output/'stones-server.tsv').write_bytes(b'\n'.join(stone_rows)+b'\n')
import hashlib
stone_report={'source_sha256':hashlib.sha256(raw).hexdigest(),'families':len(STONE_FAMILIES),
'grades':list(range(6)),'legacy_plus6_policy':'unchanged; excluded from new stone distribution',
'items':[{'vnum':v,'name':zh[v],'locked':stone_lock_reason(rows[v],E),
'source_applies':rows[v][18:24],'source_values':rows[v][24:30],
'source_wear':rows[v][7]} for v in sorted(STONE_IDS)]}
(output/'stones.json').write_text(json.dumps(stone_report,ensure_ascii=False,indent=2)+'\n')
report['assets']=copied
(output/'items.json').write_text(json.dumps(report,indent=1)+'\n')
return report