feat: 收起地圖上古饕餮圖案、地圖校準器支援西域商隊與天機閣位置調整
Browse files- js/admin.js +79 -34
- js/config.js +2 -2
- js/engine.js +7 -2
- js/map.js +16 -2
- teacher.html +4 -3
- tools/map-editor.html +27 -13
js/admin.js
CHANGED
|
@@ -61,6 +61,7 @@ async function init() {
|
|
| 61 |
|
| 62 |
bind($('#selClass'), 'change', () => {
|
| 63 |
currentClassCode = $('#selClass').value;
|
|
|
|
| 64 |
refreshCurrentTab();
|
| 65 |
});
|
| 66 |
|
|
@@ -1445,13 +1446,19 @@ async function saveBossPhaseSettings() {
|
|
| 1445 |
const classInfo = (await db.getClass(currentClassCode)) || {};
|
| 1446 |
const prevWb = classInfo.worldBoss || { curHp: 500, maxHp: 500, defeated: false, killer: null, damages: {} };
|
| 1447 |
let nextWb = { ...prevWb };
|
| 1448 |
-
if (selVal === '
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1449 |
nextWb.bossId = 'taotie';
|
| 1450 |
nextWb.phaseMode = 'open';
|
|
|
|
| 1451 |
if (!nextWb.maxHp || nextWb.maxHp === 800) nextWb.maxHp = 500;
|
| 1452 |
} else if (selVal === 'qiongqi_preview') {
|
| 1453 |
nextWb.bossId = 'qiongqi';
|
| 1454 |
nextWb.phaseMode = 'preview';
|
|
|
|
| 1455 |
nextWb.maxHp = 800;
|
| 1456 |
nextWb.curHp = 800;
|
| 1457 |
nextWb.defeated = false;
|
|
@@ -1461,6 +1468,7 @@ async function saveBossPhaseSettings() {
|
|
| 1461 |
const switchingFromTaotie = prevWb.bossId !== 'qiongqi';
|
| 1462 |
nextWb.bossId = 'qiongqi';
|
| 1463 |
nextWb.phaseMode = 'open';
|
|
|
|
| 1464 |
nextWb.maxHp = 800;
|
| 1465 |
if (switchingFromTaotie) {
|
| 1466 |
nextWb.curHp = 800;
|
|
@@ -1490,7 +1498,12 @@ function renderBossAdminStatus(classInfo) {
|
|
| 1490 |
|
| 1491 |
const selEl = $('#selAdminBossPhase');
|
| 1492 |
if (selEl) {
|
| 1493 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1494 |
}
|
| 1495 |
const qModeSel = $('#selAdminBossQuestionMode');
|
| 1496 |
if (qModeSel) {
|
|
@@ -1498,9 +1511,12 @@ function renderBossAdminStatus(classInfo) {
|
|
| 1498 |
}
|
| 1499 |
const titleEl = $('#lblAdminBossCardTitle');
|
| 1500 |
if (titleEl) {
|
| 1501 |
-
|
| 1502 |
-
|
| 1503 |
-
|
|
|
|
|
|
|
|
|
|
| 1504 |
}
|
| 1505 |
|
| 1506 |
const hpEl = $('#lblAdminBossHp');
|
|
@@ -1519,7 +1535,10 @@ function renderBossAdminStatus(classInfo) {
|
|
| 1519 |
if (hpEl) hpEl.textContent = `${curHp} / ${maxHp} HP (${pct.toFixed(1)}%)`;
|
| 1520 |
if (barEl) barEl.style.width = `${pct}%`;
|
| 1521 |
if (badgeEl) {
|
| 1522 |
-
if (
|
|
|
|
|
|
|
|
|
|
| 1523 |
badgeEl.className = 'badge badge-gold';
|
| 1524 |
badgeEl.textContent = '🔒 預告剪影中';
|
| 1525 |
} else if (status.defeated) {
|
|
@@ -1664,18 +1683,19 @@ function runSimulation() {
|
|
| 1664 |
// 城池沙盤校準器 (Map & Castle Sandbox Calibrator)
|
| 1665 |
// -------------------------------------------------------------
|
| 1666 |
const MAP_TOWNS_DEF = [
|
| 1667 |
-
{ id: 'b1',
|
| 1668 |
-
{ id: 'b9',
|
| 1669 |
-
{ id: 'b2',
|
| 1670 |
-
{ id: 'b4',
|
| 1671 |
-
{ id: 'b7',
|
| 1672 |
-
{ id: 'b3',
|
| 1673 |
-
{ id: 'b5',
|
| 1674 |
-
{ id: 'b6',
|
| 1675 |
-
{ id: 'b8',
|
| 1676 |
-
{ id: 'b10',
|
| 1677 |
-
{ id: 'tianji',
|
| 1678 |
-
{ id: '
|
|
|
|
| 1679 |
];
|
| 1680 |
|
| 1681 |
let mapLayoutData = null;
|
|
@@ -1685,10 +1705,15 @@ function initMapLayoutData() {
|
|
| 1685 |
if (mapLayoutData) return;
|
| 1686 |
mapLayoutData = {};
|
| 1687 |
try {
|
| 1688 |
-
const
|
| 1689 |
-
if (
|
| 1690 |
-
|
| 1691 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1692 |
}
|
| 1693 |
} catch (e) { console.warn('[MapEditor] 讀取佈局快取失敗', e); }
|
| 1694 |
|
|
@@ -1721,9 +1746,14 @@ function renderMapEditor() {
|
|
| 1721 |
<div class="map-editor-resize" data-bid="${t.id}" title="拖動調整大小"></div>
|
| 1722 |
</div>`;
|
| 1723 |
} else {
|
| 1724 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1725 |
innerContent = `
|
| 1726 |
-
<div class="map-editor-thumb" style="width:${item.size}px; height:${
|
| 1727 |
<img src="${imgSrc}" class="map-editor-img" alt="${t.name}">
|
| 1728 |
<div class="map-editor-resize" data-bid="${t.id}" title="拖動調整大小"></div>
|
| 1729 |
</div>`;
|
|
@@ -1822,7 +1852,7 @@ function startNodeResize(e, bid) {
|
|
| 1822 |
const thumb = $(`#mapNode_${bid} .map-editor-thumb`);
|
| 1823 |
if (thumb) {
|
| 1824 |
thumb.style.width = (bid === 'b10' ? newSize + 20 : newSize) + 'px';
|
| 1825 |
-
thumb.style.height = newSize + 'px';
|
| 1826 |
}
|
| 1827 |
const tagNum = $(`#mapNode_${bid} .map-editor-tag small`);
|
| 1828 |
if (tagNum) tagNum.textContent = `(${newSize}px)`;
|
|
@@ -1890,7 +1920,7 @@ function onSliderCoordChange() {
|
|
| 1890 |
const thumb = $('.map-editor-thumb', node);
|
| 1891 |
if (thumb) {
|
| 1892 |
thumb.style.width = (selectedMapTownId === 'b10' ? cur.size + 20 : cur.size) + 'px';
|
| 1893 |
-
thumb.style.height = cur.size + 'px';
|
| 1894 |
}
|
| 1895 |
const tagNum = $('.map-editor-tag small', node);
|
| 1896 |
if (tagNum) tagNum.textContent = `(${cur.size}px)`;
|
|
@@ -1937,13 +1967,21 @@ function updateEditorJson() {
|
|
| 1937 |
txt.value = JSON.stringify(out, null, 2);
|
| 1938 |
}
|
| 1939 |
|
| 1940 |
-
function saveMapLayout() {
|
| 1941 |
-
|
| 1942 |
-
|
| 1943 |
-
|
| 1944 |
-
|
| 1945 |
-
|
| 1946 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1947 |
}
|
| 1948 |
|
| 1949 |
function copyMapJson() {
|
|
@@ -1985,13 +2023,20 @@ function importMapJson() {
|
|
| 1985 |
}
|
| 1986 |
}
|
| 1987 |
|
| 1988 |
-
function resetMapLayout() {
|
| 1989 |
if (!confirm('確定要清除自訂微調,重設回官方標準預設座標嗎?')) return;
|
| 1990 |
localStorage.removeItem('idle_custom_map_layout');
|
| 1991 |
mapLayoutData = {};
|
| 1992 |
MAP_TOWNS_DEF.forEach(t => {
|
| 1993 |
mapLayoutData[t.id] = { x: t.defX, y: t.defY, size: t.defSize, name: t.name };
|
| 1994 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1995 |
renderMapEditor();
|
| 1996 |
toast('🔄 已重設回官方標準預設佈局', 'info');
|
| 1997 |
}
|
|
|
|
| 61 |
|
| 62 |
bind($('#selClass'), 'change', () => {
|
| 63 |
currentClassCode = $('#selClass').value;
|
| 64 |
+
mapLayoutData = null;
|
| 65 |
refreshCurrentTab();
|
| 66 |
});
|
| 67 |
|
|
|
|
| 1446 |
const classInfo = (await db.getClass(currentClassCode)) || {};
|
| 1447 |
const prevWb = classInfo.worldBoss || { curHp: 500, maxHp: 500, defeated: false, killer: null, damages: {} };
|
| 1448 |
let nextWb = { ...prevWb };
|
| 1449 |
+
if (selVal === 'taotie_closed') {
|
| 1450 |
+
nextWb.bossId = 'taotie';
|
| 1451 |
+
nextWb.phaseMode = 'closed';
|
| 1452 |
+
nextWb.hidden = true;
|
| 1453 |
+
} else if (selVal === 'taotie_open') {
|
| 1454 |
nextWb.bossId = 'taotie';
|
| 1455 |
nextWb.phaseMode = 'open';
|
| 1456 |
+
nextWb.hidden = false;
|
| 1457 |
if (!nextWb.maxHp || nextWb.maxHp === 800) nextWb.maxHp = 500;
|
| 1458 |
} else if (selVal === 'qiongqi_preview') {
|
| 1459 |
nextWb.bossId = 'qiongqi';
|
| 1460 |
nextWb.phaseMode = 'preview';
|
| 1461 |
+
nextWb.hidden = false;
|
| 1462 |
nextWb.maxHp = 800;
|
| 1463 |
nextWb.curHp = 800;
|
| 1464 |
nextWb.defeated = false;
|
|
|
|
| 1468 |
const switchingFromTaotie = prevWb.bossId !== 'qiongqi';
|
| 1469 |
nextWb.bossId = 'qiongqi';
|
| 1470 |
nextWb.phaseMode = 'open';
|
| 1471 |
+
nextWb.hidden = false;
|
| 1472 |
nextWb.maxHp = 800;
|
| 1473 |
if (switchingFromTaotie) {
|
| 1474 |
nextWb.curHp = 800;
|
|
|
|
| 1498 |
|
| 1499 |
const selEl = $('#selAdminBossPhase');
|
| 1500 |
if (selEl) {
|
| 1501 |
+
if (isQiongqi) {
|
| 1502 |
+
selEl.value = isPreview ? 'qiongqi_preview' : 'qiongqi_open';
|
| 1503 |
+
} else {
|
| 1504 |
+
const isClosed = status.isClosedMode || status.isExpired || status.isTaotieConcluded || classInfo?.worldBoss?.phaseMode === 'closed' || classInfo?.worldBoss?.hidden;
|
| 1505 |
+
selEl.value = isClosed ? 'taotie_closed' : 'taotie_open';
|
| 1506 |
+
}
|
| 1507 |
}
|
| 1508 |
const qModeSel = $('#selAdminBossQuestionMode');
|
| 1509 |
if (qModeSel) {
|
|
|
|
| 1511 |
}
|
| 1512 |
const titleEl = $('#lblAdminBossCardTitle');
|
| 1513 |
if (titleEl) {
|
| 1514 |
+
if (isQiongqi) {
|
| 1515 |
+
titleEl.textContent = `⚡ 世界 Boss【上古・窮奇】班級即時討伐戰況${isPreview ? '(目前為神秘剪影預告模式)' : ''}`;
|
| 1516 |
+
} else {
|
| 1517 |
+
const isClosed = status.isClosedMode || status.isExpired || status.isTaotieConcluded || classInfo?.worldBoss?.phaseMode === 'closed' || classInfo?.worldBoss?.hidden;
|
| 1518 |
+
titleEl.textContent = `🐲 世界 Boss【上古・饕餮】班級戰況${isClosed ? '(活動已圓滿結束,地圖已收起)' : '(討伐開放中)'}`;
|
| 1519 |
+
}
|
| 1520 |
}
|
| 1521 |
|
| 1522 |
const hpEl = $('#lblAdminBossHp');
|
|
|
|
| 1535 |
if (hpEl) hpEl.textContent = `${curHp} / ${maxHp} HP (${pct.toFixed(1)}%)`;
|
| 1536 |
if (barEl) barEl.style.width = `${pct}%`;
|
| 1537 |
if (badgeEl) {
|
| 1538 |
+
if (status.isClosedMode || status.isExpired || status.isTaotieConcluded) {
|
| 1539 |
+
badgeEl.className = 'badge badge-gold';
|
| 1540 |
+
badgeEl.textContent = '💤 活動已結束(地圖已收起)';
|
| 1541 |
+
} else if (isPreview) {
|
| 1542 |
badgeEl.className = 'badge badge-gold';
|
| 1543 |
badgeEl.textContent = '🔒 預告剪影中';
|
| 1544 |
} else if (status.defeated) {
|
|
|
|
| 1683 |
// 城池沙盤校準器 (Map & Castle Sandbox Calibrator)
|
| 1684 |
// -------------------------------------------------------------
|
| 1685 |
const MAP_TOWNS_DEF = [
|
| 1686 |
+
{ id: 'b1', name: '景陽瓷都', icon: '🏺', specialty: '初始門戶・瓷器商道', defX: 27.8, defY: 70.7, defSize: 166 },
|
| 1687 |
+
{ id: 'b9', name: '柴桑水寨', icon: '⚓', specialty: '左翼水軍・江灣重鎮', defX: 18.1, defY: 62.1, defSize: 174 },
|
| 1688 |
+
{ id: 'b2', name: '平原稻鄉', icon: '🌾', specialty: '萬頃良田・天下糧倉', defX: 37.7, defY: 78.9, defSize: 167 },
|
| 1689 |
+
{ id: 'b4', name: '百草藥谷', icon: '🌿', specialty: '靈草仙葩・金丹聖境', defX: 62.1, defY: 79.0, defSize: 174 },
|
| 1690 |
+
{ id: 'b7', name: '塞外天馬', icon: '🐎', specialty: '神駿鐵騎・奔雷塞北', defX: 71.8, defY: 70.6, defSize: 171 },
|
| 1691 |
+
{ id: 'b3', name: '神兵鐵城', icon: '⚔️', specialty: '中央梯田・百辟神兵', defX: 50.5, defY: 48.5, defSize: 169 },
|
| 1692 |
+
{ id: 'b5', name: '蜀錦絲城', icon: '👘', specialty: '雲錦天絲・蜀道要衝', defX: 59.9, defY: 42.2, defSize: 173 },
|
| 1693 |
+
{ id: 'b6', name: '崑崙玉塞', icon: '⛏️', specialty: '極東奇礦・金玉靈峰', defX: 81.6, defY: 62.2, defSize: 172 },
|
| 1694 |
+
{ id: 'b8', name: '軍機策府', icon: '🏫', specialty: '天臺奇謀・九州文韜', defX: 67.5, defY: 34.7, defSize: 172 },
|
| 1695 |
+
{ id: 'b10', name: '霸業王城', icon: '🏰', specialty: '皇極九五・天下歸心', defX: 52.0, defY: 22.0, defSize: 140 },
|
| 1696 |
+
{ id: 'tianji', name: '天機閣', icon: '🏯', specialty: '急速快答・軍備寶箱', defX: 34.5, defY: 29.7, defSize: 154 },
|
| 1697 |
+
{ id: 'merchantCamp', name: '西域商隊', icon: '🎪', specialty: '限時快答・商隊大營', defX: 44.2, defY: 46.8, defSize: 145 },
|
| 1698 |
+
{ id: 'boss', name: '世界Boss', icon: '🐲', specialty: '世界Boss・懸空禁地', defX: 81.5, defY: 22.0, defSize: 168 },
|
| 1699 |
];
|
| 1700 |
|
| 1701 |
let mapLayoutData = null;
|
|
|
|
| 1705 |
if (mapLayoutData) return;
|
| 1706 |
mapLayoutData = {};
|
| 1707 |
try {
|
| 1708 |
+
const classInfo = classes.find(c => c.code === currentClassCode);
|
| 1709 |
+
if (classInfo?.mapLayout && typeof classInfo.mapLayout === 'object') {
|
| 1710 |
+
mapLayoutData = JSON.parse(JSON.stringify(classInfo.mapLayout));
|
| 1711 |
+
} else {
|
| 1712 |
+
const saved = localStorage.getItem('idle_custom_map_layout');
|
| 1713 |
+
if (saved) {
|
| 1714 |
+
const parsed = JSON.parse(saved);
|
| 1715 |
+
if (parsed && typeof parsed === 'object') mapLayoutData = parsed;
|
| 1716 |
+
}
|
| 1717 |
}
|
| 1718 |
} catch (e) { console.warn('[MapEditor] 讀取佈局快取失敗', e); }
|
| 1719 |
|
|
|
|
| 1746 |
<div class="map-editor-resize" data-bid="${t.id}" title="拖動調整大小"></div>
|
| 1747 |
</div>`;
|
| 1748 |
} else {
|
| 1749 |
+
let imgSrc = `assets/building_${t.id}.png`;
|
| 1750 |
+
if (t.id === 'tianji') imgSrc = 'assets/building_tianji.png';
|
| 1751 |
+
else if (t.id === 'boss') imgSrc = 'assets/boss_taotie.png';
|
| 1752 |
+
else if (t.id === 'merchantCamp') imgSrc = 'assets/merchant_caravan_lv1.png';
|
| 1753 |
+
|
| 1754 |
+
const thumbHeight = t.id === 'merchantCamp' ? Math.round(item.size * 0.75) : item.size;
|
| 1755 |
innerContent = `
|
| 1756 |
+
<div class="map-editor-thumb" style="width:${item.size}px; height:${thumbHeight}px;">
|
| 1757 |
<img src="${imgSrc}" class="map-editor-img" alt="${t.name}">
|
| 1758 |
<div class="map-editor-resize" data-bid="${t.id}" title="拖動調整大小"></div>
|
| 1759 |
</div>`;
|
|
|
|
| 1852 |
const thumb = $(`#mapNode_${bid} .map-editor-thumb`);
|
| 1853 |
if (thumb) {
|
| 1854 |
thumb.style.width = (bid === 'b10' ? newSize + 20 : newSize) + 'px';
|
| 1855 |
+
thumb.style.height = (bid === 'merchantCamp' ? Math.round(newSize * 0.75) : newSize) + 'px';
|
| 1856 |
}
|
| 1857 |
const tagNum = $(`#mapNode_${bid} .map-editor-tag small`);
|
| 1858 |
if (tagNum) tagNum.textContent = `(${newSize}px)`;
|
|
|
|
| 1920 |
const thumb = $('.map-editor-thumb', node);
|
| 1921 |
if (thumb) {
|
| 1922 |
thumb.style.width = (selectedMapTownId === 'b10' ? cur.size + 20 : cur.size) + 'px';
|
| 1923 |
+
thumb.style.height = (selectedMapTownId === 'merchantCamp' ? Math.round(cur.size * 0.75) : cur.size) + 'px';
|
| 1924 |
}
|
| 1925 |
const tagNum = $('.map-editor-tag small', node);
|
| 1926 |
if (tagNum) tagNum.textContent = `(${cur.size}px)`;
|
|
|
|
| 1967 |
txt.value = JSON.stringify(out, null, 2);
|
| 1968 |
}
|
| 1969 |
|
| 1970 |
+
async function saveMapLayout() {
|
| 1971 |
+
const btn = $('#btnSaveMapLayout');
|
| 1972 |
+
withLoading(btn, async () => {
|
| 1973 |
+
try {
|
| 1974 |
+
localStorage.setItem('idle_custom_map_layout', JSON.stringify(mapLayoutData));
|
| 1975 |
+
if (db && currentClassCode) {
|
| 1976 |
+
await db.updateClass(currentClassCode, { mapLayout: mapLayoutData });
|
| 1977 |
+
const curCls = classes.find(c => c.code === currentClassCode);
|
| 1978 |
+
if (curCls) curCls.mapLayout = { ...mapLayoutData };
|
| 1979 |
+
}
|
| 1980 |
+
toast('🎉 成功儲存並發布地圖佈局!前台學生大地圖即刻同步生效。', 'success');
|
| 1981 |
+
} catch (e) {
|
| 1982 |
+
toast('儲存失敗:' + (e.message || e), 'error');
|
| 1983 |
+
}
|
| 1984 |
+
});
|
| 1985 |
}
|
| 1986 |
|
| 1987 |
function copyMapJson() {
|
|
|
|
| 2023 |
}
|
| 2024 |
}
|
| 2025 |
|
| 2026 |
+
async function resetMapLayout() {
|
| 2027 |
if (!confirm('確定要清除自訂微調,重設回官方標準預設座標嗎?')) return;
|
| 2028 |
localStorage.removeItem('idle_custom_map_layout');
|
| 2029 |
mapLayoutData = {};
|
| 2030 |
MAP_TOWNS_DEF.forEach(t => {
|
| 2031 |
mapLayoutData[t.id] = { x: t.defX, y: t.defY, size: t.defSize, name: t.name };
|
| 2032 |
});
|
| 2033 |
+
if (db && currentClassCode) {
|
| 2034 |
+
try {
|
| 2035 |
+
await db.updateClass(currentClassCode, { mapLayout: null });
|
| 2036 |
+
const curCls = classes.find(c => c.code === currentClassCode);
|
| 2037 |
+
if (curCls) delete curCls.mapLayout;
|
| 2038 |
+
} catch (e) { console.warn('雲端佈局重設失敗', e); }
|
| 2039 |
+
}
|
| 2040 |
renderMapEditor();
|
| 2041 |
toast('🔄 已重設回官方標準預設佈局', 'info');
|
| 2042 |
}
|
js/config.js
CHANGED
|
@@ -269,8 +269,8 @@ export const CLASS_STAGE_BONUS = 0.10;
|
|
| 269 |
// ---------- 世界 Boss 實裝開放日程與上古四凶圖鑑 ----------
|
| 270 |
// 第三單元提前至 10/23 開放,世界 Boss【上古・饕餮】延後至 10/27(二) 正式破印開放
|
| 271 |
export const WORLD_BOSS_UNLOCK_DATE = '2026-10-27';
|
| 272 |
-
// 世界 Boss 活動
|
| 273 |
-
export const WORLD_BOSS_END_DATE =
|
| 274 |
|
| 275 |
export const WORLD_BOSS_ROSTER = {
|
| 276 |
taotie: {
|
|
|
|
| 269 |
// ---------- 世界 Boss 實裝開放日程與上古四凶圖鑑 ----------
|
| 270 |
// 第三單元提前至 10/23 開放,世界 Boss【上古・饕餮】延後至 10/27(二) 正式破印開放
|
| 271 |
export const WORLD_BOSS_UNLOCK_DATE = '2026-10-27';
|
| 272 |
+
// 世界 Boss 第一期【上古・饕餮】活動結束日期(11/01 截止,到期後饕餮圖案自動自沙盤地圖上收起隱藏)
|
| 273 |
+
export const WORLD_BOSS_END_DATE = '2026-11-01';
|
| 274 |
|
| 275 |
export const WORLD_BOSS_ROSTER = {
|
| 276 |
taotie: {
|
js/engine.js
CHANGED
|
@@ -868,8 +868,11 @@ export function calcWorldBossStatus(classInfo, progress, game, today = todayStr(
|
|
| 868 |
const bossCfg = getActiveWorldBossConfig(classInfo);
|
| 869 |
const reqUnit = bossCfg.unlockUnit || 'u3';
|
| 870 |
const isPreviewMode = wb.phaseMode === 'preview';
|
| 871 |
-
const
|
| 872 |
-
|
|
|
|
|
|
|
|
|
|
| 873 |
const isReqPassed = (progress?.[reqUnit]?.best || 0) >= PASS_SCORE;
|
| 874 |
const unlocked = isUnlockedDate && !isExpired && isReqPassed;
|
| 875 |
|
|
@@ -897,6 +900,8 @@ export function calcWorldBossStatus(classInfo, progress, game, today = todayStr(
|
|
| 897 |
isU3Passed: isReqPassed,
|
| 898 |
unlocked,
|
| 899 |
isPreviewMode,
|
|
|
|
|
|
|
| 900 |
isUnlockedDate,
|
| 901 |
isExpired,
|
| 902 |
ordersLeft,
|
|
|
|
| 868 |
const bossCfg = getActiveWorldBossConfig(classInfo);
|
| 869 |
const reqUnit = bossCfg.unlockUnit || 'u3';
|
| 870 |
const isPreviewMode = wb.phaseMode === 'preview';
|
| 871 |
+
const isClosedMode = wb.phaseMode === 'closed' || wb.phaseMode === 'taotie_closed' || wb.hidden === true;
|
| 872 |
+
// 若為第一期饕餮,若手動關閉或非開放模式且日期已過截止日,則視為已圓滿收起(地圖不呈現圖標)
|
| 873 |
+
const isTaotieConcluded = (bossCfg.id === 'taotie') && (isClosedMode || (wb.phaseMode !== 'open' && today > (WORLD_BOSS_END_DATE || '2026-11-01')));
|
| 874 |
+
const isExpired = isClosedMode || (bossCfg.id === 'taotie' ? (isTaotieConcluded || !!(WORLD_BOSS_END_DATE && today > WORLD_BOSS_END_DATE)) : false);
|
| 875 |
+
const isUnlockedDate = isEventOpen('boss', classInfo, today) && !isPreviewMode && !isClosedMode && !isExpired;
|
| 876 |
const isReqPassed = (progress?.[reqUnit]?.best || 0) >= PASS_SCORE;
|
| 877 |
const unlocked = isUnlockedDate && !isExpired && isReqPassed;
|
| 878 |
|
|
|
|
| 900 |
isU3Passed: isReqPassed,
|
| 901 |
unlocked,
|
| 902 |
isPreviewMode,
|
| 903 |
+
isClosedMode,
|
| 904 |
+
isTaotieConcluded,
|
| 905 |
isUnlockedDate,
|
| 906 |
isExpired,
|
| 907 |
ordersLeft,
|
js/map.js
CHANGED
|
@@ -108,6 +108,13 @@ export function focusTownOnMap(bid, smooth = true) {
|
|
| 108 |
* 取得城池在地圖上的座標與尺寸(支援由校準編輯器產生的自訂佈局)
|
| 109 |
*/
|
| 110 |
export function getTownLayout(bid) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
try {
|
| 112 |
const saved = localStorage.getItem('idle_custom_map_layout');
|
| 113 |
if (saved) {
|
|
@@ -115,6 +122,8 @@ export function getTownLayout(bid) {
|
|
| 115 |
if (parsed[bid]) return parsed[bid];
|
| 116 |
}
|
| 117 |
} catch (e) {}
|
|
|
|
|
|
|
| 118 |
const def = MAP_POS[bid] || { x: 50, y: 50, size: 120 };
|
| 119 |
return { x: def.x, y: def.y, size: def.size || 120 };
|
| 120 |
}
|
|
@@ -222,11 +231,11 @@ export function renderMapSpots() {
|
|
| 222 |
</div>
|
| 223 |
`;
|
| 224 |
|
| 225 |
-
// 注入世界 Boss 入口(
|
| 226 |
const bossStatus = calcWorldBossStatus(classInfo, progress, game);
|
| 227 |
const bossCfg = getActiveWorldBossConfig(classInfo);
|
| 228 |
let bossHtml = '';
|
| 229 |
-
if (!bossStatus.isExpired) {
|
| 230 |
const bossLayout = getTownLayout('boss');
|
| 231 |
const isBossUnlocked = bossStatus.unlocked;
|
| 232 |
const bossCls = isBossUnlocked ? 'boss-open' : 'boss-sealed';
|
|
@@ -404,6 +413,11 @@ export function openWorldBossModal() {
|
|
| 404 |
const bossCfg = getActiveWorldBossConfig(classInfo);
|
| 405 |
const rew = calcWorldBossRewards(progress, game, classInfo, false);
|
| 406 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 407 |
if (!status.unlocked) {
|
| 408 |
// 尚未破印(或處於預告剪影模式):展示神秘剪影情報與戰備預告(比照饕餮預告方式)
|
| 409 |
const annId = bossCfg.id === 'qiongqi' ? 'update_20261105_qiongqi' : 'update_20261027_worldboss';
|
|
|
|
| 108 |
* 取得城池在地圖上的座標與尺寸(支援由校準編輯器產生的自訂佈局)
|
| 109 |
*/
|
| 110 |
export function getTownLayout(bid) {
|
| 111 |
+
// 1. 優先採用班級雲端最新發布之佈局(教師後台儲存發布後,全班學生即時同動)
|
| 112 |
+
try {
|
| 113 |
+
const classLayout = mapCtx?.getClassInfo()?.mapLayout;
|
| 114 |
+
if (classLayout && classLayout[bid]) return classLayout[bid];
|
| 115 |
+
} catch (e) {}
|
| 116 |
+
|
| 117 |
+
// 2. 次之採用本機自訂快取(教師本地預覽或校準)
|
| 118 |
try {
|
| 119 |
const saved = localStorage.getItem('idle_custom_map_layout');
|
| 120 |
if (saved) {
|
|
|
|
| 122 |
if (parsed[bid]) return parsed[bid];
|
| 123 |
}
|
| 124 |
} catch (e) {}
|
| 125 |
+
|
| 126 |
+
// 3. 官方標準預設座標
|
| 127 |
const def = MAP_POS[bid] || { x: 50, y: 50, size: 120 };
|
| 128 |
return { x: def.x, y: def.y, size: def.size || 120 };
|
| 129 |
}
|
|
|
|
| 231 |
</div>
|
| 232 |
`;
|
| 233 |
|
| 234 |
+
// 注入世界 Boss 入口(若活動過期、已圓滿結束收起或非開放模式之饕餮,則大地圖收起不呈現圖案)
|
| 235 |
const bossStatus = calcWorldBossStatus(classInfo, progress, game);
|
| 236 |
const bossCfg = getActiveWorldBossConfig(classInfo);
|
| 237 |
let bossHtml = '';
|
| 238 |
+
if (!bossStatus.isExpired && !bossStatus.isClosedMode && !bossStatus.isTaotieConcluded) {
|
| 239 |
const bossLayout = getTownLayout('boss');
|
| 240 |
const isBossUnlocked = bossStatus.unlocked;
|
| 241 |
const bossCls = isBossUnlocked ? 'boss-open' : 'boss-sealed';
|
|
|
|
| 413 |
const bossCfg = getActiveWorldBossConfig(classInfo);
|
| 414 |
const rew = calcWorldBossRewards(progress, game, classInfo, false);
|
| 415 |
|
| 416 |
+
if (status.isExpired || status.isClosedMode || status.isTaotieConcluded) {
|
| 417 |
+
toast('🏛️ 當前世界 Boss 活動已圓滿平定封印!下一期神獸即將現身,敬請期待。', 'info');
|
| 418 |
+
return;
|
| 419 |
+
}
|
| 420 |
+
|
| 421 |
if (!status.unlocked) {
|
| 422 |
// 尚未破印(或處於預告剪影模式):展示神秘剪影情報與戰備預告(比照饕餮預告方式)
|
| 423 |
const annId = bossCfg.id === 'qiongqi' ? 'update_20261105_qiongqi' : 'update_20261027_worldboss';
|
teacher.html
CHANGED
|
@@ -357,6 +357,7 @@
|
|
| 357 |
</div>
|
| 358 |
<div style="display:flex; gap:10px; flex-wrap:wrap; align-items:center;">
|
| 359 |
<select id="selAdminBossPhase" class="input" style="font-size:13px; font-weight:700; padding:6px 10px; min-width:260px;">
|
|
|
|
| 360 |
<option value="taotie_open">🐲 第一期【上古・饕餮】— 討伐開放中</option>
|
| 361 |
<option value="qiongqi_preview">🔒 第二期【上古・窮奇】— 開啟神秘剪影預告</option>
|
| 362 |
<option value="qiongqi_open">⚡ 第二期【上古・窮奇】— 正式破印開放討伐</option>
|
|
@@ -767,7 +768,7 @@
|
|
| 767 |
<div id="paneMapEditor" class="pane hidden">
|
| 768 |
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; flex-wrap:wrap; gap:12px;">
|
| 769 |
<div>
|
| 770 |
-
<h2 style="margin:0;">🗺️ 九州名都沙盤・城池
|
| 771 |
<p class="dim" style="margin:4px 0 0; font-size:13px;">
|
| 772 |
直接按住城池拖曳位置,或拉動右下角把手調整大小!調校後點擊「儲存發布」,前台學生大地圖即刻同步生效。
|
| 773 |
</p>
|
|
@@ -793,7 +794,7 @@
|
|
| 793 |
<!-- 右側微調與導航控制台 -->
|
| 794 |
<div class="map-editor-panel">
|
| 795 |
<div style="padding-bottom:12px; border-bottom:1px solid var(--card-border);">
|
| 796 |
-
<span style="font-size:12px; font-weight:700; color:var(--text-dim);">目前選取之
|
| 797 |
<div style="display:flex; align-items:center; gap:8px; margin-top:4px;">
|
| 798 |
<span style="font-size:24px;" id="lblSelectedIcon">🏺</span>
|
| 799 |
<div>
|
|
@@ -832,7 +833,7 @@
|
|
| 832 |
|
| 833 |
<!-- 城池切換快速按鈕列表 -->
|
| 834 |
<div style="flex:1; display:flex; flex-direction:column; min-height:160px;">
|
| 835 |
-
<span style="font-size:12px; font-weight:700; color:var(--text-dim); margin-bottom:6px;">全城池
|
| 836 |
<div id="quickTownList" style="flex:1; overflow-y:auto; max-height:220px; padding-right:4px;"></div>
|
| 837 |
</div>
|
| 838 |
|
|
|
|
| 357 |
</div>
|
| 358 |
<div style="display:flex; gap:10px; flex-wrap:wrap; align-items:center;">
|
| 359 |
<select id="selAdminBossPhase" class="input" style="font-size:13px; font-weight:700; padding:6px 10px; min-width:260px;">
|
| 360 |
+
<option value="taotie_closed">💤 第一期【上古・饕餮】— 活動已圓滿結束(地圖收起圖案)</option>
|
| 361 |
<option value="taotie_open">🐲 第一期【上古・饕餮】— 討伐開放中</option>
|
| 362 |
<option value="qiongqi_preview">🔒 第二期【上古・窮奇】— 開啟神秘剪影預告</option>
|
| 363 |
<option value="qiongqi_open">⚡ 第二期【上古・窮奇】— 正式破印開放討伐</option>
|
|
|
|
| 768 |
<div id="paneMapEditor" class="pane hidden">
|
| 769 |
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; flex-wrap:wrap; gap:12px;">
|
| 770 |
<div>
|
| 771 |
+
<h2 style="margin:0;">🗺️ 九州名都沙盤・城池、天機閣與西域商隊視覺校準器</h2>
|
| 772 |
<p class="dim" style="margin:4px 0 0; font-size:13px;">
|
| 773 |
直接按住城池拖曳位置,或拉動右下角把手調整大小!調校後點擊「儲存發布」,前台學生大地圖即刻同步生效。
|
| 774 |
</p>
|
|
|
|
| 794 |
<!-- 右側微調與導航控制台 -->
|
| 795 |
<div class="map-editor-panel">
|
| 796 |
<div style="padding-bottom:12px; border-bottom:1px solid var(--card-border);">
|
| 797 |
+
<span style="font-size:12px; font-weight:700; color:var(--text-dim);">目前選取之標記點位</span>
|
| 798 |
<div style="display:flex; align-items:center; gap:8px; margin-top:4px;">
|
| 799 |
<span style="font-size:24px;" id="lblSelectedIcon">🏺</span>
|
| 800 |
<div>
|
|
|
|
| 833 |
|
| 834 |
<!-- 城池切換快速按鈕列表 -->
|
| 835 |
<div style="flex:1; display:flex; flex-direction:column; min-height:160px;">
|
| 836 |
+
<span style="font-size:12px; font-weight:700; color:var(--text-dim); margin-bottom:6px;">全城池、天機閣與西域商隊列表 (點擊選取)</span>
|
| 837 |
<div id="quickTownList" style="flex:1; overflow-y:auto; max-height:220px; padding-right:4px;"></div>
|
| 838 |
</div>
|
| 839 |
|
tools/map-editor.html
CHANGED
|
@@ -309,17 +309,19 @@
|
|
| 309 |
<script>
|
| 310 |
// 預設 10 大城鎮初始資料
|
| 311 |
const TOWNS_DEF = [
|
| 312 |
-
{ id: 'b1',
|
| 313 |
-
{ id: 'b9',
|
| 314 |
-
{ id: 'b2',
|
| 315 |
-
{ id: 'b4',
|
| 316 |
-
{ id: 'b7',
|
| 317 |
-
{ id: 'b3',
|
| 318 |
-
{ id: 'b5',
|
| 319 |
-
{ id: 'b6',
|
| 320 |
-
{ id: 'b8',
|
| 321 |
-
{ id: 'b10',
|
| 322 |
-
{ id: 'tianji',
|
|
|
|
|
|
|
| 323 |
];
|
| 324 |
|
| 325 |
// 當前工作狀態
|
|
@@ -360,6 +362,18 @@
|
|
| 360 |
<div class="capital-box" style="width:${item.size + 20}px; height:${item.size}px;">
|
| 361 |
<span style="font-size:24px; filter:drop-shadow(0 2px 6px rgba(0,0,0,0.7));">👑</span>
|
| 362 |
</div>`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 363 |
} else {
|
| 364 |
innerContent = `
|
| 365 |
<div class="town-thumb-box" style="width:${item.size}px; height:${item.size}px;">
|
|
@@ -451,7 +465,7 @@
|
|
| 451 |
const thumb = document.querySelector(`#node_${bid} .town-thumb-box`);
|
| 452 |
if (thumb) {
|
| 453 |
thumb.style.width = newSize + 'px';
|
| 454 |
-
thumb.style.height = newSize + 'px';
|
| 455 |
}
|
| 456 |
updateSidebarInputs();
|
| 457 |
updateJsonOutput();
|
|
@@ -574,7 +588,7 @@
|
|
| 574 |
const thumb = document.querySelector(`#node_${selectedId} .town-thumb-box`);
|
| 575 |
if (thumb) {
|
| 576 |
thumb.style.width = layoutData[selectedId].size + 'px';
|
| 577 |
-
thumb.style.height = layoutData[selectedId].size + 'px';
|
| 578 |
}
|
| 579 |
updateJsonOutput();
|
| 580 |
});
|
|
|
|
| 309 |
<script>
|
| 310 |
// 預設 10 大城鎮初始資料
|
| 311 |
const TOWNS_DEF = [
|
| 312 |
+
{ id: 'b1', name: '景陽瓷都', icon: '🏺', defX: 27.8, defY: 70.7, defSize: 166 },
|
| 313 |
+
{ id: 'b9', name: '柴桑水寨', icon: '⚓', defX: 18.1, defY: 62.1, defSize: 174 },
|
| 314 |
+
{ id: 'b2', name: '平原稻鄉', icon: '🌾', defX: 37.7, defY: 78.9, defSize: 167 },
|
| 315 |
+
{ id: 'b4', name: '百草藥谷', icon: '🌿', defX: 62.1, defY: 79.0, defSize: 174 },
|
| 316 |
+
{ id: 'b7', name: '塞外天馬', icon: '🐎', defX: 71.8, defY: 70.6, defSize: 171 },
|
| 317 |
+
{ id: 'b3', name: '神兵鐵城', icon: '⚔️', defX: 50.5, defY: 48.5, defSize: 169 },
|
| 318 |
+
{ id: 'b5', name: '蜀錦絲城', icon: '👘', defX: 59.9, defY: 42.2, defSize: 173 },
|
| 319 |
+
{ id: 'b6', name: '崑崙玉塞', icon: '⛏️', defX: 81.6, defY: 62.2, defSize: 172 },
|
| 320 |
+
{ id: 'b8', name: '軍機策府', icon: '🏫', defX: 67.5, defY: 34.7, defSize: 172 },
|
| 321 |
+
{ id: 'b10', name: '霸業王城', icon: '🏰', defX: 52.0, defY: 22.0, defSize: 140 },
|
| 322 |
+
{ id: 'tianji', name: '天機閣', icon: '🏯', defX: 34.5, defY: 29.7, defSize: 154 },
|
| 323 |
+
{ id: 'merchantCamp', name: '西域商隊', icon: '🎪', defX: 44.2, defY: 46.8, defSize: 145 },
|
| 324 |
+
{ id: 'boss', name: '世界Boss', icon: '🐲', defX: 81.5, defY: 22.0, defSize: 168 },
|
| 325 |
];
|
| 326 |
|
| 327 |
// 當前工作狀態
|
|
|
|
| 362 |
<div class="capital-box" style="width:${item.size + 20}px; height:${item.size}px;">
|
| 363 |
<span style="font-size:24px; filter:drop-shadow(0 2px 6px rgba(0,0,0,0.7));">👑</span>
|
| 364 |
</div>`;
|
| 365 |
+
} else if (t.id === 'boss') {
|
| 366 |
+
innerContent = `
|
| 367 |
+
<div class="town-thumb-box" style="width:${item.size}px; height:${item.size}px; background:radial-gradient(circle, rgba(239,68,68,0.25) 0%, transparent 70%);">
|
| 368 |
+
<img src="../assets/boss_taotie.png" class="town-img" alt="${t.name}" onerror="this.src='../assets/boss_qiongqi.png'">
|
| 369 |
+
<div class="resize-handle" data-bid="${t.id}" title="拖動調整大小"></div>
|
| 370 |
+
</div>`;
|
| 371 |
+
} else if (t.id === 'merchantCamp') {
|
| 372 |
+
innerContent = `
|
| 373 |
+
<div class="town-thumb-box" style="width:${item.size}px; height:${Math.round(item.size * 0.75)}px; background:radial-gradient(circle, rgba(245,158,11,0.2) 0%, transparent 70%);">
|
| 374 |
+
<img src="../assets/merchant_tent.png" class="town-img" alt="${t.name}" style="object-fit:contain;">
|
| 375 |
+
<div class="resize-handle" data-bid="${t.id}" title="拖動調整大小"></div>
|
| 376 |
+
</div>`;
|
| 377 |
} else {
|
| 378 |
innerContent = `
|
| 379 |
<div class="town-thumb-box" style="width:${item.size}px; height:${item.size}px;">
|
|
|
|
| 465 |
const thumb = document.querySelector(`#node_${bid} .town-thumb-box`);
|
| 466 |
if (thumb) {
|
| 467 |
thumb.style.width = newSize + 'px';
|
| 468 |
+
thumb.style.height = (bid === 'merchantCamp' ? Math.round(newSize * 0.75) : newSize) + 'px';
|
| 469 |
}
|
| 470 |
updateSidebarInputs();
|
| 471 |
updateJsonOutput();
|
|
|
|
| 588 |
const thumb = document.querySelector(`#node_${selectedId} .town-thumb-box`);
|
| 589 |
if (thumb) {
|
| 590 |
thumb.style.width = layoutData[selectedId].size + 'px';
|
| 591 |
+
thumb.style.height = (selectedId === 'merchantCamp' ? Math.round(layoutData[selectedId].size * 0.75) : layoutData[selectedId].size) + 'px';
|
| 592 |
}
|
| 593 |
updateJsonOutput();
|
| 594 |
});
|