feat: port native AVA2 chest preview and CG235 pickup flows
This commit is contained in:
@@ -111,7 +111,7 @@ def names():
|
||||
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:'属性解锁符'})
|
||||
result.update({50348:'属性锁定符',50349:'属性解锁符',70002:'第三只手'})
|
||||
for month in range(1,13):result[25149+month]='%d月战令票'%month
|
||||
return result
|
||||
|
||||
@@ -122,7 +122,8 @@ def convert(cols,E,imported):
|
||||
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) or (
|
||||
int(c[0]) in (50348,50349) and (t,st)==('ITEM_USE','USE_CHANGE_ATTRIBUTE'))
|
||||
int(c[0]) in (50348,50349) and (t,st)==('ITEM_USE','USE_CHANGE_ATTRIBUTE')) or (
|
||||
int(c[0])==70002 and (t,st)==('ITEM_USE','USE_SPECIAL'))
|
||||
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')
|
||||
@@ -184,6 +185,27 @@ def pack_index(pack_maker):
|
||||
index.setdefault(archived.lower().replace('\\','/'),pack_maker.parent/source)
|
||||
return index
|
||||
|
||||
def pack_ui_subimages(assets,files):
|
||||
"""Resolve original v1 subimage atlases under a private path; never replace the base UI atlas."""
|
||||
root='d:/ymir work/ui/'
|
||||
for sub in list(assets.rglob('*.sub')):
|
||||
text=sub.read_bytes()
|
||||
match=re.search(rb'(?im)^image\s+"([^"\r\n]+)"',text)
|
||||
if not match:continue
|
||||
image=match[1].decode('latin1').lower().replace('\\','/')
|
||||
version=re.search(rb'(?im)^version\s+(\S+)',text)
|
||||
parent=sub.relative_to(assets).as_posix().rsplit('/',1)[0]+'/'
|
||||
source=image if image.startswith('d:/') else (parent if version and version[1]==b'2.0' else root)+image
|
||||
# AVA2 v1 images resolve against the global UI search path.
|
||||
if source not in files:raise ValueError('missing UI subimage atlas %s for %s'%(source,sub))
|
||||
alias='ava2_native/'+source[len(root):] if source.startswith(root) else 'ava2_native/'+source.rsplit('/',1)[-1]
|
||||
target=assets/(root+alias);target.parent.mkdir(parents=True,exist_ok=True)
|
||||
if not target.exists():shutil.copy2(files[source],target)
|
||||
# v1's image is relative to the global UI search path.
|
||||
updated=text[:match.start(1)]+alias.encode('ascii')+text[match.end(1):]
|
||||
updated=re.sub(rb'(?im)^version\s+\S+',b'version 1.0',updated)
|
||||
sub.write_bytes(updated)
|
||||
|
||||
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()
|
||||
@@ -246,6 +268,25 @@ def prepare(ava,proto_reader,locale,output,tool,packer,wrap=lambda text:text):
|
||||
if q not in files:raise SystemExit('missing AVA2 asset %s'%q)
|
||||
target=assets/q;target.parent.mkdir(parents=True,exist_ok=True)
|
||||
if not target.exists():shutil.copy2(files[q],target);copied+=1
|
||||
# AVA2 native chest preview layout, including all referenced images.
|
||||
layout=pack_maker/'uiscript/uiscript/chestdropinfowindow.py'
|
||||
layout_text=layout.read_text().replace('"thinboard_circle"','"thinboard"')
|
||||
layout_target=assets/'uiscript/chestdropinfowindow.py'
|
||||
layout_target.parent.mkdir(parents=True,exist_ok=True)
|
||||
layout_target.write_text(layout_text)
|
||||
chest_prefixes=('d:/ymir work/ui/pattern/border_a_', 'd:/ymir work/ui/game/attr6th7th/',
|
||||
'd:/ymir work/ui/public/public_intro_btn/')
|
||||
for q in files:
|
||||
if q.startswith(chest_prefixes):
|
||||
target=assets/q;target.parent.mkdir(parents=True,exist_ok=True)
|
||||
if not target.exists():shutil.copy2(files[q],target);copied+=1
|
||||
pickup_layout=pack_maker/'uiscript/uiscript/game_option_0_1.py'
|
||||
(assets/'uiscript/game_option_0_1.py').write_bytes(pickup_layout.read_bytes())
|
||||
for q in files:
|
||||
if q.startswith('d:/ymir work/ui/game/gameoption/') or q in ('icon/item/70002.tga','d:/ymir work/ui/game/farm/premium_pickup.tga'):
|
||||
target=assets/q;target.parent.mkdir(parents=True,exist_ok=True)
|
||||
if not target.exists():shutil.copy2(files[q],target);copied+=1
|
||||
pack_ui_subimages(assets,files)
|
||||
(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={}
|
||||
@@ -272,7 +313,8 @@ def prepare(ava,proto_reader,locale,output,tool,packer,wrap=lambda text:text):
|
||||
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张。'
|
||||
if v==70002:desc='激活第三只手30天;重复激活不会消耗道具。拾取分类可在拾取设置中调整。'
|
||||
elif 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'))
|
||||
@@ -287,7 +329,7 @@ def prepare(ava,proto_reader,locale,output,tool,packer,wrap=lambda text:text):
|
||||
'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
|
||||
report['assets']=sum(1 for path in assets.rglob('*') if path.is_file())
|
||||
(output/'items.json').write_text(json.dumps(report,indent=1)+'\n')
|
||||
return report
|
||||
|
||||
|
||||
Reference in New Issue
Block a user