diff --git a/public/js/buildings/arena.js b/public/js/buildings/arena.js index 08989e8..510fd49 100644 --- a/public/js/buildings/arena.js +++ b/public/js/buildings/arena.js @@ -1,5 +1,4 @@ -export async function loadArena(options = {}) { - const { dailyOnly = false, onMatchComplete = null } = options; +export async function loadArena() { const ui = document.querySelector(".building-ui"); ui.innerHTML = ` @@ -16,7 +15,6 @@ export async function loadArena(options = {}) {
Einzelkampf – Beweis deine Stärke im Duell
- ${!dailyOnly ? `
⚔️
2v2
@@ -28,7 +26,6 @@ export async function loadArena(options = {}) {
4v4
Schlachtruf – Führe deine Truppe zum Sieg
- ` : ''} @@ -39,7 +36,7 @@ export async function loadArena(options = {}) { `; injectArenaStyles(); - initArenaModes({ onMatchComplete }); + initArenaModes(); } /* ── Styles ────────────────────────────────────────────────────────────────── */ @@ -228,13 +225,13 @@ function getSocket() { } /* ── Klick-Handler initialisieren ─────────────────────────────────────────── */ -function initArenaModes({ onMatchComplete = null } = {}) { +function initArenaModes() { document.querySelectorAll(".arena-mode-card").forEach((card) => { card.addEventListener("click", () => { const mode = card.dataset.mode; if (mode === "1v1") { - handle1v1Click(card, onMatchComplete); + handle1v1Click(card); } else { console.log("Arena Modus gewählt:", mode); // Platzhalter für 2v2 / 4v4 @@ -244,7 +241,7 @@ function initArenaModes({ onMatchComplete = null } = {}) { } /* ── 1v1: Hauptlogik ───────────────────────────────────────────────────────── */ -async function handle1v1Click(card, onMatchComplete = null) { +async function handle1v1Click(card) { const socket = getSocket(); if (!socket) { showArenaError("Keine Verbindung zum Server. Bitte Seite neu laden."); @@ -290,9 +287,6 @@ async function handle1v1Click(card, onMatchComplete = null) { setCardSearching(card, false); hideQueueStatus(); - // Daily als erledigt markieren - if (typeof onMatchComplete === "function") onMatchComplete(); - showMatchFoundOverlay(me.name, data.opponent.name, () => { openArenaPopup( `/arena/1v1?match=${encodeURIComponent(data.matchId)}&slot=${encodeURIComponent(data.mySlot)}`, diff --git a/public/js/quickmenu/events.js b/public/js/quickmenu/events.js index cc7f803..e3f5873 100644 --- a/public/js/quickmenu/events.js +++ b/public/js/quickmenu/events.js @@ -1,5 +1,3 @@ -import { loadArena } from "./arena.js"; - /* ================================ Kristall-Mapping (aus carddeck.js) ================================ */ @@ -54,7 +52,7 @@ export async function loadEvents() { const events = [ { id: 1, img: "/images/items/runenhaufen.png", label: "Booster Öffnen", type: "booster" }, - { id: 2, img: "/images/items/runenhaufen.png", label: "1v1 Duell", type: "arena" }, + { id: 2, img: "/images/items/runenhaufen.png", label: "Textzeile 2" }, { id: 3, img: "/images/items/runenhaufen.png", label: "Textzeile 3" }, { id: 4, img: "/images/items/holz.png", label: "Holz Spenden", type: "wood", woodCost: 100 }, { id: 5, img: "/images/items/gold.png", label: "Gold Spenden", type: "gold", goldCost: 100 }, @@ -194,13 +192,6 @@ export async function loadEvents() { resetBooster(); return; } - if (card.dataset.type === "arena") { - loadArena({ - dailyOnly: true, - onMatchComplete: () => markDailyComplete(2), - }); - return; - } if (card.dataset.type === "gold") { eventsGrid.style.display = "none"; goldUi.style.display = "flex"; @@ -285,6 +276,7 @@ export async function loadEvents() { clearGoldIntervals(); isGoldSpinning = false; }); + // ESC wird zentral in quickmenu.js behandelt (verhindert Listener-Stapelung) /* ── Booster Zustand ── */