29 lines
1.9 KiB
Python
29 lines
1.9 KiB
Python
"""Copy exact Dungeons wave files listed in the Minecraft Wiki Gauntlets sound table.
|
|||
|
|
|
||
|
|
Input is an existing local UEViewer audio export, not a download or a game installation.
|
||
|
|
Original OGG bytes and per-file SHA-256 provenance are retained.
|
||
|
|
"""
|
||
|
|
from pathlib import Path
|
||
|
|
import argparse,hashlib,json,shutil
|
||
|
|
ROOT=Path(__file__).resolve().parents[1]
|
||
|
|
FAMILIES={'hit_light':'HitImpactLight','hit_medium':'HitImpactMedium','hit_kick':'HitImpactKick',
|
||
|
|
'hit_punch':'HitImpactPunch','swing_short':'SwingShort','swing_medium':'SwingMedium','swing_kick':'SwingKick','swing_scream':'SwingScream'}
|
||
|
|
def main():
|
||
|
|
parser=argparse.ArgumentParser();parser.add_argument('export',type=Path);args=parser.parse_args()
|
||
|
|
assets=ROOT/'src/main/resources/defaults/resources/assets/astraweapons'; dest=assets/'sounds/gauntlets';dest.mkdir(parents=True,exist_ok=True)
|
||
|
|
events={};manifest=[]
|
||
|
|
for event,family in FAMILIES.items():
|
||
|
|
files=sorted(args.export.rglob('sfx_item_gauntlets'+family+'-*_soundWave.ogg'))
|
||
|
|
if not files:raise RuntimeError('Missing original sounds: '+family)
|
||
|
|
names=[]
|
||
|
|
for source in files:
|
||
|
|
data=source.read_bytes();assert data[:4]==b'OggS',source
|
||
|
|
target=dest/source.name.lower();shutil.copyfile(source,target)
|
||
|
|
names.append('astraweapons:gauntlets/'+target.stem)
|
||
|
|
manifest.append({'file':target.relative_to(assets).as_posix(),'original':source.name,
|
||
|
|
'sha256':hashlib.sha256(data).hexdigest(),'reference':'https://minecraft.wiki/w/File:'+source.name[0].upper()+source.name[1:]})
|
||
|
|
events['gauntlets.'+event]={'sounds':names,'subtitle':'subtitles.astraweapons.gauntlets.'+event}
|
||
|
|
(assets/'sounds.json').write_text(json.dumps(events,indent=2)+'\n',encoding='utf-8')
|
||
|
|
(ROOT/'src/main/resources/gauntlet-audio-provenance.json').write_text(json.dumps(manifest,indent=2)+'\n',encoding='utf-8')
|
||
|
|
if __name__=='__main__':main()
|