diff --git a/public/js/quickmenu/events.js b/public/js/quickmenu/events.js index 6424138..f881017 100644 --- a/public/js/quickmenu/events.js +++ b/public/js/quickmenu/events.js @@ -22,9 +22,12 @@ function rarityImgs(rarity, size = 13) { function cardHTML(card, isFront = true) { if (!isFront) return `?`; - const img = card?.image ? `/images/cards/${card.image}` : "/images/items/rueckseite.png"; + // image zuerst, dann icon als Fallback + const imgFile = card?.image || card?.icon || null; + const img = imgFile ? `/images/cards/${imgFile}` : "/images/items/rueckseite.png"; return ` - ${card?.name || ''} + ${card?.name || ''} ${card?.attack != null ? `${card.attack}` : ""} ${card?.defends != null ? `${card.defends}` : ""} ${card?.cooldown!= null ? `${card.cooldown}` : ""} @@ -201,15 +204,24 @@ export async function loadEvents() { /* ── Slot enthüllen – Sperre setzen BEVOR clearInterval ── */ function revealSlot(index, card) { - slotLocked[index] = true; // zuerst sperren + slotLocked[index] = true; // zuerst sperren clearInterval(spinIntervals[index]); // dann stoppen delete spinIntervals[index]; + console.log(`[Booster] Slot ${index} enthüllt:`, card); + const slot = body.querySelector(`#booster-slot-${index}`); const inner = slot.querySelector(".booster-slot-inner"); slot.classList.remove("spinning"); slot.classList.add("revealed"); - inner.innerHTML = cardHTML(card, true); // finale Karte setzen + + // innerHTML setzen und danach nochmal sicherstellen (doppelte Absicherung) + inner.innerHTML = cardHTML(card, true); + setTimeout(() => { + if (slot.classList.contains("revealed")) { + inner.innerHTML = cardHTML(card, true); + } + }, 100); } /* ── Stapel klicken ── */ diff --git a/routes/booster.js b/routes/booster.js index 06f6ae1..63f560c 100644 --- a/routes/booster.js +++ b/routes/booster.js @@ -59,7 +59,7 @@ router.get("/booster/cards", async (req, res) => { if (!req.session?.user) return res.status(401).json({ error: "Nicht eingeloggt" }); try { const [cards] = await db.query( - "SELECT id, name, image, max_level, rarity, attack, defends, cooldown FROM cards ORDER BY id" + "SELECT id, name, image, icon, max_level, rarity, attack, defends, cooldown FROM cards ORDER BY id" ); res.json(cards); } catch (err) { @@ -85,7 +85,7 @@ router.post("/booster/open", async (req, res) => { const maxAllowed = Math.max(...weights.map(w => w.maxLevel)); const [allCards] = await db.query( - "SELECT id, name, image, max_level, rarity, attack, defends, cooldown FROM cards WHERE max_level <= ?", + "SELECT id, name, image, icon, max_level, rarity, attack, defends, cooldown FROM cards WHERE max_level <= ?", [maxAllowed] );