| Server IP : 202.61.199.114 / Your IP : 216.73.217.139 Web Server : nginx/1.22.1 System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64 User : web20 ( 1018) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/clients/client2/arni-solutions.de/web/slots/js/engine/ |
Upload File : |
/* Reel Royale – FreeSpinEngine: Freispiel-Flow & Overlays (servergesteuert). */
import { $, money, symbolMarkup } from '../util.js';
export class FreeSpinEngine {
constructor(audio) {
this.audio = audio;
this.active = false;
this.total = 0;
this.played = 0;
this.special = null;
}
flow(badge, title, html) {
return new Promise((resolve) => {
const ov = $('flowOverlay');
$('flowBadge').textContent = badge;
$('flowTitle').textContent = title;
$('flowText').innerHTML = html;
ov.hidden = false;
const done = () => {
ov.hidden = true;
$('flowConfirm').removeEventListener('click', done);
ov.removeEventListener('click', bg);
resolve();
};
const bg = (e) => { if (e.target === ov) done(); };
$('flowConfirm').addEventListener('click', done);
ov.addEventListener('click', bg);
});
}
async enter(remaining, special, game, total) {
this.active = true;
this.total = total || remaining;
this.played = 0;
this.special = special;
document.body.classList.add('rr-freespin');
const feat = game.feature?.name || 'Freispiele';
let extra = '';
if (special && game.symbols[special]) {
const s = game.symbols[special];
extra = `<br>Spezialsymbol: <strong>${symbolMarkup(s)} ${s.name}</strong>`;
}
this.audio.play('freespin');
this.audio.setMusicMood(true);
await this.flow('Freispiele', `${this.total} Freispiele!`, `${feat}${extra}`);
}
async retrigger(added, newTotal) {
this.total = newTotal || (this.total + added);
this.audio.play('freespin');
await this.flow('Retrigger', `+${added} Freispiele`, `Insgesamt jetzt <strong>${this.total}</strong> Freispiele.`);
}
setProgress(played, total, active) {
this.played = played;
if (total) this.total = total;
this.active = !!active;
}
async end(sessionWin) {
const total = this.total;
this.active = false;
document.body.classList.remove('rr-freespin');
this.audio.setMusicMood(false);
await this.flow(
'Freispiele abgeschlossen',
'Gesamtgewinn',
`<strong style="font-size:1.9rem;color:var(--rr-gold)">+${money(sessionWin)}</strong>` +
`<br><span style="color:var(--rr-soft)">aus ${total} Freispielen</span>`
);
this.total = 0; this.played = 0; this.special = null;
}
/** Fortschrittstext "x / y". */
label() {
if (!this.active || !this.total) return null;
return `${Math.min(this.played, this.total)} / ${this.total}`;
}
}