diff --git a/meta.js b/meta.js index d009460..11b73d7 100644 --- a/meta.js +++ b/meta.js @@ -70,8 +70,11 @@ const esc = t => String(t).replace(/[&<>"]/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c])); // ---- toasts ---- - let toastBox; + let toastBox, held = []; + // Selama layar VS tampil toast ditahan (menutupi bilah atas VS), lalu dimunculkan penuh setelah layar selesai atau dibatalkan. + function holdToasts() { setTimeout(() => { if (window.VS?.active) return holdToasts(); const q = held; held = []; for (const [m, k] of q) toast(m, k); }, 150); } function toast(msg, kind = '') { + if (window.VS?.active) { held.push([msg, kind]); if (held.length === 1) holdToasts(); return; } if (!toastBox) { toastBox = document.createElement('div'); toastBox.id = 'meta-toasts'; document.body.append(toastBox); } const el = document.createElement('div'); el.className = 'meta-toast ' + kind; el.textContent = msg; toastBox.append(el); setTimeout(() => el.classList.add('out'), 3200); setTimeout(() => el.remove(), 3800); @@ -136,8 +139,6 @@ const g = window.__game, stages = Object.keys(window.MatchRules?.stages || { bellora: 1 }); const enemy = run.kind === 'arcade' ? run.queue[run.wins] : shuffle(roster().filter(x => x !== run.player))[0]; const level = run.kind === 'arcade' ? 'medium' : run.wins < 3 ? 'easy' : run.wins < 6 ? 'medium' : run.wins < 9 ? 'hard' : 'excellent'; - const total = run.kind === 'arcade' ? '/' + run.queue.length : ''; - toast((run.kind === 'arcade' ? 'ARCADE' : 'SURVIVAL') + ' · LAWAN ' + (run.wins + 1) + total + ': ' + fname(enemy) + ' (' + level + ')'); let ok = false; for (const st of shuffle(stages.slice()).concat('bellora')) { ok = g.startMatch({ player: run.player, enemy, stage: st, level, mode: 'versus', vs: { label: (run.kind === 'arcade' ? 'ARCADE · LAWAN ' + (run.wins + 1) + ' / ' + run.queue.length : 'SURVIVAL · LAWAN ' + (run.wins + 1)) } }); if (ok) break; } if (!ok) { toast('Aset belum siap, coba lagi.'); run = null; window.FrontEnd?.home(); }