diff --git a/app.js b/app.js
index cd35633..c51fafb 100644
--- a/app.js
+++ b/app.js
@@ -29,6 +29,7 @@ const { registerChatHandlers } = require("./sockets/chat");
const boosterRoutes = require("./routes/booster.route");
const pointsRoutes = require("./routes/points.route");
const combineRoutes = require("./routes/combine.route");
+const bazaarRoutes = require("./routes/bazaar.route");
const compression = require("compression");
@@ -387,6 +388,7 @@ app.use("/api", boosterRoutes);
app.use("/api", require("./routes/daily.route"));
app.use("/api/points", pointsRoutes);
app.use("/api", combineRoutes);
+app.use("/api", bazaarRoutes);
/* ========================
404 Handler
diff --git a/public/css/bazaar.css b/public/css/bazaar.css
index f0cfd9d..bd1ffe1 100644
--- a/public/css/bazaar.css
+++ b/public/css/bazaar.css
@@ -119,3 +119,197 @@
letter-spacing: 2px;
opacity: 0.7;
}
+
+/* ══════════════════════════════════════════════
+ HÄNDLER – Karten-Grid
+══════════════════════════════════════════════ */
+
+.baz-grid {
+ flex: 1;
+ display: grid;
+ grid-template-columns: repeat(6, 1fr);
+ gap: 10px;
+ overflow-y: auto;
+ padding: 12px 14px;
+ align-content: start;
+}
+
+.baz-card {
+ position: relative;
+ border: 2px solid #6b4b2a;
+ border-radius: 8px;
+ overflow: visible;
+ background: #1a0f04;
+ cursor: pointer;
+ transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
+ aspect-ratio: 3/4;
+ display: flex;
+ flex-direction: column;
+}
+.baz-card:hover {
+ transform: scale(1.06) translateY(-4px);
+ border-color: #f0d060;
+ box-shadow: 0 8px 24px rgba(0,0,0,0.7), 0 0 14px rgba(200,160,60,0.3);
+ z-index: 10;
+}
+.baz-card img {
+ width: 100%; height: 100%;
+ object-fit: cover; display: block;
+ border-radius: 6px 6px 0 0;
+}
+
+/* Stats */
+.baz-stat-atk {
+ position: absolute; right: 8px; top: 38%;
+ transform: translateY(-50%);
+ background: rgba(180,40,20,0.88); border: 1px solid #ff6040;
+ border-radius: 45px; color: #fff;
+ font-family: "Cinzel", serif; font-size: 9px; font-weight: bold;
+ padding: 2px 4px; z-index: 5;
+}
+.baz-stat-def {
+ position: absolute; left: 8px; top: 38%;
+ transform: translateY(-50%);
+ background: rgba(20,80,180,0.88); border: 1px solid #4090ff;
+ border-radius: 45px; color: #fff;
+ font-family: "Cinzel", serif; font-size: 9px; font-weight: bold;
+ padding: 2px 4px; z-index: 5;
+}
+.baz-stat-cd {
+ position: absolute; bottom: 32px; right: 5px;
+ width: 18px; height: 18px; border-radius: 50%;
+ background: rgba(0,0,0,0.75); border: 1px solid #f0d060;
+ display: flex; align-items: center; justify-content: center;
+ font-family: "Cinzel", serif; font-size: 8px; font-weight: bold;
+ color: #f0d9a6; z-index: 5; pointer-events: none;
+}
+
+/* Rarity */
+.baz-rarity {
+ position: absolute; top: 62%; left: 0; right: 0;
+ display: flex; justify-content: center; flex-wrap: wrap;
+ gap: 1px; pointer-events: none; z-index: 4;
+}
+
+/* Range / Race */
+.baz-range-race {
+ position: absolute; top: 74%; left: 0; right: 0;
+ display: flex; justify-content: center; gap: 3px;
+ pointer-events: none; z-index: 6;
+}
+.baz-badge-range, .baz-badge-race {
+ display: flex; align-items: center; gap: 2px;
+ padding: 1px 3px; border-radius: 20px;
+ font-family: "Cinzel", serif; font-size: 8px; font-weight: bold; line-height: 1;
+}
+.baz-badge-range { background: rgba(30,20,0,0.82); border: 1px solid #e8b84b; color: #e8b84b; }
+.baz-badge-race { background: rgba(0,25,0,0.82); border: 1px solid #7de87d; color: #7de87d; }
+
+/* Preis-Badge */
+.baz-price {
+ position: absolute; bottom: 0; left: 0; right: 0;
+ display: flex; justify-content: center; gap: 4px; flex-wrap: wrap;
+ padding: 2px 3px 3px;
+ background: linear-gradient(transparent, rgba(0,0,0,0.85));
+ border-radius: 0 0 6px 6px;
+ z-index: 7; pointer-events: none;
+}
+.baz-price-gold, .baz-price-silver {
+ font-family: "Cinzel", serif; font-size: 8px; font-weight: bold;
+ line-height: 1.3;
+}
+.baz-price-wood { color: #c8a050; }
+.baz-price-iron { color: #a0b0c0; }
+.baz-price-gold { color: #f0d060; }
+.baz-price-gems { color: #a060ff; }
+.baz-price-silver { color: #c0c0c0; }
+
+/* Pagination */
+.baz-pagination {
+ display: flex; align-items: center; justify-content: center;
+ gap: 5px; padding: 8px 10px; flex-shrink: 0;
+ border-top: 1px solid #3a2810;
+}
+.baz-page-btn {
+ background: linear-gradient(#3a2810, #1a0f04);
+ border: 1px solid #8b6a3c; border-radius: 5px;
+ color: #f0d9a6; font-family: "Cinzel", serif;
+ font-size: 11px; padding: 3px 10px; cursor: pointer; transition: 0.15s;
+}
+.baz-page-btn:hover { border-color: #f0d060; }
+.baz-page-btn:disabled { opacity: 0.35; cursor: not-allowed; }
+.baz-page-btn.baz-page-active {
+ background: linear-gradient(#6b4b2a, #3c2414);
+ border-color: #f0d060; color: #fff5cc;
+}
+.baz-page-info { color: #a08060; font-size: 11px; }
+
+/* Leer / Laden */
+.baz-empty, .baz-loading {
+ grid-column: 1 / -1; text-align: center;
+ color: #8b6a3c; font-family: "Cinzel", serif;
+ font-size: 13px; padding: 40px 0;
+}
+
+/* Währung im Header */
+.baz-currency {
+ font-family: "Cinzel", serif; font-size: 12px;
+ color: #f0d9a6; letter-spacing: 1px;
+}
+
+/* Kauf-Bestätigung */
+.baz-confirm-backdrop {
+ position: absolute; inset: 0;
+ background: rgba(0,0,0,0.7);
+ border-radius: 0 0 10px 10px;
+ z-index: 50;
+}
+.baz-confirm-box {
+ position: absolute; top: 50%; left: 50%;
+ transform: translate(-50%, -50%);
+ z-index: 51;
+ background: linear-gradient(#2a1a08, #1a0f04);
+ border: 2px solid #c8960c; border-radius: 12px;
+ padding: 24px 28px; min-width: 260px;
+ display: flex; flex-direction: column;
+ align-items: center; gap: 12px;
+ font-family: "Cinzel", serif;
+}
+.baz-confirm-img-wrap {
+ width: 120px; aspect-ratio: 3/4;
+ border: 2px solid #6b4b2a; border-radius: 8px; overflow: hidden;
+}
+.baz-confirm-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
+.baz-confirm-name { font-size: 15px; font-weight: bold; color: #f0d9a6; }
+.baz-confirm-price { font-size: 13px; color: #f0d060; }
+.baz-confirm-warn { font-size: 11px; color: #ff6666; }
+.baz-confirm-btns { display: flex; gap: 12px; }
+.baz-btn-cancel, .baz-btn-buy {
+ padding: 8px 20px; border-radius: 7px; cursor: pointer;
+ font-family: "Cinzel", serif; font-size: 12px; font-weight: bold;
+ transition: 0.2s;
+}
+.baz-btn-cancel {
+ background: linear-gradient(#3a2810, #1a0f04);
+ border: 2px solid #6b4b2a; color: #a08060;
+}
+.baz-btn-cancel:hover { border-color: #f0d060; color: #f0d9a6; }
+.baz-btn-buy {
+ background: linear-gradient(#6b4b2a, #3c2414);
+ border: 2px solid #f0d060; color: #fff5cc;
+}
+.baz-btn-buy:hover:not(:disabled) { box-shadow: 0 0 12px rgba(200,160,60,0.5); }
+.baz-btn-buy:disabled { opacity: 0.35; cursor: not-allowed; }
+
+/* Toast */
+.baz-toast {
+ position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
+ background: linear-gradient(#4a2808, #2a1004); border: 2px solid #8b6a3c;
+ border-radius: 8px; color: #f0d9a6; font-family: "Cinzel", serif;
+ font-size: 13px; padding: 10px 22px; z-index: 9999; pointer-events: none;
+}
+
+/* Header-Währungen */
+.baz-header-right {
+ display: flex; align-items: center; gap: 14px;
+}
diff --git a/public/js/buildings/bazaar.js b/public/js/buildings/bazaar.js
index 0a93d6c..0350b61 100644
--- a/public/js/buildings/bazaar.js
+++ b/public/js/buildings/bazaar.js
@@ -1,107 +1,252 @@
/* ============================================================
public/js/buildings/bazaar.js
- Bazaar – eigenes Parchment-Popup (wie Gaststätte)
============================================================ */
+const BAZAAR_PER_PAGE = 18;
let baz_initialized = false;
+let baz_page = 1;
+let baz_wood = 0, baz_iron = 0, baz_gold = 0, baz_gems = 0;
+
+const BAZ_SVG_RANGE = ``;
+const BAZ_SVG_RACE = ``;
+
+const RARITY_CRYSTALS = {
+ 1:"roter-cristal.png",2:"blauer-cristal.png",3:"gelber-cristal.png",
+ 4:"gruener-cristal.png",5:"oranger-cristal.png",6:"violet-cristal.png",7:"pinker-cristal.png"
+};
+function rarityImgs(rarity, size=11) {
+ const file = RARITY_CRYSTALS[String(rarity)];
+ if (!file) return "";
+ const img = ``;
+ return img.repeat(parseInt(rarity)||0);
+}
-/* ── CSS einmalig laden ── */
function loadCSS() {
if (!document.querySelector('link[href="/css/bazaar.css"]')) {
- const link = document.createElement("link");
- link.rel = "stylesheet";
- link.href = "/css/bazaar.css";
- document.head.appendChild(link);
+ const l = document.createElement("link");
+ l.rel = "stylesheet"; l.href = "/css/bazaar.css";
+ document.head.appendChild(l);
}
}
-/* ── Popup-Element erzeugen falls noch nicht vorhanden ── */
function ensurePopup() {
if (document.getElementById("bazaar-popup")) return;
-
const popup = document.createElement("div");
popup.id = "bazaar-popup";
popup.className = "qm-popup";
popup.innerHTML = `