代码初始化
This commit is contained in:
1 parent
c2f5cd98ff
commit
e3efeb74ad
2439 files changed
+305661
-1
No files matched your search
@@ -0,0 +1,50 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import zipfile, os, struct
|
||||
|
||||
root = r'e:\MCStudioDownload\work\3027246179@qq.com\Cpp\AddOn\0aaaa4f2f16c46e8964025a5ab0ecc02'
|
||||
jar = os.path.join(root,'_sa_hanhua_out','sa_essentials-forge-1.20.1-1.0.0.jar')
|
||||
outdir = os.path.join(root,'_sa_medical_textures')
|
||||
os.makedirs(outdir, exist_ok=True)
|
||||
|
||||
ids = ['plaster','splint','alcohol_wipes','blood_bag','blood_bag_empty',
|
||||
'painkiller_pills','stamina_boost_pills','tube']
|
||||
|
||||
z = zipfile.ZipFile(jar)
|
||||
names = set(z.namelist())
|
||||
report = []
|
||||
|
||||
def png_size(data):
|
||||
# parse IHDR
|
||||
if data[:8] != b'\x89PNG\r\n\x1a\n':
|
||||
return None
|
||||
w,h = struct.unpack('>II', data[16:24])
|
||||
return (w,h)
|
||||
|
||||
for i in ids:
|
||||
src = 'assets/sa_combat/textures/item/%s.png' % i
|
||||
if src in names:
|
||||
data = z.read(src)
|
||||
with open(os.path.join(outdir, i+'.png'),'wb') as f:
|
||||
f.write(data)
|
||||
report.append('%s size=%s bytes=%d' % (i, png_size(data), len(data)))
|
||||
else:
|
||||
report.append('%s MISSING' % i)
|
||||
|
||||
# lang files
|
||||
langs = [n for n in names if n.endswith('.json') and '/lang/' in n]
|
||||
report.append('--- lang files ---')
|
||||
report.append('\n'.join(langs))
|
||||
for lf in langs:
|
||||
try:
|
||||
txt = z.read(lf).decode('utf-8', 'ignore')
|
||||
except Exception as e:
|
||||
continue
|
||||
for i in ids:
|
||||
for line in txt.splitlines():
|
||||
low = line.lower()
|
||||
if ('"%s"' % i) in low or ('.%s.' % i) in low or ('.%s"' % i) in low:
|
||||
report.append('[%s] %s' % (os.path.basename(lf), line.strip()))
|
||||
|
||||
with open(os.path.join(root,'_sa_hanhua_out','_tmp','medical_tex.txt'),'w',encoding='utf-8') as f:
|
||||
f.write('\n'.join(report))
|
||||
print('done')
|
||||
Reference in new issue
Block a user