duktdzu
This commit is contained in:
parent
f6de006949
commit
ad2ca1e03b
@ -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 = {}) {
|
||||
<div class="arena-mode-desc">Einzelkampf – Beweis deine Stärke im Duell</div>
|
||||
</div>
|
||||
|
||||
${!dailyOnly ? `
|
||||
<div class="arena-mode-card" data-mode="2v2">
|
||||
<div class="arena-mode-icon">⚔️</div>
|
||||
<div class="arena-mode-label">2v2</div>
|
||||
@ -28,7 +26,6 @@ export async function loadArena(options = {}) {
|
||||
<div class="arena-mode-label">4v4</div>
|
||||
<div class="arena-mode-desc">Schlachtruf – Führe deine Truppe zum Sieg</div>
|
||||
</div>
|
||||
` : ''}
|
||||
|
||||
</div>
|
||||
|
||||
@ -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)}`,
|
||||
|
||||
@ -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 ── */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user