diff --git a/www/html/Admin/private/store.json b/www/html/Admin/private/store.json index f383994..116d3f5 100644 --- a/www/html/Admin/private/store.json +++ b/www/html/Admin/private/store.json @@ -38,9 +38,9 @@ "providerUserId": "p_1775109142385_wq7wfy1p32j", "notes": "auto: player-coins", "blocked": false, - "coins": 250, + "coins": 260, "createdAt": "2026-04-02T05:52:21+00:00", - "updatedAt": "2026-06-16T04:02:56+00:00", + "updatedAt": "2026-06-16T14:46:41+00:00", "daily": { "anchorMs": 1781197200000, "claimedDays": [ diff --git a/www/html/Game/public/js/room-lobby.js b/www/html/Game/public/js/room-lobby.js index 3adebeb..257f507 100644 --- a/www/html/Game/public/js/room-lobby.js +++ b/www/html/Game/public/js/room-lobby.js @@ -1905,15 +1905,23 @@ } /** สร้างการ์ดเลือกคดีตามระดับที่เลือก — 5 ระดับ × 3 คดี (L1=1-3, L2=4-6 … L5=13-15) */ + /** คดี (1-15) → โฟลเดอร์/กลุ่มผู้เสียหาย (1-5) ตามตารางออกแบบเกม + 1=ประถม 2=มัธยมต้น 3=มัธยมปลาย 4=นักศึกษานิติ 5=ประชาชนทั่วไป */ + var CASE_FOLDER = { 1: 1, 2: 5, 3: 4, 4: 5, 5: 3, 6: 5, 7: 2, 8: 4, 9: 5, 10: 3, 11: 5, 12: 4, 13: 3, 14: 5, 15: 5 }; + function casesForFolder(folder) { + var out = []; + for (var n = 1; n <= 15; n++) if (CASE_FOLDER[n] === folder) out.push(n); + return out; + } function renderPreplayCaseCards() { var row = preplayOverlay ? preplayOverlay.querySelector('.lobby-preplay-case-row') : null; if (!row) return; var lvl = parseInt(preplaySelectedLevel || (preplayOverlay && preplayOverlay.dataset.preplayLevel) || '1', 10); if (!(lvl >= 1 && lvl <= 5)) lvl = 1; - var startCase = (lvl - 1) * 3 + 1; - var endCase = startCase + 2; + var caseList = casesForFolder(lvl); var html = ''; - for (var n = startCase; n <= endCase; n++) { + for (var ci = 0; ci < caseList.length; ci++) { + var n = caseList[ci]; var m = getCaseMedia(n); var nm = String(m.name || ('คดีที่ ' + n)).replace(/"/g, '"'); html += '
' + diff --git a/www/html/Game/public/room-lobby.html b/www/html/Game/public/room-lobby.html index 05ed1ba..e098d82 100644 --- a/www/html/Game/public/room-lobby.html +++ b/www/html/Game/public/room-lobby.html @@ -1615,7 +1615,7 @@ - +
v —
diff --git a/www/html/Game/server.js b/www/html/Game/server.js index 22a12c9..97ff40b 100644 --- a/www/html/Game/server.js +++ b/www/html/Game/server.js @@ -512,10 +512,11 @@ function sanitizeSpecialQuizSets(obj) { /** เลือกชุดคำถามตาม level+case (fallback ชุด L1_C1) */ function getSpecialQuizSet(settings, level, caseId) { const sets = (settings && settings.specialQuizSets) || sanitizeSpecialQuizSets({}); - const L = SPECIAL_QUIZ_LEVELS.indexOf(Number(level)) >= 0 ? Number(level) : 1; - /* caseId เป็นเลขคดีรวม 1-15 (5 ระดับ × 3 คดี) → แปลงเป็นคดีสัมพัทธ์ในระดับ 1-3 */ - const rel = ((Math.max(1, Number(caseId) || 1) - 1) % 3) + 1; - const C = SPECIAL_QUIZ_CASES.indexOf(rel) >= 0 ? rel : 1; + /* ชุดคำถามพิเศษผูกกับ "เลขคดีสัมบูรณ์ 1-15" (ไม่ผูกกับโฟลเดอร์/level ที่อาจถูกจัดกลุ่มใหม่) + key เดิมในแอดมิน = L{ceil(case/3)}_C{((case-1)%3)+1} ต่อคดี → คงความเข้ากันได้ */ + const cid = Math.max(1, Math.min(15, Number(caseId) || 1)); + const L = Math.ceil(cid / 3); + const C = ((cid - 1) % 3) + 1; return sets[specialQuizSetKey(L, C)] || sets[specialQuizSetKey(1, 1)] || { questions: [], specialCard: sanitizeSpecialCard({}) }; }