Files
2026-11-09 22:37:44 +05:00

556 lines
50 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Фэнтези-набор окон (резное дерево, филигрань, знамя, сургуч): SVG → PNG через headless Chrome.
// node tools/ui3/make-ui3.js → assets/ui3/*.png, assets/reference/ui3_style_sheet.png, ui3_mock_bag.png
// Срезы 9-slice каждого файла — в SLICES (внизу); их же потом повторит UiImages.lua.
const fs = require('fs'), path = require('path'), { execFileSync } = require('child_process');
const ROOT = path.join(__dirname, '..', '..');
const OUT = path.join(ROOT, 'assets', 'ui3');
const TMP = path.join(require('os').tmpdir(), 'ui3');
fs.mkdirSync(OUT, { recursive: true });
fs.mkdirSync(TMP, { recursive: true });
const CHROME = ['C:/Program Files/Google/Chrome/Application/chrome.exe', 'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe'].find(p => fs.existsSync(p));
function shot(html, w, h, out) {
const f = path.join(TMP, path.basename(out) + '.html');
fs.writeFileSync(f, `<!doctype html><html><head><meta charset="utf-8"><style>html,body{margin:0;background:transparent;overflow:hidden}</style></head><body>${html}</body></html>`);
execFileSync(CHROME, ['--headless=new', '--disable-gpu', '--hide-scrollbars', '--force-device-scale-factor=1', '--default-background-color=00000000',
`--window-size=${w},${h}`, `--screenshot=${out}`, 'file:///' + f.replace(/\\/g, '/')], { stdio: 'ignore' });
}
const svg = (w, h, body) => `<svg xmlns="http://www.w3.org/2000/svg" width="${w}" height="${h}" viewBox="0 0 ${w} ${h}">${DEFS}${body}</svg>`;
// ---------- общие градиенты и фильтры
const DEFS = `<defs>
<linearGradient id="gold" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#fff4c2"/><stop offset=".22" stop-color="#f2c75c"/><stop offset=".5" stop-color="#b07a26"/>
<stop offset=".72" stop-color="#f6d47c"/><stop offset="1" stop-color="#6e4712"/></linearGradient>
<linearGradient id="goldD" x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stop-color="#ffe9a0"/><stop offset=".45" stop-color="#c8902e"/><stop offset="1" stop-color="#5c3a0e"/></linearGradient>
<linearGradient id="iron" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#a7adb5"/><stop offset=".45" stop-color="#5d636b"/><stop offset="1" stop-color="#2a2d31"/></linearGradient>
<linearGradient id="walnut" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#7a5030"/><stop offset=".5" stop-color="#5a3a20"/><stop offset="1" stop-color="#3a2412"/></linearGradient>
<linearGradient id="walnutL" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#a87447"/><stop offset="1" stop-color="#6b4526"/></linearGradient>
<linearGradient id="crimson" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#c8443a"/><stop offset=".55" stop-color="#8e2320"/><stop offset="1" stop-color="#5a1312"/></linearGradient>
<linearGradient id="emerald" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#5fb35a"/><stop offset=".5" stop-color="#2e6e2c"/><stop offset="1" stop-color="#173d16"/></linearGradient>
<radialGradient id="gemG" cx=".35" cy=".3" r=".75"><stop offset="0" stop-color="#d8ffd0"/><stop offset=".25" stop-color="#4fc36a"/><stop offset=".7" stop-color="#0f6a2c"/><stop offset="1" stop-color="#062b12"/></radialGradient>
<radialGradient id="gemR" cx=".35" cy=".3" r=".75"><stop offset="0" stop-color="#ffd8d0"/><stop offset=".25" stop-color="#e2463c"/><stop offset=".7" stop-color="#7a0f12"/><stop offset="1" stop-color="#2e0506"/></radialGradient>
<radialGradient id="dome" cx=".35" cy=".3" r=".8"><stop offset="0" stop-color="#fff6d0"/><stop offset=".4" stop-color="#d9a849"/><stop offset="1" stop-color="#4d300a"/></radialGradient>
<radialGradient id="domeI" cx=".35" cy=".3" r=".8"><stop offset="0" stop-color="#eef2f6"/><stop offset=".45" stop-color="#7b828b"/><stop offset="1" stop-color="#1c1e21"/></radialGradient>
<radialGradient id="wax" cx=".4" cy=".35" r=".7"><stop offset="0" stop-color="#e2584c"/><stop offset=".6" stop-color="#9a1f1c"/><stop offset="1" stop-color="#4e0a0a"/></radialGradient>
<radialGradient id="vign" cx=".5" cy=".5" r=".7"><stop offset=".55" stop-color="#000" stop-opacity="0"/><stop offset="1" stop-color="#000" stop-opacity=".55"/></radialGradient>
<filter id="grainH" x="0" y="0" width="100%" height="100%">
<feTurbulence type="fractalNoise" baseFrequency="0.006 0.14" numOctaves="4" seed="7"/>
<feColorMatrix type="matrix" values="0 0 0 0 .1 0 0 0 0 .055 0 0 0 0 .02 0 0 0 -2.2 1.25"/>
<feComposite in2="SourceGraphic" operator="in"/></filter>
<filter id="grainV" x="0" y="0" width="100%" height="100%">
<feTurbulence type="fractalNoise" baseFrequency="0.14 0.006" numOctaves="4" seed="11"/>
<feColorMatrix type="matrix" values="0 0 0 0 .1 0 0 0 0 .055 0 0 0 0 .02 0 0 0 -2.2 1.25"/>
<feComposite in2="SourceGraphic" operator="in"/></filter>
<filter id="speck" x="0" y="0" width="100%" height="100%">
<feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="2" seed="3"/>
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1.4 .9"/>
<feComposite in2="SourceGraphic" operator="in"/></filter>
<filter id="bevel" x="-10%" y="-10%" width="120%" height="120%">
<feGaussianBlur in="SourceAlpha" stdDeviation="1.6" result="b"/>
<feSpecularLighting in="b" surfaceScale="3.5" specularConstant=".9" specularExponent="16" lighting-color="#fff" result="s"><feDistantLight azimuth="235" elevation="42"/></feSpecularLighting>
<feComposite in="s" in2="SourceAlpha" operator="in" result="s2"/>
<feComposite in="SourceGraphic" in2="s2" operator="arithmetic" k1="0" k2="1" k3=".7" k4="0"/></filter>
<filter id="bevelSoft" x="-10%" y="-10%" width="120%" height="120%">
<feGaussianBlur in="SourceAlpha" stdDeviation="3" result="b"/>
<feSpecularLighting in="b" surfaceScale="5" specularConstant=".5" specularExponent="28" lighting-color="#ffe9c8" result="s"><feDistantLight azimuth="235" elevation="35"/></feSpecularLighting>
<feComposite in="s" in2="SourceAlpha" operator="in" result="s2"/>
<feComposite in="SourceGraphic" in2="s2" operator="arithmetic" k1="0" k2="1" k3=".22" k4="0"/></filter>
<filter id="drop" x="-20%" y="-20%" width="140%" height="140%"><feDropShadow dx="0" dy="3" stdDeviation="3" flood-color="#000" flood-opacity=".6"/></filter>
<filter id="dropS" x="-20%" y="-20%" width="140%" height="140%"><feDropShadow dx="0" dy="1.5" stdDeviation="1.2" flood-color="#000" flood-opacity=".7"/></filter>
<filter id="inner" x="-5%" y="-5%" width="110%" height="110%">
<feFlood flood-color="#000" flood-opacity=".85"/><feComposite in2="SourceAlpha" operator="out"/>
<feGaussianBlur stdDeviation="7"/><feComposite in2="SourceAlpha" operator="in"/>
<feComposite in2="SourceGraphic" operator="over"/></filter>
<filter id="ragged" x="-5%" y="-5%" width="110%" height="110%">
<feTurbulence type="fractalNoise" baseFrequency="0.04" numOctaves="3" seed="5" result="n"/>
<feDisplacementMap in="SourceGraphic" in2="n" scale="14" xChannelSelector="R" yChannelSelector="G"/></filter>
<filter id="waxEdge" x="-10%" y="-10%" width="120%" height="120%">
<feTurbulence type="fractalNoise" baseFrequency="0.06" numOctaves="2" seed="9" result="n"/>
<feDisplacementMap in="SourceGraphic" in2="n" scale="12" xChannelSelector="R" yChannelSelector="G"/></filter>
<filter id="stains" x="0" y="0" width="100%" height="100%">
<feTurbulence type="fractalNoise" baseFrequency="0.018" numOctaves="4" seed="21"/>
<feColorMatrix type="matrix" values="0 0 0 0 .42 0 0 0 0 .27 0 0 0 0 .1 0 0 0 -3 1.55"/>
<feComposite in2="SourceGraphic" operator="in"/></filter>
</defs>`;
// ---------- детали
const rivet = (x, y, r = 5, iron = false) => `<g filter="url(#dropS)"><circle cx="${x}" cy="${y}" r="${r}" fill="url(#${iron ? 'domeI' : 'dome'})" stroke="#2a1606" stroke-width="1"/></g>`;
// лист с прожилкой: (x,y) — основание, угол a (градусы), длина l
const leaf = (x, y, a, l = 22, fill = 'url(#goldD)') => `<g transform="translate(${x} ${y}) rotate(${a})">
<path d="M0 0 C ${l * 0.3} ${-l * 0.32}, ${l * 0.75} ${-l * 0.3}, ${l} 0 C ${l * 0.75} ${l * 0.3}, ${l * 0.3} ${l * 0.32}, 0 0 Z" fill="${fill}" stroke="#3a2306" stroke-width="1.2"/>
<path d="M2 0 L ${l * 0.9} 0" stroke="#5c3a0e" stroke-width="1" opacity=".8"/></g>`;
// кельтский узел-трикветр вокруг камня: каждая дуга — тёмная подложка и золото поверх (эффект плетения)
function triquetra(cx, cy, R, gem = 'gemG') {
const arcs = [0, 120, 240].map(a => {
const r = (a - 90) * Math.PI / 180;
const px = cx + Math.cos(r) * R * 0.55, py = cy + Math.sin(r) * R * 0.55;
return `<circle cx="${px}" cy="${py}" r="${R * 0.62}" fill="none"/>`;
});
const ring = `<circle cx="${cx}" cy="${cy}" r="${R * 0.98}" fill="none"/>`;
const all = arcs.join('') + ring;
return `<g filter="url(#drop)">
<g stroke="#2a1606" stroke-width="${R * 0.24}">${all}</g>
<g stroke="url(#gold)" stroke-width="${R * 0.14}" filter="url(#bevel)">${all}</g>
<circle cx="${cx}" cy="${cy}" r="${R * 0.36}" fill="url(#gold)" stroke="#2a1606" stroke-width="1.5"/>
<circle cx="${cx}" cy="${cy}" r="${R * 0.27}" fill="url(#${gem})" stroke="#1a0c02" stroke-width="1"/>
<ellipse cx="${cx - R * 0.09}" cy="${cy - R * 0.11}" rx="${R * 0.08}" ry="${R * 0.05}" fill="#fff" opacity=".8"/></g>`;
}
// филигранный уголок (левый верхний, область size×size): кованая скоба с завитками, листья и узел
function filigreeCorner(size) {
const s = size;
return `<g>
<path d="M10 ${s * 0.92} L10 22 Q10 10 22 10 L${s * 0.92} 10" fill="none" stroke="#2a1606" stroke-width="14" stroke-linecap="round"/>
<path d="M10 ${s * 0.92} L10 22 Q10 10 22 10 L${s * 0.92} 10" fill="none" stroke="url(#gold)" stroke-width="8" stroke-linecap="round" filter="url(#bevel)"/>
<path d="M${s * 0.92} 10 q 14 2 12 16 q -2 10 -12 6" fill="none" stroke="url(#gold)" stroke-width="4" stroke-linecap="round"/>
<path d="M10 ${s * 0.92} q 2 14 16 12 q 10 -2 6 -12" fill="none" stroke="url(#gold)" stroke-width="4" stroke-linecap="round"/>
<path d="M34 ${s * 0.78} C 30 ${s * 0.55}, 30 ${s * 0.42}, 46 ${s * 0.36}" fill="none" stroke="#c8902e" stroke-width="3"/>
<path d="M${s * 0.78} 34 C ${s * 0.55} 30, ${s * 0.42} 30, ${s * 0.36} 46" fill="none" stroke="#c8902e" stroke-width="3"/>
${leaf(34, s * 0.7, 200, 20)}${leaf(36, s * 0.56, -20, 18)}${leaf(s * 0.7, 34, -70, 20)}${leaf(s * 0.56, 36, 110, 18)}
${triquetra(s * 0.36, s * 0.36, s * 0.24)}
${rivet(10, s * 0.62, 4.5)}${rivet(s * 0.62, 10, 4.5)}
</g>`;
}
const mirror = (inner, w, h, sx, sy) => `<g transform="translate(${sx < 0 ? w : 0} ${sy < 0 ? h : 0}) scale(${sx} ${sy})">${inner}</g>`;
// ---------- 1) рама окна 512×512, срез 140
function frameWindow() {
const W = 512, H = 512;
const corner = filigreeCorner(140);
return svg(W, H, `
<rect x="6" y="6" width="500" height="500" rx="26" fill="#120a05" filter="url(#drop)"/>
<rect x="8" y="8" width="496" height="496" rx="24" fill="url(#walnut)"/>
<rect x="8" y="8" width="496" height="496" rx="24" fill="#000" filter="url(#grainH)" opacity=".85"/>
<!-- резная рейка: светлое дерево с двумя желобками и золотой бусиной -->
<path fill-rule="evenodd" fill="url(#walnutL)" filter="url(#bevelSoft)" d="M22 22 h468 v468 h-468 Z M62 62 v388 h388 v-388 Z"/>
<path fill-rule="evenodd" fill="#000" opacity=".55" filter="url(#grainH)" d="M22 22 h468 v468 h-468 Z M62 62 v388 h388 v-388 Z"/>
<rect x="30" y="30" width="452" height="452" rx="12" fill="none" stroke="#1e1108" stroke-width="2.5" opacity=".85"/>
<rect x="31.5" y="31.5" width="449" height="449" rx="11" fill="none" stroke="#c99a5e" stroke-width="1" opacity=".5"/>
<rect x="42" y="42" width="428" height="428" rx="8" fill="none" stroke="#2a1606" stroke-width="7"/>
<rect x="42" y="42" width="428" height="428" rx="8" fill="none" stroke="url(#gold)" stroke-width="3.5" filter="url(#bevel)"/>
<rect x="54" y="54" width="404" height="404" rx="6" fill="none" stroke="#1e1108" stroke-width="2.5" opacity=".85"/>
<!-- внешний золотой обод -->
<rect x="12" y="12" width="488" height="488" rx="22" fill="none" stroke="#2a1606" stroke-width="8"/>
<rect x="12" y="12" width="488" height="488" rx="22" fill="none" stroke="url(#gold)" stroke-width="4.5" filter="url(#bevel)"/>
<!-- середина: тёмная кожа с виньеткой и тенью от рамы -->
<rect x="64" y="64" width="384" height="384" rx="4" fill="#24170d" filter="url(#inner)"/>
<rect x="64" y="64" width="384" height="384" rx="4" fill="#000" opacity=".5" filter="url(#speck)"/>
<rect x="64" y="64" width="384" height="384" rx="4" fill="url(#vign)"/>
<rect x="64" y="64" width="384" height="384" rx="4" fill="none" stroke="url(#gold)" stroke-width="2"/>
${corner}${mirror(corner, W, H, -1, 1)}${mirror(corner, W, H, 1, -1)}${mirror(corner, W, H, -1, -1)}
`);
}
// ---------- 2) знамя-заголовок 640×200 (срез по бокам 210): древко с навершиями, ткань с вышивкой, кисти
function banner() {
const W = 640, H = 200;
const tassel = x => `<g filter="url(#drop)">
<path d="M${x} 150 v16" stroke="url(#gold)" stroke-width="3"/>
<circle cx="${x}" cy="168" r="6" fill="url(#dome)" stroke="#3a2306"/>
<path d="M${x - 8} 172 Q${x} 168 ${x + 8} 172 L${x + 10} 196 L${x - 10} 196 Z" fill="url(#gold)" stroke="#3a2306" stroke-width="1.2"/>
${[-6, -3, 0, 3, 6].map(d => `<path d="M${x + d} 176 L${x + d * 1.4} 195" stroke="#7a4f14" stroke-width="1"/>`).join('')}</g>`;
return svg(W, H, `
<!-- ткань: прямоугольник, по бокам опущенные «хвосты» -->
<g filter="url(#drop)">
<path d="M70 34 H570 V136 Q570 140 566 141 L600 150 L592 120 L600 92 L570 92 Z" fill="#5a1312" opacity="0"/>
<path d="M44 30 H596 V128 L572 150 L548 128 H92 L68 150 L44 128 Z" fill="url(#crimson)" stroke="#2a0606" stroke-width="3"/>
</g>
<path d="M44 30 H596 V128 L572 150 L548 128 H92 L68 150 L44 128 Z" fill="#000" opacity=".25" filter="url(#speck)"/>
<!-- складки ткани -->
<path d="M44 30 H596 V60 H44 Z" fill="#fff" opacity=".07"/>
<!-- вышитая золотая кайма -->
<path d="M56 42 H584 V122 L572 134 L560 122 H80 L68 134 L56 122 Z" fill="none" stroke="#2a0606" stroke-width="6"/>
<path d="M56 42 H584 V122 L572 134 L560 122 H80 L68 134 L56 122 Z" fill="none" stroke="url(#gold)" stroke-width="3" filter="url(#bevel)"/>
<path d="M64 50 H576 V116 H64 Z" fill="none" stroke="#e8b85a" stroke-width="1" stroke-dasharray="2 4" opacity=".7"/>
${leaf(84, 80, 30, 16)}${leaf(84, 80, -30, 16)}${leaf(556, 80, 150, 16)}${leaf(556, 80, 210, 16)}
<circle cx="84" cy="80" r="5" fill="url(#gemR)" stroke="#2a0606"/><circle cx="556" cy="80" r="5" fill="url(#gemR)" stroke="#2a0606"/>
${tassel(68)}${tassel(572)}
<!-- древко -->
<g filter="url(#drop)">
<rect x="16" y="18" width="608" height="16" rx="8" fill="url(#walnutL)" stroke="#1e1108" stroke-width="2"/>
<rect x="16" y="18" width="608" height="16" rx="8" fill="#000" opacity=".5" filter="url(#grainH)"/>
<rect x="22" y="21" width="596" height="3" rx="1.5" fill="#fff" opacity=".18"/>
<path d="M18 26 L2 26 L-2 18 L-2 34 Z" fill="url(#gold)"/>
<circle cx="16" cy="26" r="11" fill="url(#dome)" stroke="#3a2306" stroke-width="1.5"/>
<circle cx="624" cy="26" r="11" fill="url(#dome)" stroke="#3a2306" stroke-width="1.5"/>
<path d="M5 26 L-6 26" stroke="url(#gold)" stroke-width="6" stroke-linecap="round"/>
</g>
`);
}
// ---------- 3) кнопки 256×96 (срез 44): резная табличка со скошенными углами
function plaque(kind, pressed) {
const W = 256, H = 96;
const fills = { wood: 'url(#walnutL)', green: 'url(#emerald)', red: 'url(#crimson)', gold: 'url(#gold)' };
const shape = 'M24 6 H232 L250 24 V72 L232 90 H24 L6 72 V24 Z';
const inner = 'M28 16 H228 L240 28 V68 L228 80 H28 L16 68 V28 Z';
const dy = pressed ? 2 : 0;
const grain = kind === 'wood' ? `<path d="${shape}" fill="#000" opacity=".55" filter="url(#grainH)"/>` : `<path d="${shape}" fill="#000" opacity=".22" filter="url(#speck)"/>`;
const stitch = kind === 'red' ? `<path d="${inner}" fill="none" stroke="#f0c070" stroke-width="1.6" stroke-dasharray="5 4" opacity=".85"/>` : '';
const caps = [[24, 6, 0], [232, 6, 90], [232, 90, 180], [24, 90, 270]].map(([x, y, a]) =>
`<g transform="translate(${x} ${y}) rotate(${a})"><path d="M-2 0 L14 0 L0 14 Z" fill="url(#gold)" stroke="#2a1606" stroke-width="1"/></g>`).join('');
return svg(W, H, `<g transform="translate(0 ${dy})">
<path d="${shape}" fill="#140a04" transform="translate(0 ${pressed ? 0 : 3})" opacity=".8"/>
<path d="${shape}" fill="${fills[kind]}" stroke="#1a0d05" stroke-width="2.5" ${pressed ? '' : 'filter="url(#bevelSoft)"'}/>
${grain}
${pressed ? `<path d="${shape}" fill="#000" opacity=".28"/>` : `<path d="M24 6 H232 L246 20 H10 Z" fill="#fff" opacity=".16"/>`}
<path d="${inner}" fill="none" stroke="#1a0d05" stroke-width="2" opacity=".7"/>
<path d="${inner}" fill="none" stroke="${kind === 'gold' ? '#fff3c0' : 'url(#gold)'}" stroke-width="1.2" transform="translate(0 1)" opacity=".9"/>
${stitch}
<path d="${shape}" fill="none" stroke="#2a1606" stroke-width="6"/>
<path d="${shape}" fill="none" stroke="url(#gold)" stroke-width="3" filter="url(#bevel)"/>
${caps}
${rivet(14, 48, 4)}${rivet(242, 48, 4)}
</g>`);
}
// ---------- 4) вкладки 256×96 (срез 44): кожа со строчкой / пергамент с золотом
function tab(active) {
const W = 256, H = 96;
const shape = 'M8 96 V30 Q8 8 30 8 H226 Q248 8 248 30 V96 Z';
return svg(W, H, `
<path d="${shape}" fill="${active ? '#e9d3a0' : '#5b3a22'}" stroke="#1a0d05" stroke-width="2.5" filter="url(#bevelSoft)"/>
${active ? `<path d="${shape}" fill="#8a5a24" opacity=".6" filter="url(#stains)"/>` : `<path d="${shape}" fill="#000" opacity=".5" filter="url(#grainH)"/>`}
<path d="M20 96 V34 Q20 20 34 20 H222 Q236 20 236 34 V96" fill="none" stroke="${active ? '#7a4f14' : '#d9a85c'}" stroke-width="1.6" stroke-dasharray="5 4" opacity=".85"/>
<path d="${shape}" fill="none" stroke="#2a1606" stroke-width="6"/>
<path d="${shape}" fill="none" stroke="${active ? 'url(#gold)' : '#8a5a2c'}" stroke-width="3"/>
${active ? `${leaf(128, 14, 160, 14)}${leaf(128, 14, 20, 14)}<circle cx="128" cy="14" r="4.5" fill="url(#gemR)" stroke="#2a0606"/>` : ''}
`);
}
// ---------- 5) ячейка 192×192 (срез 52): утопленное гнездо в резном дереве, кованые уголки
function slot() {
const W = 192;
const br = `<g filter="url(#dropS)"><path d="M8 40 V14 Q8 8 14 8 H40 L40 16 H16 V40 Z" fill="url(#iron)" stroke="#111" stroke-width="1.5"/>${rivet(20, 20, 3.5, true)}</g>`;
return svg(W, W, `
<rect x="4" y="4" width="184" height="184" rx="18" fill="url(#walnut)" stroke="#120a05" stroke-width="3" filter="url(#bevelSoft)"/>
<rect x="4" y="4" width="184" height="184" rx="18" fill="#000" opacity=".5" filter="url(#grainV)"/>
<rect x="18" y="18" width="156" height="156" rx="10" fill="#160d07" filter="url(#inner)"/>
<rect x="18" y="18" width="156" height="156" rx="10" fill="#000" opacity=".4" filter="url(#speck)"/>
<rect x="18" y="18" width="156" height="156" rx="10" fill="none" stroke="#c8902e" stroke-width="1.5" opacity=".7"/>
${br}${mirror(br, W, W, -1, 1)}${mirror(br, W, W, 1, -1)}${mirror(br, W, W, -1, -1)}
`);
}
// ---------- 6) разделитель 512×48: золотая лоза с листьями и узлом в центре
function divider() {
const W = 512, H = 48;
let leaves = '';
for (let i = 0; i < 6; i++) {
const x = 60 + i * 30, a = i % 2 ? 210 : 150;
leaves += leaf(256 - 50 - i * 30, 24 + (i % 2 ? 4 : -4), i % 2 ? 160 : 200, 14 - i);
leaves += leaf(256 + 50 + i * 30, 24 + (i % 2 ? 4 : -4), i % 2 ? 20 : -20, 14 - i);
}
return svg(W, H, `
<defs><linearGradient id="fade" x1="0" x2="1"><stop offset="0" stop-color="#fff" stop-opacity="0"/><stop offset=".3" stop-color="#fff"/><stop offset=".7" stop-color="#fff"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></linearGradient>
<mask id="fm"><rect width="${W}" height="${H}" fill="url(#fade)"/></mask></defs>
<g mask="url(#fm)" filter="url(#dropS)">
<path d="M10 24 C 90 14, 160 34, 230 24 M282 24 C 352 14, 422 34, 502 24" fill="none" stroke="#2a1606" stroke-width="5"/>
<path d="M10 24 C 90 14, 160 34, 230 24 M282 24 C 352 14, 422 34, 502 24" fill="none" stroke="url(#gold)" stroke-width="2.5"/>
${leaves}
</g>
${triquetra(256, 24, 20, 'gemR')}
`);
}
// ---------- 7) сургучная печать-крестик 160×160
function seal() {
return svg(160, 160, `
<g filter="url(#drop)"><circle cx="80" cy="82" r="62" fill="url(#wax)" filter="url(#waxEdge)"/></g>
<circle cx="80" cy="80" r="46" fill="none" stroke="#4e0a0a" stroke-width="5" opacity=".8"/>
<circle cx="80" cy="80" r="46" fill="none" stroke="#e86a5c" stroke-width="1.5" transform="translate(-1 -1)" opacity=".7"/>
<g filter="url(#bevel)"><path d="M58 58 L102 102 M102 58 L58 102" stroke="#7a1414" stroke-width="12" stroke-linecap="round"/></g>
<path d="M58 58 L102 102 M102 58 L58 102" stroke="#ff9a8a" stroke-width="2" stroke-linecap="round" transform="translate(-2 -2)" opacity=".55"/>
${[0, 45, 90, 135, 180, 225, 270, 315].map(a => { const r = a * Math.PI / 180; return `<circle cx="${80 + Math.cos(r) * 37}" cy="${80 + Math.sin(r) * 37}" r="2.4" fill="#e86a5c" opacity=".75"/>`; }).join('')}
<ellipse cx="60" cy="50" rx="16" ry="8" fill="#fff" opacity=".22" transform="rotate(-30 60 50)"/>
`);
}
// ---------- 8) кованая оправа полосы 384×64 (срез 52) и заливка 384×40 (срез 20)
function barFrame() {
return svg(384, 64, `
<rect x="4" y="6" width="376" height="52" rx="12" fill="url(#iron)" stroke="#0e0f11" stroke-width="2.5" filter="url(#bevel)"/>
<rect x="4" y="6" width="376" height="52" rx="12" fill="#000" opacity=".25" filter="url(#speck)"/>
<rect x="22" y="18" width="340" height="28" rx="8" fill="#0b0604" filter="url(#inner)"/>
<rect x="22" y="18" width="340" height="28" rx="8" fill="none" stroke="url(#gold)" stroke-width="2"/>
${rivet(13, 32, 5, true)}${rivet(371, 32, 5, true)}
<path d="M6 32 h8 M370 32 h8" stroke="#000" opacity=".3"/>
`);
}
function barFill() {
return svg(384, 40, `
<defs><linearGradient id="liq" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#ffffff"/><stop offset=".35" stop-color="#f2f2f2"/><stop offset=".6" stop-color="#bdbdbd"/><stop offset="1" stop-color="#8a8a8a"/></linearGradient></defs>
<rect x="2" y="2" width="380" height="36" rx="10" fill="url(#liq)"/>
<rect x="10" y="6" width="364" height="7" rx="3.5" fill="#fff" opacity=".7"/>
<rect x="2" y="2" width="380" height="36" rx="10" fill="#000" opacity=".12" filter="url(#speck)"/>
`);
}
// ---------- 9) медальон под иконку 160×160: резное кольцо с золотым ободом и листьями
function medallion() {
let leaves = '';
for (let i = 0; i < 12; i++) {
const a = i * 30, r = a * Math.PI / 180;
leaves += leaf(80 + Math.cos(r) * 62, 80 + Math.sin(r) * 62, a + 100, 14);
}
return svg(160, 160, `
<g filter="url(#drop)"><circle cx="80" cy="80" r="74" fill="url(#walnut)" stroke="#120a05" stroke-width="3"/></g>
<circle cx="80" cy="80" r="74" fill="#000" opacity=".5" filter="url(#grainV)"/>
${leaves}
<circle cx="80" cy="80" r="54" fill="none" stroke="#2a1606" stroke-width="9"/>
<circle cx="80" cy="80" r="54" fill="none" stroke="url(#gold)" stroke-width="5" filter="url(#bevel)"/>
<circle cx="80" cy="80" r="49" fill="#1a0f08" filter="url(#inner)"/>
`);
}
// ---------- 10) обожжённый пергамент 512×512 (срез 110)
function parchment() {
return svg(512, 512, `
<defs><radialGradient id="burn" cx=".5" cy=".5" r=".72"><stop offset=".62" stop-color="#5a3010" stop-opacity="0"/><stop offset=".86" stop-color="#5a3010" stop-opacity=".55"/><stop offset="1" stop-color="#2a1406" stop-opacity=".95"/></radialGradient></defs>
<g filter="url(#ragged)">
<rect x="16" y="16" width="480" height="480" rx="10" fill="#ead7a6"/>
<rect x="16" y="16" width="480" height="480" rx="10" fill="#000" filter="url(#stains)" opacity=".7"/>
<rect x="16" y="16" width="480" height="480" rx="10" fill="url(#burn)"/>
<rect x="16" y="16" width="480" height="480" rx="10" fill="none" stroke="#2a1406" stroke-width="5"/>
</g>
<rect x="16" y="16" width="480" height="480" fill="#000" opacity=".12" filter="url(#speck)"/>
`);
}
// ---------- главный экран
// 11) малая резная рамка 256×256 (срез 64): панели HUD, таблица игроков, нижняя панель, тосты
function frameSmall() {
const W = 256;
const c = `<g>${triquetra(26, 26, 17)}${leaf(46, 18, 0, 14)}${leaf(18, 46, 90, 14)}</g>`;
return svg(W, W, `
<rect x="4" y="4" width="248" height="248" rx="16" fill="#120a05" filter="url(#drop)"/>
<rect x="5" y="5" width="246" height="246" rx="15" fill="url(#walnut)"/>
<rect x="5" y="5" width="246" height="246" rx="15" fill="#000" filter="url(#grainH)" opacity=".85"/>
<path fill-rule="evenodd" fill="url(#walnutL)" filter="url(#bevelSoft)" d="M14 14 h228 v228 h-228 Z M34 34 v188 h188 v-188 Z"/>
<path fill-rule="evenodd" fill="#000" opacity=".5" filter="url(#grainH)" d="M14 14 h228 v228 h-228 Z M34 34 v188 h188 v-188 Z"/>
<rect x="24" y="24" width="208" height="208" rx="5" fill="none" stroke="#2a1606" stroke-width="5"/>
<rect x="24" y="24" width="208" height="208" rx="5" fill="none" stroke="url(#gold)" stroke-width="2.4" filter="url(#bevel)"/>
<rect x="8" y="8" width="240" height="240" rx="13" fill="none" stroke="#2a1606" stroke-width="5"/>
<rect x="8" y="8" width="240" height="240" rx="13" fill="none" stroke="url(#gold)" stroke-width="2.8" filter="url(#bevel)"/>
<rect x="36" y="36" width="184" height="184" rx="3" fill="#24170d" filter="url(#inner)"/>
<rect x="36" y="36" width="184" height="184" rx="3" fill="#000" opacity=".45" filter="url(#speck)"/>
${c}${mirror(c, W, W, -1, 1)}${mirror(c, W, W, 1, -1)}${mirror(c, W, W, -1, -1)}
`);
}
// 12) золотой ромб-медальон уровня 128×128
function diamond() {
return svg(128, 128, `
<g filter="url(#drop)"><path d="M64 4 L124 64 L64 124 L4 64 Z" fill="url(#gold)" stroke="#2a1606" stroke-width="3" filter="url(#bevel)"/></g>
<path d="M64 18 L110 64 L64 110 L18 64 Z" fill="none" stroke="#2a1606" stroke-width="3"/>
<path d="M64 24 L104 64 L64 104 L24 64 Z" fill="url(#walnut)" stroke="#f6d47c" stroke-width="1.5" filter="url(#inner)"/>
${leaf(64, 10, 90, 10)}${leaf(64, 118, 270, 10)}${leaf(10, 64, 0, 10)}${leaf(118, 64, 180, 10)}
${rivet(64, 8, 4)}${rivet(64, 120, 4)}${rivet(8, 64, 4)}${rivet(120, 64, 4)}
`);
}
// 13) табличка-«фишка» 160×56 (срез 26): деревянная, с золотым ободком
function chip() {
const shape = 'M14 4 H146 Q156 4 156 14 V42 Q156 52 146 52 H14 Q4 52 4 42 V14 Q4 4 14 4 Z';
return svg(160, 56, `
<path d="${shape}" fill="#120a05" transform="translate(0 2)" opacity=".8"/>
<path d="${shape}" fill="url(#walnut)" stroke="#1a0d05" stroke-width="2"/>
<path d="${shape}" fill="#000" opacity=".5" filter="url(#grainH)"/>
<path d="M10 10 H150 V46 H10 Z" fill="#1a0f08" opacity=".55" filter="url(#inner)"/>
<path d="${shape}" fill="none" stroke="url(#gold)" stroke-width="2.2" filter="url(#bevel)"/>
`);
}
// 14) плашка меню 192×192: резной квадрат с медальоном-гнездом под иконку вверху и полем подписи внизу
function menuBtn(pressed) {
const W = 192;
const c = `<g>${rivet(20, 20, 6)}</g>`;
return svg(W, W, `<g transform="translate(0 ${pressed ? 3 : 0})">
<rect x="6" y="${pressed ? 6 : 9}" width="180" height="180" rx="22" fill="#0e0703" opacity=".85"/>
<rect x="6" y="6" width="180" height="176" rx="22" fill="url(#walnutL)" stroke="#1a0d05" stroke-width="3" ${pressed ? '' : 'filter="url(#bevelSoft)"'}/>
<rect x="6" y="6" width="180" height="176" rx="22" fill="#000" opacity=".5" filter="url(#grainV)"/>
${pressed ? '<rect x="6" y="6" width="180" height="176" rx="22" fill="#000" opacity=".3"/>' : ''}
<rect x="14" y="14" width="164" height="160" rx="16" fill="none" stroke="#2a1606" stroke-width="5"/>
<rect x="14" y="14" width="164" height="160" rx="16" fill="none" stroke="url(#gold)" stroke-width="2.5" filter="url(#bevel)"/>
<circle cx="96" cy="78" r="54" fill="#2a1606"/>
<circle cx="96" cy="78" r="51" fill="none" stroke="url(#gold)" stroke-width="5" filter="url(#bevel)"/>
<circle cx="96" cy="78" r="46" fill="#1d120a" filter="url(#inner)"/>
<rect x="28" y="138" width="136" height="30" rx="8" fill="#1a0f08" opacity=".6" filter="url(#inner)"/>
${leaf(42, 78, 180, 16)}${leaf(150, 78, 0, 16)}
${c}${mirror(c, W, W, -1, 1)}
</g>`);
}
// 15) маленький сургучный кружок 64×64 (клавиша) и печать-бейдж без знака 64×64
function waxDot(color) {
const g = color === 'gold' ? 'url(#dome)' : 'url(#wax)';
return svg(64, 64, `
<g filter="url(#dropS)"><circle cx="32" cy="33" r="25" fill="${g}" filter="url(#waxEdge)"/></g>
<circle cx="32" cy="32" r="17" fill="none" stroke="${color === 'gold' ? '#5c3a0e' : '#4e0a0a'}" stroke-width="2.5" opacity=".8"/>
<ellipse cx="24" cy="22" rx="7" ry="4" fill="#fff" opacity=".25" transform="rotate(-30 24 22)"/>
`);
}
// 16) валик свитка 512×56 (срез 60): деревянный цилиндр с золотыми навершиями
function roller() {
return svg(512, 56, `
<defs><linearGradient id="cyl" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#5a3a20"/><stop offset=".3" stop-color="#b98450"/><stop offset=".55" stop-color="#7a5030"/><stop offset="1" stop-color="#2e1d10"/></linearGradient></defs>
<g filter="url(#drop)">
<rect x="30" y="14" width="452" height="28" rx="14" fill="url(#cyl)" stroke="#1a0d05" stroke-width="2"/>
<rect x="30" y="14" width="452" height="28" rx="14" fill="#000" opacity=".35" filter="url(#grainH)"/>
<rect x="8" y="8" width="30" height="40" rx="8" fill="url(#gold)" stroke="#2a1606" stroke-width="2" filter="url(#bevel)"/>
<rect x="474" y="8" width="30" height="40" rx="8" fill="url(#gold)" stroke="#2a1606" stroke-width="2" filter="url(#bevel)"/>
<circle cx="10" cy="28" r="8" fill="url(#dome)" stroke="#2a1606"/><circle cx="502" cy="28" r="8" fill="url(#dome)" stroke="#2a1606"/>
</g>
`);
}
// ---------- сборка
const ASSETS = {
frame_window: [512, 512, frameWindow(), 140],
banner: [640, 200, banner(), 210],
btn_wood: [256, 96, plaque('wood', false), 44], btn_wood_down: [256, 96, plaque('wood', true), 44],
btn_green: [256, 96, plaque('green', false), 44], btn_green_down: [256, 96, plaque('green', true), 44],
btn_red: [256, 96, plaque('red', false), 44], btn_red_down: [256, 96, plaque('red', true), 44],
btn_gold: [256, 96, plaque('gold', false), 44], btn_gold_down: [256, 96, plaque('gold', true), 44],
tab_on: [256, 96, tab(true), 44], tab_off: [256, 96, tab(false), 44],
slot: [192, 192, slot(), 52], divider: [512, 48, divider(), 0], seal: [160, 160, seal(), 0],
bar_frame: [384, 64, barFrame(), 52], bar_fill: [384, 40, barFill(), 20], medallion: [160, 160, medallion(), 0],
parchment: [512, 512, parchment(), 110],
frame_small: [256, 256, frameSmall(), 64], diamond: [128, 128, diamond(), 0], chip: [160, 56, chip(), 26],
menu_btn: [192, 192, menuBtn(false), 0], menu_btn_down: [192, 192, menuBtn(true), 0],
wax_dot: [64, 64, waxDot('red'), 0], gold_dot: [64, 64, waxDot('gold'), 0], roller: [512, 56, roller(), 60],
};
const only = process.argv[2];
for (const [name, [w, h, s]] of Object.entries(ASSETS)) {
if (only && only !== name && only !== 'sheet') continue;
if (only === 'sheet') break;
shot(s, w, h, path.join(OUT, name + '.png'));
}
fs.writeFileSync(path.join(__dirname, 'slices.json'), JSON.stringify(Object.fromEntries(Object.entries(ASSETS).map(([n, [w, h, , sl]]) => [n, { w, h, slice: sl }])), null, 1));
// ---------- лист стиля и макет «Сумки» (HTML с border-image = то же, что 9-slice в Roblox)
const u = n => 'file:///' + path.join(OUT, n + '.png').replace(/\\/g, '/');
const ic = n => 'file:///' + path.join(ROOT, 'assets', 'icons', n + '.png').replace(/\\/g, '/');
const nine = (n, slice, scale = 1) => `border-style:solid;border-width:${slice * scale}px;border-image:url(${u(n)}) ${slice} fill stretch;`;
const FONT = `font-family:'Merriweather','Georgia','Times New Roman',serif;font-weight:900`;
const cell = (label, inner) => `<div style="display:flex;flex-direction:column;align-items:center;gap:6px;margin:10px"><div>${inner}</div><div style="color:#c9b288;font:13px Georgia">${label}</div></div>`;
const btnH = (n, t, w = 200, color = '#fff2cc') => `<div style="box-sizing:border-box;width:${w}px;height:64px;${nine(n, 44, 0.66)}display:flex;align-items:center;justify-content:center;color:${color};${FONT};font-size:19px;text-shadow:0 2px 2px #000">${t}</div>`;
const sheet = `<div style="width:1400px;padding:20px;box-sizing:border-box;background:#1b1410 radial-gradient(circle at 50% 30%,#3a2a1e,#120c08);display:flex;flex-wrap:wrap;align-items:flex-end">
${cell('рама окна (9-slice)', `<div style="box-sizing:border-box;width:420px;height:300px;${nine('frame_window', 140, 0.7)}"></div>`)}
${cell('знамя-заголовок', `<div style="box-sizing:border-box;width:440px;height:138px;${nine('banner', 210, 0.69)}border-top-width:138px;border-bottom-width:0;border-image-slice:200 210 0 210 fill;position:relative"><div style="position:absolute;left:0;right:0;top:-110px;text-align:center;color:#ffe08a;${FONT};font-size:30px;text-shadow:0 2px 3px #000">Сумка</div></div>`)}
${cell('кнопки: дерево, зелёная, багровая, золотая', `<div style="display:grid;grid-template-columns:repeat(2,200px);gap:10px">${btnH('btn_wood', 'Надеть')}${btnH('btn_green', 'Продать всё')}${btnH('btn_red', 'Отмена')}${btnH('btn_gold', 'Купить', 200, '#3a2306')}</div>`)}
${cell('нажатая', btnH('btn_green_down', 'Продать всё'))}
${cell('вкладки', `<div style="display:flex;gap:8px">${['tab_on', 'tab_off'].map((t, i) => `<div style="box-sizing:border-box;width:180px;height:60px;${nine(t, 44, 0.6)}border-bottom-width:0;display:flex;align-items:center;justify-content:center;color:${i ? '#f0dcb0' : '#3a2306'};${FONT};font-size:18px">${i ? 'Коллекция' : 'Улов'}</div>`).join('')}</div>`)}
${cell('ячейка', `<div style="box-sizing:border-box;width:120px;height:140px;${nine('slot', 52, 0.6)}display:flex;align-items:center;justify-content:center"><img src="${ic('fish')}" width="70"></div>`)}
${cell('медальон', `<div style="width:110px;height:110px;background:url(${u('medallion')}) center/contain no-repeat;display:flex;align-items:center;justify-content:center"><img src="${ic('bag')}" width="56"></div>`)}
${cell('печать-крестик', `<img src="${u('seal')}" width="90">`)}
${cell('полоса прогресса', `<div style="position:relative;width:340px;height:52px"><div style="position:absolute;inset:0;box-sizing:border-box;${nine('bar_frame', 52, 0.6)}"></div><div style="position:absolute;left:14px;top:12px;width:200px;height:28px;${nine('bar_fill', 20, 0.6)}box-sizing:border-box;filter:sepia(1) saturate(4) hue-rotate(60deg) brightness(.85)"></div></div>`)}
${cell('разделитель', `<img src="${u('divider')}" width="420">`)}
${cell('пергамент', `<div style="box-sizing:border-box;width:300px;height:160px;${nine('parchment', 110, 0.5)}display:flex;align-items:center;justify-content:center;color:#3a2306;${FONT};font-size:18px">Можно выручить ≈ 182</div>`)}
</div>`;
// макет окна «Сумка» 900×620, на фоне игры
const fishes = [['fish', 'Щука', '2.99 кг', '37', '#5aa0ff'], ['fish', 'Линь', '2.62 кг', '33', '#6fdc6f'], ['fish', 'Лещ', '2.25 кг', '30', '#6fdc6f'],
['fish', 'Окунь', '1.88 кг', '26', '#6fdc6f'], ['fish', 'Ёрш', '1.51 кг', '22', '#e8e8e8'], ['fish', 'Плотва', '1.14 кг', '19', '#ff8fd8'], ['fish', 'Карась', '0.77 кг', '15', '#e8e8e8']];
const slotHtml = (f) => `<div style="box-sizing:border-box;width:118px;height:138px;${nine('slot', 52, 0.5)}position:relative;display:flex;flex-direction:column;align-items:center">
${f ? `<div style="position:absolute;inset:-26px;border:3px solid ${f[4]};border-radius:12px;box-shadow:0 0 10px ${f[4]}88 inset;pointer-events:none"></div>
<img src="${ic(f[0])}" width="56" style="margin-top:-14px;filter:drop-shadow(0 2px 2px #000)">
<div style="color:${f[4]};${FONT};font-size:15px;text-shadow:0 1px 2px #000">${f[1]}</div><div style="color:#cdb48a;font:12px Georgia">${f[2]}</div>
<div style="margin-top:4px;box-sizing:border-box;width:96px;height:32px;${nine('btn_green', 44, 0.3)}display:flex;align-items:center;justify-content:center;color:#fff2cc;${FONT};font-size:15px;text-shadow:0 1px 2px #000"><img src="${ic('coin')}" width="16" style="margin-right:5px">${f[3]}</div>`
: `<img src="${ic('fish')}" width="50" style="opacity:.1;margin-top:10px">`}</div>`;
const mock = `<div style="width:1100px;height:760px;position:relative;background:#2a3a2a url(${'file:///' + path.join(ROOT, 'assets', 'reference', 'ui2_bag_fish_7_pc.jpg').replace(/\\/g, '/')}) center/cover">
<div style="position:absolute;inset:0;background:rgba(0,0,0,.35)"></div>
<div style="position:absolute;left:100px;top:90px;width:900px;height:620px;box-sizing:border-box;${nine('frame_window', 140, 0.75)}">
<div style="position:absolute;left:-80px;right:-80px;top:-160px;height:140px;box-sizing:border-box;${nine('banner', 210, 0.62)}border-top-width:124px;border-bottom-width:0;border-image-slice:200 210 0 210 fill;margin:0 auto;width:420px"></div>
<div style="position:absolute;left:0;right:0;top:-128px;text-align:center;color:#ffe08a;${FONT};font-size:30px;text-shadow:0 2px 3px #000"><img src="${ic('bag')}" width="34" style="vertical-align:-6px;margin-right:8px">Сумка</div>
<img src="${u('seal')}" width="76" style="position:absolute;right:-118px;top:-130px">
<div style="position:absolute;left:-40px;right:-40px;top:-48px;display:flex;gap:8px">
<div style="box-sizing:border-box;flex:1;height:52px;${nine('tab_on', 44, 0.55)}border-bottom-width:0;display:flex;align-items:center;justify-content:center;gap:8px;color:#3a2306;${FONT};font-size:19px"><img src="${ic('fish')}" width="28">Улов</div>
<div style="box-sizing:border-box;flex:1;height:52px;${nine('tab_off', 44, 0.55)}border-bottom-width:0;display:flex;align-items:center;justify-content:center;gap:8px;color:#f0dcb0;${FONT};font-size:19px"><img src="${ic('book')}" width="26">Коллекция</div>
</div>
<div style="position:absolute;left:-40px;right:-40px;top:14px;bottom:-40px">
<div style="display:flex;align-items:center;gap:12px;height:44px">
<div style="width:52px;height:52px;background:url(${u('medallion')}) center/contain no-repeat;display:flex;align-items:center;justify-content:center"><img src="${ic('bag')}" width="28"></div>
<div style="color:#ffe08a;${FONT};font-size:20px;text-shadow:0 2px 2px #000">Улов 7 / 12</div>
<div style="flex:1;position:relative;height:30px"><div style="position:absolute;inset:0;box-sizing:border-box;${nine('bar_frame', 52, 0.3)}"></div><div style="position:absolute;left:10px;top:8px;width:56%;height:14px;${nine('bar_fill', 20, 0.35)}box-sizing:border-box;filter:sepia(1) saturate(5) hue-rotate(55deg) brightness(.8)"></div></div>
</div>
<img src="${u('divider')}" style="width:100%;height:30px;object-fit:contain;margin:4px 0">
<div style="display:grid;grid-template-columns:repeat(6,118px);gap:10px 12px;justify-content:center">${fishes.map(slotHtml).join('')}${[0, 0, 0, 0, 0].map(() => slotHtml(null)).join('')}</div>
</div>
<div style="position:absolute;left:-40px;right:-40px;bottom:-34px;height:66px;box-sizing:border-box;${nine('parchment', 110, 0.3)}display:flex;align-items:center;gap:10px;padding:0 6px">
<img src="${ic('coin')}" width="36"><div style="color:#4a2e10;font:13px Georgia">Можно выручить<br><span style="${FONT};font-size:22px;color:#3a2306">≈ 182</span></div>
<div style="margin-left:auto">${btnH('btn_green', `<img src="${ic('coin')}" width="22" style="margin-right:8px">Продать всё`, 230)}</div>
</div>
</div>
</div>`;
shot(sheet, 1400, 770, path.join(ROOT, 'assets', 'reference', 'ui3_style_sheet.png'));
shot(mock, 1100, 760, path.join(ROOT, 'assets', 'reference', 'ui3_mock_bag.png'));
console.log('готово', Object.keys(ASSETS).length, 'текстур');
// ---------- лист 2: главный экран из новых картинок (1280×720 поверх снимка игры)
{
const chipH = (icon, t, color = '#f0dcb0') => `<div style="box-sizing:border-box;height:30px;${nine('chip', 26, 0.55)}display:inline-flex;align-items:center;gap:5px;color:${color};font:bold 13px Georgia;text-shadow:0 1px 2px #000;margin:0 4px 0 0"><img src="${ic(icon)}" width="18" style="margin:-8px 0">${t}</div>`;
const menu = (icon, label, key, badge) => `<div style="position:relative;width:70px;height:70px;background:url(${u('menu_btn')}) center/contain no-repeat">
<img src="${ic(icon)}" width="30" style="position:absolute;left:20px;top:13px">
<div style="position:absolute;left:0;right:0;top:48px;text-align:center;color:#ffe9b8;font:bold 11px Georgia;text-shadow:0 1px 2px #000">${label}</div>
${key ? `<div style="position:absolute;right:-3px;top:-3px;width:20px;height:20px;background:url(${u('gold_dot')}) center/contain;color:#3a2306;font:bold 10px Georgia;display:flex;align-items:center;justify-content:center">${key}</div>` : ''}
${badge ? `<div style="position:absolute;left:-5px;top:-5px;width:22px;height:22px;background:url(${u('wax_dot')}) center/contain;color:#fff;font:bold 12px Georgia;display:flex;align-items:center;justify-content:center">!</div>` : ''}</div>`;
const hud = `<div style="width:1280px;height:720px;position:relative;background:url(${'file:///' + path.join(ROOT, 'assets', 'reference', 'hud3_tablet_hud.jpg').replace(/\\/g, '/')}) center/cover;overflow:hidden">
<!-- панель игрока -->
<div style="position:absolute;left:12px;top:10px;width:300px;height:150px;box-sizing:border-box;${nine('frame_small', 64, 0.42)}">
<div style="position:absolute;left:-14px;top:-14px;width:58px;height:58px;background:url(${u('diamond')}) center/contain;display:flex;align-items:center;justify-content:center;color:#ffe08a;font:900 20px Georgia;text-shadow:0 1px 2px #000">1</div>
<div style="position:absolute;left:56px;top:-14px;display:flex;align-items:center;gap:6px"><img src="${ic('coin')}" width="26"><span style="color:#eef2f6;font:900 24px Georgia;text-shadow:0 2px 2px #000">1 250</span></div>
<div style="position:absolute;left:56px;right:-14px;top:18px;height:22px"><div style="position:absolute;inset:0;box-sizing:border-box;${nine('bar_frame', 52, 0.22)}"></div><div style="position:absolute;left:8px;top:6px;width:45%;height:10px;${nine('bar_fill', 20, 0.25)}box-sizing:border-box;filter:sepia(1) saturate(3) brightness(1)"></div><div style="position:absolute;inset:0;text-align:center;color:#fff;font:bold 10px Georgia;line-height:22px;text-shadow:0 1px 2px #000">23 / 50 XP</div></div>
<div style="position:absolute;left:-14px;top:50px;white-space:nowrap">${chipH('clover', 'Удача 100%', '#a8f0a0')}${chipH('bag', '3 / 12')}</div>
<div style="position:absolute;left:-14px;top:84px;white-space:nowrap">${chipH('guild', 'F')}${chipH('seal', '0/30')}${chipH('pearl', '5')}</div>
</div>
<!-- меню -->
<div style="position:absolute;left:12px;top:168px;width:300px;height:168px;box-sizing:border-box;${nine('frame_small', 64, 0.42)}">
<div style="position:absolute;left:-16px;top:-16px;display:grid;grid-template-columns:repeat(4,70px);gap:4px">${menu('bag', 'Сумка', 'B', true)}${menu('book', 'Рыбы', 'C')}${menu('map', 'Миры', 'M')}${menu('scroll', 'Задания', 'Q', true)}${menu('crystal', 'Донат')}${menu('horn', 'Звук')}${menu('guild', 'Гильдия', 'G')}</div>
</div>
<!-- подсказка обучения -->
<div style="position:absolute;left:440px;top:4px;width:400px;height:96px;box-sizing:border-box;${nine('banner', 210, 0.45)}border-top-width:90px;border-bottom-width:0;border-image-slice:200 210 0 210 fill"></div>
<div style="position:absolute;left:440px;top:30px;width:400px;text-align:center;color:#ffe08a;font:900 22px Georgia;text-shadow:0 2px 3px #000">Иди в портал «Тихое озеро»</div>
<!-- тост -->
<div style="position:absolute;left:480px;top:112px;width:320px;height:46px;box-sizing:border-box;${nine('parchment', 110, 0.2)}display:flex;align-items:center;justify-content:center;gap:8px;color:#3a2306;font:bold 16px Georgia"><img src="${ic('fish')}" width="24">Поймана Щука! +37</div>
<!-- таблица игроков -->
<div style="position:absolute;right:12px;top:10px;width:300px;height:84px;box-sizing:border-box;${nine('frame_small', 64, 0.36)}color:#f0dcb0;font:bold 12px Georgia">
<div style="position:absolute;left:-10px;right:-10px;top:-12px;display:flex;justify-content:space-between;color:#ffd678"><span><img src="${ic('guild')}" width="16" style="vertical-align:-3px"> Игроки</span><span>Ур.</span><span>Серебро</span><span>Улов</span></div>
<div style="position:absolute;left:-10px;right:-10px;top:12px;display:flex;justify-content:space-between"><span style="color:#ffe08a">pwdwildfire</span><span>1</span><span>1 250</span><span>3</span></div>
</div>
<!-- погода -->
<div style="position:absolute;right:12px;top:102px;width:250px;height:58px;box-sizing:border-box;${nine('chip', 26, 1)}"></div>
<div style="position:absolute;right:222px;top:96px;width:70px;height:70px;background:url(${u('medallion')}) center/contain;display:flex;align-items:center;justify-content:center"><img src="${ic('sun')}" width="34"></div>
<div style="position:absolute;right:40px;top:108px;color:#f0dcb0;font:900 15px Georgia;text-shadow:0 1px 2px #000">Ясно · 09:30<br><span style="font:12px Georgia;color:#a8e090">Спокойная погода</span></div>
<!-- свиток «Цели» -->
<div style="position:absolute;right:16px;top:176px;width:290px">
<div style="height:28px;background:url(${u('roller')}) center/100% 100%"></div>
<div style="margin:-6px 14px;height:150px;box-sizing:border-box;${nine('parchment', 110, 0.16)}padding:4px 6px;color:#3a2306;font:bold 13px Georgia">
<div style="font:900 16px Georgia;color:#7a1414;margin-bottom:4px"><img src="${ic('target')}" width="18" style="vertical-align:-3px"> Цели</div>
Поймай 3 рыбы · 1/3<div style="height:8px;margin:3px 0 7px;background:#5a3a20;border-radius:4px"><div style="width:33%;height:100%;background:#c8902e;border-radius:4px"></div></div>
Бамбуковая удочка · ур. 3<div style="height:8px;margin:3px 0 7px;background:#5a3a20;border-radius:4px"><div style="width:60%;height:100%;background:#4f7fb0;border-radius:4px"></div></div>
</div>
<div style="height:28px;background:url(${u('roller')}) center/100% 100%"></div>
</div>
<!-- нижняя панель -->
<div style="position:absolute;left:400px;bottom:8px;width:480px;height:86px;box-sizing:border-box;${nine('frame_small', 64, 0.36)}">
<div style="position:absolute;left:-12px;top:-12px;display:flex;gap:6px;align-items:center">
${[1, 2, 3].map(n => `<div style="position:relative;width:62px;height:62px;box-sizing:border-box;${nine('slot', 52, 0.3)}">${n === 1 ? `<img src="${ic('rod')}" width="40" style="position:absolute;left:-4px;top:-4px">` : ''}<div style="position:absolute;left:12px;bottom:-24px;width:18px;height:18px;background:url(${u('gold_dot')}) center/contain;color:#3a2306;font:bold 10px Georgia;text-align:center;line-height:18px">${n}</div></div>`).join('')}
<div style="width:150px;height:56px;box-sizing:border-box;${nine('btn_wood', 44, 0.4)}display:flex;align-items:center;justify-content:center;color:#fff2cc;font:900 15px Georgia;text-shadow:0 1px 2px #000">Старая удочка</div>
<div style="width:120px;height:56px;box-sizing:border-box;${nine('btn_wood', 44, 0.4)}display:flex;align-items:center;justify-content:center;gap:4px;color:#fff2cc;font:900 14px Georgia;text-shadow:0 1px 2px #000"><img src="${ic('worm')}" width="22">Наживка</div>
</div>
</div>
<!-- рюкзак: ПК-плашка и телефонный медальон -->
<div style="position:absolute;right:12px;bottom:12px;width:180px;height:66px;box-sizing:border-box;${nine('btn_wood', 44, 0.6)}display:flex;align-items:center;gap:8px;color:#fff2cc;font:900 18px Georgia;text-shadow:0 1px 2px #000"><img src="${ic('bag')}" width="38" style="margin-left:-10px">Рюкзак<span style="font:bold 12px Georgia;color:#e0c890">3/12</span></div>
<div style="position:absolute;right:220px;bottom:14px;width:64px;height:64px;background:url(${u('medallion')}) center/contain;display:flex;align-items:center;justify-content:center"><img src="${ic('bag')}" width="30"></div>
<div style="position:absolute;right:226px;bottom:6px;width:52px;height:18px;box-sizing:border-box;${nine('chip', 26, 0.3)}color:#ffd678;font:bold 11px Georgia;text-align:center;line-height:6px">3/12</div>
<!-- шкала клёва -->
<div style="position:absolute;left:440px;top:560px;width:400px;height:44px;box-sizing:border-box;${nine('bar_frame', 52, 0.5)}"></div>
<div style="position:absolute;left:600px;top:572px;width:90px;height:20px;background:rgba(80,200,90,.75);border-radius:6px"></div>
<div style="position:absolute;left:640px;top:562px;width:6px;height:40px;background:#fff2b0;border:2px solid #3a2306;border-radius:3px"></div>
</div>`;
shot(hud, 1280, 720, path.join(ROOT, 'assets', 'reference', 'ui3_style_sheet2.png'));
}