Files

45 lines
2.6 KiB
Python

"""Octo loading screens, HD + 16:9 (owner 2026-11-23).
Narrow: every client loading-screen file that has an Octo/Turtle original gets the Real-ESRGAN x4
version (75%) blended with a smooth bicubic upscale (25%, softens sharpened compression noise),
stored 1024x1024 DXT1 like native. Octo's own versions (Mysteries of Azeroth logo, Turtle continent art)
replace the client's same-name files. Wide: wide.py 16:9 from the same image, 2048x1024 DXT1, new FDIDs.
LoadingScreens rows using these files get Narrow+Wide+Wide169, skin 0, no MainImage; rows 3/4
(continents, Forever 'camelot' art) get Octo's Kalimdor/Eastern Kingdoms."""
import json, os, re, sys
from PIL import Image
from blpw import write_blp
from wide import wide
H = os.path.dirname(os.path.abspath(__file__)); os.chdir(H)
S = sys.argv[1]; WIDE_BASE = int(sys.argv[2])
cmp = {int(l.split()[0]): (l.split()[1], l.split()[2]) for l in open('compare.txt')}
ls = {}
for l in open(os.path.join(S, 'ls.txt')):
d = dict(re.findall(r'(\w+)=(-?\d+)', l))
if 'ID' in d: ls[int(d['ID'])] = {k: int(v) for k, v in d.items()}
def source(fdid):
name, diff = cmp[fdid]
if diff not in ('0.0', 'no-octo'): return 'octo-x4/' + name[:-4] + '.png', 'octo-png/' + name[:-4] + '.png'
return f'x4/{fdid}.png', f'src-png/{fdid}.png'
targets = {f: source(f) for f in cmp}
targets[131839] = ('octo-x4/loadscreeneasternkingdom.png', 'octo-png/loadscreeneasternkingdom.png')
targets[131848] = ('octo-x4/loadscreenkalimdor.png', 'octo-png/loadscreenkalimdor.png')
os.makedirs('out/narrow', exist_ok=True); os.makedirs('out/wide', exist_ok=True)
wide_of, assets = {}, []
for i, (fdid, (x4, src)) in enumerate(sorted(targets.items())):
up = Image.open(x4).convert('RGB'); soft = Image.open(src).convert('RGB').resize(up.size, Image.BICUBIC)
img = Image.blend(soft, up, 0.75)
write_blp(img.resize((1024, 1024), Image.LANCZOS), f'out/narrow/{fdid}.blp')
name = os.path.basename(x4)[:-4]
wid = WIDE_BASE + i; wide_of[fdid] = wid
write_blp(wide(img, name).resize((2048, 1024), Image.LANCZOS), f'out/wide/{wid}.blp')
assets.append(dict(narrow=fdid, wide=wid, source=x4, name=name))
rows = []
for rid, r in sorted(ls.items()):
n = r.get('NarrowScreenFileDataID', 0)
if rid == 4: n = 131839
if rid == 3: n = 131848
if n in wide_of:
rows.append(dict(ID=rid, NarrowScreenFileDataID=n, WideScreenFileDataID=wide_of[n], WideScreen169FileDataID=wide_of[n], LoadingScreenSkinID=0, MainImageFileDataID=0))
json.dump(dict(assets=assets, rows=rows), open('out/plan.json', 'w'), indent=1)
print('narrow', len(targets), 'wide', len(wide_of), 'rows', len(rows))