This commit is contained in:
cay 2026-04-14 09:39:31 +01:00
parent b91069e472
commit 1af0496722

View File

@ -2,6 +2,39 @@ export async function loadArena() {
const ui = document.querySelector(".building-ui"); const ui = document.querySelector(".building-ui");
if (!ui) return; if (!ui) return;
/* ── Energie prüfen bevor die Arena überhaupt geöffnet wird ── */
try {
const energyRes = await fetch("/api/energy");
if (energyRes.ok) {
const { energy } = await energyRes.json();
if (energy <= 0) {
ui.innerHTML = `
<div style="
display:flex; flex-direction:column; align-items:center;
justify-content:center; height:100%; padding:32px 24px;
text-align:center; gap:14px;">
<div style="font-size:52px;"></div>
<div style="font-family:'Cinzel',serif; font-size:18px;
color:#e74c3c; letter-spacing:2px;">KEINE ENERGIE</div>
<p style="font-family:'Cinzel',serif; font-size:12px;
color:#a08060; line-height:1.8; max-width:280px; margin:0;">
Du hast heute keine Energie mehr für Arena-Kämpfe.<br>
<strong style="color:#f0d060;">
Deine Energie wird täglich um Mitternacht erneuert.
</strong>
</p>
<div style="
margin-top:8px; padding:8px 20px; border-radius:8px;
background:rgba(231,76,60,.1); border:1px solid rgba(231,76,60,.35);
font-family:'Cinzel',serif; font-size:11px; color:#e74c3c;">
Komm morgen wieder!
</div>
</div>`;
return;
}
}
} catch {}
// Decks sofort laden // Decks sofort laden
let decks = []; let decks = [];
try { try {