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