Upload 1602 files
Browse files- css/base.css +3 -1
- css/game.css +284 -118
- docs/map-conquest-design.md +3 -3
- index.html +60 -66
- js/admin.js +234 -4
- js/config.js +14 -15
- js/db.js +51 -0
- js/engine.js +3 -6
- js/game.js +393 -180
- teacher.html +5 -3
- tools/alpha-reset.js +142 -0
css/base.css
CHANGED
|
@@ -54,7 +54,9 @@ html[data-theme="dark"] {
|
|
| 54 |
}
|
| 55 |
html, body {
|
| 56 |
margin: 0; padding: 0;
|
| 57 |
-
|
|
|
|
|
|
|
| 58 |
-webkit-overflow-scrolling: touch;
|
| 59 |
}
|
| 60 |
body {
|
|
|
|
| 54 |
}
|
| 55 |
html, body {
|
| 56 |
margin: 0; padding: 0;
|
| 57 |
+
overflow-x: hidden;
|
| 58 |
+
max-width: 100vw;
|
| 59 |
+
overscroll-behavior-y: none;
|
| 60 |
-webkit-overflow-scrolling: touch;
|
| 61 |
}
|
| 62 |
body {
|
css/game.css
CHANGED
|
@@ -45,39 +45,40 @@ html[data-theme="dark"] .topbar { background: rgba(11, 15, 26, .95); box-shadow:
|
|
| 45 |
/* 戰略沙盤大地圖(超大可拖曳世界地圖) */
|
| 46 |
.map-card { position: relative; padding: 14px 16px; margin-bottom: 18px; border-color: rgba(217,119,6,.28); background: var(--bg-1); }
|
| 47 |
html[data-theme="dark"] .map-card { background: linear-gradient(180deg, rgba(23,32,54,.94), rgba(15,22,39,.98)); border-color: rgba(245,196,81,.3); }
|
| 48 |
-
.map-header { justify-content: space-between; align-items: center; margin-bottom:
|
| 49 |
-
.map-title-box { display: flex;
|
| 50 |
-
.map-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
.map-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
|
| 52 |
-
.map-nav-btns { display: flex; gap: 6px; }
|
| 53 |
|
| 54 |
.territory-map-wrap {
|
| 55 |
-
position: relative; width: 100%; border-radius: 18px; overflow:
|
| 56 |
box-shadow: 0 16px 40px -10px rgba(70,40,25,.35), inset 0 0 0 1px rgba(180,130,100,.2);
|
| 57 |
-
height:
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
touch-action: none !important;
|
| 61 |
-webkit-overflow-scrolling: touch;
|
| 62 |
}
|
| 63 |
-
.territory-map-wrap.dragging {
|
| 64 |
-
.territory-map-wrap::-webkit-scrollbar { width: 8px; height: 8px; }
|
| 65 |
-
.territory-map-wrap::-webkit-scrollbar-thumb { background: rgba(217,119,6,0.5); border-radius: 99px; }
|
| 66 |
|
| 67 |
.map-drag-hint {
|
| 68 |
-
|
| 69 |
-
background: rgba(0, 0, 0, 0.65); color: #fff; padding: 4px 12px; border-radius: 99px;
|
| 70 |
-
font-size: 11px; font-weight: 700; backdrop-filter: blur(8px);
|
| 71 |
-
border: 1px solid rgba(255,255,255,0.25); box-shadow: 0 4px 12px rgba(0,0,0,0.2);
|
| 72 |
-
transition: opacity 0.5s ease;
|
| 73 |
}
|
| 74 |
-
.map-drag-hint.fadeout { opacity: 0; }
|
| 75 |
|
| 76 |
.territory-map {
|
| 77 |
-
position: relative; width:
|
| 78 |
-
|
| 79 |
}
|
| 80 |
-
.map-bg { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(1.06) contrast(1.02); }
|
| 81 |
|
| 82 |
/* 戰略連線 SVG 畫布(依使用者需求隱藏連線,呈現純淨沙盤山水) */
|
| 83 |
.map-routes-svg { display: none; }
|
|
@@ -187,44 +188,59 @@ html[data-theme="dark"] .map-spot.ready .spot-label { color: #fcd34d; border-col
|
|
| 187 |
animation: flagWave 2s infinite ease-in-out alternate;
|
| 188 |
}
|
| 189 |
|
| 190 |
-
/* 地圖內置:城池戰略指令面板(In-Map Town Panel) */
|
| 191 |
.inmap-town-panel {
|
| 192 |
-
position: absolute;
|
| 193 |
z-index: 60; background: rgba(255, 255, 255, 0.96);
|
| 194 |
-
backdrop-filter: blur(
|
| 195 |
-
border-radius:
|
| 196 |
-
padding:
|
| 197 |
-
animation:
|
|
|
|
| 198 |
}
|
| 199 |
html[data-theme="dark"] .inmap-town-panel {
|
| 200 |
-
background: rgba(18, 25, 42, 0.96); border-color: rgba(245,196,81, 0.
|
| 201 |
-
box-shadow: 0
|
| 202 |
}
|
| 203 |
-
@keyframes
|
| 204 |
-
from { opacity: 0; transform:
|
| 205 |
-
to { opacity: 1; transform:
|
| 206 |
}
|
| 207 |
|
| 208 |
-
|
| 209 |
-
.
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 213 |
.panel-close-btn {
|
| 214 |
-
background: transparent; border: 0; font-size:
|
| 215 |
-
width:
|
| 216 |
-
transition: all .2s;
|
| 217 |
}
|
| 218 |
.panel-close-btn:hover { background: var(--bg-2); color: var(--text); transform: scale(1.1); }
|
| 219 |
|
| 220 |
.panel-prod-stat {
|
| 221 |
-
background: var(--bg-2); border-radius:
|
| 222 |
-
display: flex; justify-content: space-between; align-items: center; font-size:
|
| 223 |
}
|
| 224 |
-
.panel-prod-val { font-size:
|
| 225 |
|
| 226 |
-
.panel-actions { display: flex; gap:
|
| 227 |
-
.panel-actions .btn { flex: 1; padding:
|
| 228 |
|
| 229 |
.map-footer-row {
|
| 230 |
display: flex; justify-content: space-between; align-items: center;
|
|
@@ -241,32 +257,42 @@ html[data-theme="dark"] .inmap-town-panel {
|
|
| 241 |
.tab .dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--rose); box-shadow: 0 0 8px var(--rose); }
|
| 242 |
.tab .count { font-style: normal; font-size: 11px; background: var(--rose); color: #fff; border-radius: 99px; padding: 0 7px; line-height: 18px; }
|
| 243 |
|
| 244 |
-
.main { max-width: 1400px; margin: 0 auto; padding: 16px 20px 100px; }
|
| 245 |
.pane-title { margin: 0; font-size: 18px; color: var(--text); }
|
| 246 |
-
.pane { animation: fadeUp .25s ease; }
|
| 247 |
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
|
| 248 |
|
| 249 |
-
/*
|
| 250 |
-
.
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
position: relative; overflow: hidden;
|
| 254 |
display: flex; flex-direction: column; align-items: center; justify-content: center;
|
| 255 |
-
padding:
|
| 256 |
-
background:
|
| 257 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 258 |
}
|
|
|
|
| 259 |
.work-btn {
|
| 260 |
-
width:
|
|
|
|
| 261 |
aspect-ratio: 1 / 1; flex-shrink: 0; border-radius: 50%; border: 0; cursor: pointer; color: #382000;
|
| 262 |
background: radial-gradient(circle at 35% 30%, #fff7df 0%, #f7dc88 45%, #dfb84a 80%, #c99c2d 100%);
|
| 263 |
box-shadow:
|
| 264 |
-
0 0 0
|
| 265 |
-
0 0 0
|
| 266 |
-
0
|
| 267 |
-
inset 0 -
|
| 268 |
-
inset 0
|
| 269 |
-
display: flex; flex-direction: column; align-items: center; justify-content: center; gap:
|
| 270 |
transition: transform .12s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
|
| 271 |
-webkit-tap-highlight-color: transparent;
|
| 272 |
touch-action: manipulation;
|
|
@@ -294,22 +320,22 @@ html[data-theme="dark"] .inmap-town-panel {
|
|
| 294 |
}
|
| 295 |
.work-btn.disabled:hover { transform: none; box-shadow: 0 4px 14px rgba(0,0,0,.12); }
|
| 296 |
.work-limit-badge {
|
| 297 |
-
margin-top:
|
| 298 |
background: var(--bg-2); border: 1.5px solid rgba(180,130,100,.25);
|
| 299 |
-
font-size:
|
| 300 |
-
display: inline-flex; align-items: center; justify-content: center; gap:
|
| 301 |
box-shadow: 0 2px 8px rgba(120,70,50,.06); transition: all .2s ease;
|
| 302 |
white-space: nowrap; max-width: 100%;
|
| 303 |
}
|
| 304 |
-
.work-limit-badge b { color: #b45309; font-size:
|
| 305 |
.work-limit-badge.warn {
|
| 306 |
color: var(--rose); border-color: rgba(239,90,86,.45);
|
| 307 |
background: rgba(239,90,86,.08);
|
| 308 |
}
|
| 309 |
.work-limit-badge.warn b { color: var(--rose); }
|
| 310 |
-
.work-
|
| 311 |
-
.work-label { font-weight: 900; font-size:
|
| 312 |
-
.work-val { font-weight: 800; font-size:
|
| 313 |
.float-layer { position: absolute; inset: 0; pointer-events: none; }
|
| 314 |
.float-num { position: absolute; font-weight: 900; color: #ef5a56; text-shadow: 0 1px 4px rgba(255,255,255,.9); animation: floatUp .9s ease-out forwards; }
|
| 315 |
html[data-theme="dark"] .float-num { text-shadow: 0 2px 8px rgba(0,0,0,.6); }
|
|
@@ -547,51 +573,16 @@ html[data-theme="dark"] .r-card { background: var(--bg-2); }
|
|
| 547 |
|
| 548 |
/* ---------- 跨平台自適應排版(電腦版、iPad 9 平板、手機) ---------- */
|
| 549 |
|
| 550 |
-
/* 1. iPad 9 橫向與中型筆電 (901px ~ 1199px
|
| 551 |
@media (min-width: 901px) and (max-width: 1199px) {
|
| 552 |
.main { max-width: 100%; padding: 12px 14px 80px; }
|
| 553 |
-
.
|
| 554 |
-
.side { width: 240px; top: 120px; gap: 10px; }
|
| 555 |
-
.work-card { padding: 16px 12px 12px; }
|
| 556 |
-
.work-btn {
|
| 557 |
-
width: 148px; height: 148px; min-width: 148px; min-height: 148px;
|
| 558 |
-
}
|
| 559 |
-
.work-thumb { width: 56px; height: 56px; }
|
| 560 |
-
.work-label { font-size: 16px; }
|
| 561 |
-
.work-val { font-size: 12px; }
|
| 562 |
-
.work-limit-badge { margin-top: 10px; padding: 4px 12px; font-size: 12px; }
|
| 563 |
-
.territory-map-wrap {
|
| 564 |
-
height: clamp(440px, calc(100vh - 210px), 520px);
|
| 565 |
-
min-height: 420px;
|
| 566 |
-
}
|
| 567 |
-
.inmap-town-panel { top: 72px; bottom: auto; right: 18px; width: 320px; padding: 14px; }
|
| 568 |
}
|
| 569 |
|
| 570 |
-
/* 2. iPad 9 直向與小平板 (641px ~ 900px
|
| 571 |
@media (min-width: 641px) and (max-width: 900px) {
|
| 572 |
.main { padding: 14px 14px 90px; }
|
| 573 |
-
.
|
| 574 |
-
.side {
|
| 575 |
-
width: 100%; position: static;
|
| 576 |
-
display: grid; grid-template-columns: 240px 1fr; gap: 12px;
|
| 577 |
-
}
|
| 578 |
-
.side > .card:nth-child(2) { display: flex; flex-direction: column; justify-content: center; }
|
| 579 |
-
.side > .hint-card { grid-column: span 2; }
|
| 580 |
-
.work-card { padding: 16px 12px 12px; }
|
| 581 |
-
.work-btn {
|
| 582 |
-
width: 140px; height: 140px; min-width: 140px; min-height: 140px;
|
| 583 |
-
}
|
| 584 |
-
.work-thumb { width: 52px; height: 52px; }
|
| 585 |
-
.work-label { font-size: 15px; }
|
| 586 |
-
.work-limit-badge { margin-top: 8px; font-size: 11px; padding: 4px 10px; }
|
| 587 |
-
.territory-map-wrap {
|
| 588 |
-
height: clamp(480px, calc(100vh - 420px), 620px);
|
| 589 |
-
min-height: 440px;
|
| 590 |
-
}
|
| 591 |
-
.inmap-town-panel {
|
| 592 |
-
right: 14px; left: 14px; bottom: 24px; width: auto; max-width: none;
|
| 593 |
-
padding: 14px 16px;
|
| 594 |
-
}
|
| 595 |
.class-layout { grid-template-columns: 1fr; }
|
| 596 |
}
|
| 597 |
|
|
@@ -603,6 +594,8 @@ html[data-theme="dark"] .r-card { background: var(--bg-2); }
|
|
| 603 |
.res-val { font-size: 16px; }
|
| 604 |
.res-mult { display: none; }
|
| 605 |
.user-box .mute { display: none; }
|
|
|
|
|
|
|
| 606 |
.tabs {
|
| 607 |
position: fixed; bottom: 0; left: 0; right: 0; z-index: 45; padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
|
| 608 |
background: var(--bg-1); border-top: 1px solid var(--line); justify-content: space-around; gap: 4px;
|
|
@@ -612,16 +605,21 @@ html[data-theme="dark"] .r-card { background: var(--bg-2); }
|
|
| 612 |
.tab { flex: 1; flex-direction: column; gap: 0; padding: 4px; min-height: 52px; font-size: 18px; border: 0; }
|
| 613 |
.tab span { font-size: 11px; }
|
| 614 |
.main { padding: 12px 10px 100px; }
|
| 615 |
-
.build-layout { flex-direction: column; }
|
| 616 |
-
.side { width: 100%; position: static; flex-direction: column; }
|
| 617 |
-
.work-card { padding:
|
| 618 |
-
.work-btn { width:
|
| 619 |
-
.work-emoji { font-size:
|
| 620 |
-
.work-thumb { width:
|
| 621 |
-
.work-label { font-size:
|
| 622 |
-
.work-limit-badge { margin-top:
|
| 623 |
-
.territory-map-wrap { height:
|
| 624 |
-
.inmap-town-panel {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 625 |
.b-list, .r-grid { grid-template-columns: 1fr; }
|
| 626 |
.class-hero { flex-direction: column; text-align: center; }
|
| 627 |
.qz-q { font-size: 16px; }
|
|
@@ -857,3 +855,171 @@ html[data-theme="dark"] .r-card { background: var(--bg-2); }
|
|
| 857 |
transform: translateY(0);
|
| 858 |
}
|
| 859 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
/* 戰略沙盤大地圖(超大可拖曳世界地圖) */
|
| 46 |
.map-card { position: relative; padding: 14px 16px; margin-bottom: 18px; border-color: rgba(217,119,6,.28); background: var(--bg-1); }
|
| 47 |
html[data-theme="dark"] .map-card { background: linear-gradient(180deg, rgba(23,32,54,.94), rgba(15,22,39,.98)); border-color: rgba(245,196,81,.3); }
|
| 48 |
+
.map-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 12px; }
|
| 49 |
+
.map-title-box { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
|
| 50 |
+
.map-legend-top {
|
| 51 |
+
display: inline-flex; align-items: center; gap: 14px;
|
| 52 |
+
background: var(--bg-2); padding: 5px 14px; border-radius: 99px;
|
| 53 |
+
border: 1px solid var(--line); font-size: 12px; font-weight: 700;
|
| 54 |
+
color: var(--text-dim);
|
| 55 |
+
}
|
| 56 |
+
.leg-item { display: inline-flex; align-items: center; gap: 5px; }
|
| 57 |
+
.leg-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
|
| 58 |
+
.leg-locked { background: #94a3b8; }
|
| 59 |
+
.leg-ready { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,.7); }
|
| 60 |
+
.leg-active { background: #10b981; }
|
| 61 |
.map-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
|
|
|
|
| 62 |
|
| 63 |
.territory-map-wrap {
|
| 64 |
+
position: relative; width: 100%; max-width: 100%; border-radius: 18px; overflow: hidden;
|
| 65 |
box-shadow: 0 16px 40px -10px rgba(70,40,25,.35), inset 0 0 0 1px rgba(180,130,100,.2);
|
| 66 |
+
height: auto; background: #faede1;
|
| 67 |
+
user-select: none;
|
| 68 |
+
touch-action: pan-y;
|
|
|
|
| 69 |
-webkit-overflow-scrolling: touch;
|
| 70 |
}
|
| 71 |
+
.territory-map-wrap.dragging { scroll-behavior: auto !important; }
|
|
|
|
|
|
|
| 72 |
|
| 73 |
.map-drag-hint {
|
| 74 |
+
display: none !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
}
|
|
|
|
| 76 |
|
| 77 |
.territory-map {
|
| 78 |
+
position: relative; width: 100%; min-width: 0; aspect-ratio: 16 / 9;
|
| 79 |
+
container-type: inline-size;
|
| 80 |
}
|
| 81 |
+
.map-bg { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(1.06) contrast(1.02); pointer-events: none; }
|
| 82 |
|
| 83 |
/* 戰略連線 SVG 畫布(依使用者需求隱藏連線,呈現純淨沙盤山水) */
|
| 84 |
.map-routes-svg { display: none; }
|
|
|
|
| 188 |
animation: flagWave 2s infinite ease-in-out alternate;
|
| 189 |
}
|
| 190 |
|
| 191 |
+
/* 地圖內置:城池戰略指令面板(In-Map Town Popover Panel 就近在城池旁顯示) */
|
| 192 |
.inmap-town-panel {
|
| 193 |
+
position: absolute; width: clamp(260px, 30cqw, 340px); max-width: calc(100% - 24px);
|
| 194 |
z-index: 60; background: rgba(255, 255, 255, 0.96);
|
| 195 |
+
backdrop-filter: blur(18px); border: 2px solid rgba(217,119,6, 0.7);
|
| 196 |
+
border-radius: 18px; box-shadow: 0 16px 40px -8px rgba(45,25,15, 0.38), 0 0 0 1px rgba(255,255,255,0.6) inset;
|
| 197 |
+
padding: 14px 16px; display: flex; flex-direction: column; gap: 10px;
|
| 198 |
+
animation: panelPopoverIn 0.22s cubic-bezier(.34,1.56,.64,1);
|
| 199 |
+
transform-origin: center center;
|
| 200 |
}
|
| 201 |
html[data-theme="dark"] .inmap-town-panel {
|
| 202 |
+
background: rgba(18, 25, 42, 0.96); border-color: rgba(245,196,81, 0.65);
|
| 203 |
+
box-shadow: 0 20px 48px rgba(0,0,0, 0.65), 0 0 0 1px rgba(255,255,255,0.08) inset;
|
| 204 |
}
|
| 205 |
+
@keyframes panelPopoverIn {
|
| 206 |
+
from { opacity: 0; transform: scale(0.92) translateY(6px); }
|
| 207 |
+
to { opacity: 1; transform: scale(1) translateY(0); }
|
| 208 |
}
|
| 209 |
|
| 210 |
+
/* Popover 三角形指向指針 */
|
| 211 |
+
.inmap-town-panel::before {
|
| 212 |
+
content: ''; position: absolute; width: 0; height: 0;
|
| 213 |
+
border-top: 8px solid transparent; border-bottom: 8px solid transparent;
|
| 214 |
+
}
|
| 215 |
+
.inmap-town-panel.arrow-top::before { top: 28px; bottom: auto; }
|
| 216 |
+
.inmap-town-panel.arrow-bottom::before { bottom: 28px; top: auto; }
|
| 217 |
+
.inmap-town-panel.panel-on-right::before {
|
| 218 |
+
left: -9px; border-right: 9px solid rgba(217,119,6, 0.9);
|
| 219 |
+
}
|
| 220 |
+
.inmap-town-panel.panel-on-left::before {
|
| 221 |
+
right: -9px; border-left: 9px solid rgba(217,119,6, 0.9);
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
|
| 225 |
+
.panel-town-info { display: flex; align-items: center; gap: 10px; }
|
| 226 |
+
.panel-town-thumb { width: 50px; height: 50px; object-fit: contain; filter: drop-shadow(0 4px 8px rgba(0,0,0,.25)); flex-shrink: 0; }
|
| 227 |
+
.panel-town-title { margin: 0; font-size: 16px; font-weight: 800; color: var(--text); display: flex; align-items: center; gap: 6px; }
|
| 228 |
+
.panel-specialty { font-size: 11px; color: var(--gold); font-weight: 700; }
|
| 229 |
.panel-close-btn {
|
| 230 |
+
background: transparent; border: 0; font-size: 16px; cursor: pointer; color: var(--text-dim);
|
| 231 |
+
width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
|
| 232 |
+
transition: all .2s; flex-shrink: 0;
|
| 233 |
}
|
| 234 |
.panel-close-btn:hover { background: var(--bg-2); color: var(--text); transform: scale(1.1); }
|
| 235 |
|
| 236 |
.panel-prod-stat {
|
| 237 |
+
background: var(--bg-2); border-radius: 10px; padding: 8px 12px;
|
| 238 |
+
display: flex; justify-content: space-between; align-items: center; font-size: 12px;
|
| 239 |
}
|
| 240 |
+
.panel-prod-val { font-size: 14px; font-weight: 800; color: var(--gold); }
|
| 241 |
|
| 242 |
+
.panel-actions { display: flex; gap: 8px; }
|
| 243 |
+
.panel-actions .btn { flex: 1; padding: 8px 10px; min-height: 44px; border-radius: 10px; }
|
| 244 |
|
| 245 |
.map-footer-row {
|
| 246 |
display: flex; justify-content: space-between; align-items: center;
|
|
|
|
| 257 |
.tab .dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--rose); box-shadow: 0 0 8px var(--rose); }
|
| 258 |
.tab .count { font-style: normal; font-size: 11px; background: var(--rose); color: #fff; border-radius: 99px; padding: 0 7px; line-height: 18px; }
|
| 259 |
|
| 260 |
+
.main { max-width: 1400px; margin: 0 auto; padding: 16px 20px 100px; overflow-x: hidden; width: 100%; }
|
| 261 |
.pane-title { margin: 0; font-size: 18px; color: var(--text); }
|
| 262 |
+
.pane { animation: fadeUp .25s ease; overflow-x: hidden; width: 100%; }
|
| 263 |
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
|
| 264 |
|
| 265 |
+
/* 領地沙盤左上角懸浮:巡營催糧軍令台(自然融入雲海天空,不佔用兩側佈局寬度) */
|
| 266 |
+
.work-overlay-card {
|
| 267 |
+
position: absolute; left: clamp(10px, 1.8cqw, 24px); top: clamp(10px, 1.8cqw, 24px);
|
| 268 |
+
z-index: 25; width: clamp(124px, 15cqw, 175px);
|
|
|
|
| 269 |
display: flex; flex-direction: column; align-items: center; justify-content: center;
|
| 270 |
+
padding: clamp(10px, 1.3cqw, 16px) clamp(8px, 1cqw, 14px);
|
| 271 |
+
background: rgba(255, 255, 255, 0.94);
|
| 272 |
+
backdrop-filter: blur(12px);
|
| 273 |
+
border: 1.5px solid rgba(217, 119, 6, 0.35);
|
| 274 |
+
border-radius: 20px;
|
| 275 |
+
box-shadow: 0 10px 28px -6px rgba(45, 25, 15, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
|
| 276 |
+
transition: all .2s ease;
|
| 277 |
+
}
|
| 278 |
+
html[data-theme="dark"] .work-overlay-card {
|
| 279 |
+
background: rgba(18, 25, 42, 0.94);
|
| 280 |
+
border-color: rgba(245, 196, 81, 0.35);
|
| 281 |
+
box-shadow: 0 14px 32px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
|
| 282 |
}
|
| 283 |
+
|
| 284 |
.work-btn {
|
| 285 |
+
width: clamp(84px, 10.5cqw, 126px); height: clamp(84px, 10.5cqw, 126px);
|
| 286 |
+
min-width: 0; min-height: 0;
|
| 287 |
aspect-ratio: 1 / 1; flex-shrink: 0; border-radius: 50%; border: 0; cursor: pointer; color: #382000;
|
| 288 |
background: radial-gradient(circle at 35% 30%, #fff7df 0%, #f7dc88 45%, #dfb84a 80%, #c99c2d 100%);
|
| 289 |
box-shadow:
|
| 290 |
+
0 0 0 4px rgba(244,212,116,.35),
|
| 291 |
+
0 0 0 8px rgba(244,212,116,.15),
|
| 292 |
+
0 12px 28px -6px rgba(239,90,86,.35),
|
| 293 |
+
inset 0 -6px 12px rgba(160,100,25,.3),
|
| 294 |
+
inset 0 3px 10px rgba(255,255,255,.8);
|
| 295 |
+
display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
|
| 296 |
transition: transform .12s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
|
| 297 |
-webkit-tap-highlight-color: transparent;
|
| 298 |
touch-action: manipulation;
|
|
|
|
| 320 |
}
|
| 321 |
.work-btn.disabled:hover { transform: none; box-shadow: 0 4px 14px rgba(0,0,0,.12); }
|
| 322 |
.work-limit-badge {
|
| 323 |
+
margin-top: clamp(6px, 0.8cqw, 10px); padding: 3px 10px; border-radius: 99px;
|
| 324 |
background: var(--bg-2); border: 1.5px solid rgba(180,130,100,.25);
|
| 325 |
+
font-size: clamp(9px, 0.9cqw, 11px); font-weight: 700; color: var(--text-dim);
|
| 326 |
+
display: inline-flex; align-items: center; justify-content: center; gap: 4px;
|
| 327 |
box-shadow: 0 2px 8px rgba(120,70,50,.06); transition: all .2s ease;
|
| 328 |
white-space: nowrap; max-width: 100%;
|
| 329 |
}
|
| 330 |
+
.work-limit-badge b { color: #b45309; font-size: clamp(10px, 1cqw, 12px); }
|
| 331 |
.work-limit-badge.warn {
|
| 332 |
color: var(--rose); border-color: rgba(239,90,86,.45);
|
| 333 |
background: rgba(239,90,86,.08);
|
| 334 |
}
|
| 335 |
.work-limit-badge.warn b { color: var(--rose); }
|
| 336 |
+
.work-thumb { width: clamp(28px, 3.6cqw, 44px); height: clamp(28px, 3.6cqw, 44px); object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0,0,0,.2)); }
|
| 337 |
+
.work-label { font-weight: 900; font-size: clamp(11px, 1.2cqw, 15px); color: #382000; letter-spacing: 0.5px; text-shadow: 0 1px 2px rgba(255,255,255,.6); }
|
| 338 |
+
.work-val { font-weight: 800; font-size: clamp(10px, 0.95cqw, 12px); color: #6b3e04; }
|
| 339 |
.float-layer { position: absolute; inset: 0; pointer-events: none; }
|
| 340 |
.float-num { position: absolute; font-weight: 900; color: #ef5a56; text-shadow: 0 1px 4px rgba(255,255,255,.9); animation: floatUp .9s ease-out forwards; }
|
| 341 |
html[data-theme="dark"] .float-num { text-shadow: 0 2px 8px rgba(0,0,0,.6); }
|
|
|
|
| 573 |
|
| 574 |
/* ---------- 跨平台自適應排版(電腦版、iPad 9 平板、手機) ---------- */
|
| 575 |
|
| 576 |
+
/* 1. iPad 9 橫向與中型筆電 (901px ~ 1199px) */
|
| 577 |
@media (min-width: 901px) and (max-width: 1199px) {
|
| 578 |
.main { max-width: 100%; padding: 12px 14px 80px; }
|
| 579 |
+
.territory-map-wrap { height: auto !important; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 580 |
}
|
| 581 |
|
| 582 |
+
/* 2. iPad 9 直向與小平板 (641px ~ 900px) */
|
| 583 |
@media (min-width: 641px) and (max-width: 900px) {
|
| 584 |
.main { padding: 14px 14px 90px; }
|
| 585 |
+
.territory-map-wrap { height: auto !important; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 586 |
.class-layout { grid-template-columns: 1fr; }
|
| 587 |
}
|
| 588 |
|
|
|
|
| 594 |
.res-val { font-size: 16px; }
|
| 595 |
.res-mult { display: none; }
|
| 596 |
.user-box .mute { display: none; }
|
| 597 |
+
.map-header { flex-direction: column; align-items: flex-start; gap: 8px; }
|
| 598 |
+
.map-legend-top { font-size: 11px; padding: 3px 10px; gap: 8px; }
|
| 599 |
.tabs {
|
| 600 |
position: fixed; bottom: 0; left: 0; right: 0; z-index: 45; padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
|
| 601 |
background: var(--bg-1); border-top: 1px solid var(--line); justify-content: space-around; gap: 4px;
|
|
|
|
| 605 |
.tab { flex: 1; flex-direction: column; gap: 0; padding: 4px; min-height: 52px; font-size: 18px; border: 0; }
|
| 606 |
.tab span { font-size: 11px; }
|
| 607 |
.main { padding: 12px 10px 100px; }
|
| 608 |
+
.build-layout { flex-direction: column; width: 100%; }
|
| 609 |
+
.side { width: 100%; position: static; flex-direction: column; align-items: center; }
|
| 610 |
+
.work-card { max-width: 320px; width: 100%; padding: 16px 14px 12px; }
|
| 611 |
+
.work-btn { width: 130px; height: 130px; min-width: 130px; min-height: 130px; }
|
| 612 |
+
.work-emoji { font-size: 32px; }
|
| 613 |
+
.work-thumb { width: 48px; height: 48px; }
|
| 614 |
+
.work-label { font-size: 14px; }
|
| 615 |
+
.work-limit-badge { margin-top: 6px; font-size: 11px; }
|
| 616 |
+
.territory-map-wrap { height: auto !important; }
|
| 617 |
+
.inmap-town-panel {
|
| 618 |
+
right: 10px !important; left: 10px !important; bottom: 12px !important;
|
| 619 |
+
top: auto !important; width: auto !important; max-width: none !important;
|
| 620 |
+
padding: 12px 14px;
|
| 621 |
+
}
|
| 622 |
+
.inmap-town-panel::before { display: none !important; }
|
| 623 |
.b-list, .r-grid { grid-template-columns: 1fr; }
|
| 624 |
.class-hero { flex-direction: column; text-align: center; }
|
| 625 |
.qz-q { font-size: 16px; }
|
|
|
|
| 855 |
transform: translateY(0);
|
| 856 |
}
|
| 857 |
|
| 858 |
+
/* =============================================================
|
| 859 |
+
封測先鋒功勳冊封令彈窗 (Pioneer Edict Modal)
|
| 860 |
+
============================================================= */
|
| 861 |
+
.pioneer-edict-modal {
|
| 862 |
+
text-align: center; padding: 14px 10px; max-width: 540px; margin: 0 auto;
|
| 863 |
+
animation: edictPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
|
| 864 |
+
}
|
| 865 |
+
@keyframes edictPop {
|
| 866 |
+
0% { transform: scale(0.9); opacity: 0; }
|
| 867 |
+
100% { transform: scale(1); opacity: 1; }
|
| 868 |
+
}
|
| 869 |
+
.pioneer-seal-wrap {
|
| 870 |
+
position: relative; display: inline-flex; align-items: center; justify-content: center;
|
| 871 |
+
width: 72px; height: 72px; border-radius: 50%;
|
| 872 |
+
background: radial-gradient(circle, #fef3c7 20%, #fde68a 60%, #f59e0b 100%);
|
| 873 |
+
border: 3px solid #d97706; box-shadow: 0 0 24px rgba(245, 158, 11, 0.6);
|
| 874 |
+
margin-bottom: 12px; font-size: 38px;
|
| 875 |
+
}
|
| 876 |
+
.pioneer-tag {
|
| 877 |
+
display: inline-block; padding: 4px 14px; border-radius: 99px;
|
| 878 |
+
background: linear-gradient(90deg, #b45309, #d97706);
|
| 879 |
+
color: #fff; font-size: 13px; font-weight: 800; letter-spacing: 1px;
|
| 880 |
+
box-shadow: 0 2px 8px rgba(180, 83, 9, 0.35); margin-bottom: 10px;
|
| 881 |
+
}
|
| 882 |
+
.pioneer-title {
|
| 883 |
+
font-size: 24px; font-weight: 900; color: #b45309; margin: 0 0 10px 0;
|
| 884 |
+
letter-spacing: 0.5px;
|
| 885 |
+
}
|
| 886 |
+
.pioneer-intro {
|
| 887 |
+
font-size: 14px; color: var(--text-dim); line-height: 1.6; margin: 0 auto 16px;
|
| 888 |
+
background: rgba(245, 158, 11, 0.08); border-radius: 12px; padding: 12px 14px;
|
| 889 |
+
border-left: 4px solid #f59e0b; text-align: left;
|
| 890 |
+
}
|
| 891 |
+
.pioneer-rank-card {
|
| 892 |
+
display: flex; align-items: center; justify-content: space-around; flex-wrap: wrap; gap: 12px;
|
| 893 |
+
background: linear-gradient(135deg, rgba(254, 243, 199, 0.6), rgba(253, 230, 138, 0.4));
|
| 894 |
+
border: 1.5px solid rgba(217, 119, 6, 0.4); border-radius: 14px;
|
| 895 |
+
padding: 14px 16px; margin-bottom: 16px;
|
| 896 |
+
}
|
| 897 |
+
.pioneer-stat-item {
|
| 898 |
+
display: flex; flex-direction: column; align-items: center; gap: 2px;
|
| 899 |
+
}
|
| 900 |
+
.pioneer-stat-lbl { font-size: 12px; color: #92400e; font-weight: 700; }
|
| 901 |
+
.pioneer-stat-val { font-size: 20px; font-weight: 900; color: #b45309; }
|
| 902 |
+
|
| 903 |
+
.pioneer-reward-shelf {
|
| 904 |
+
display: flex; justify-content: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap;
|
| 905 |
+
}
|
| 906 |
+
.pioneer-reward-card {
|
| 907 |
+
flex: 1 1 180px; max-width: 220px;
|
| 908 |
+
background: var(--bg-1); border: 1.5px solid var(--gold); border-radius: 14px;
|
| 909 |
+
padding: 14px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px;
|
| 910 |
+
box-shadow: 0 4px 14px rgba(245, 158, 11, 0.18);
|
| 911 |
+
}
|
| 912 |
+
.pioneer-reward-icon { font-size: 32px; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.15)); }
|
| 913 |
+
.pioneer-reward-name { font-size: 15px; font-weight: 800; color: #b45309; }
|
| 914 |
+
.pioneer-reward-qty { font-size: 20px; font-weight: 900; color: #d97706; }
|
| 915 |
+
.pioneer-reward-desc { font-size: 11px; color: var(--text-dim); text-align: center; }
|
| 916 |
+
|
| 917 |
+
.pioneer-action-btn {
|
| 918 |
+
background: linear-gradient(135deg, #f59e0b, #d97706);
|
| 919 |
+
color: #fff; font-size: 16px; font-weight: 800; padding: 12px 32px;
|
| 920 |
+
border-radius: 99px; border: none; cursor: pointer;
|
| 921 |
+
box-shadow: 0 6px 18px rgba(217, 119, 6, 0.4);
|
| 922 |
+
transition: transform 0.15s ease, box-shadow 0.15s ease;
|
| 923 |
+
min-height: 48px; width: 100%; max-width: 320px;
|
| 924 |
+
}
|
| 925 |
+
.pioneer-action-btn:hover {
|
| 926 |
+
transform: translateY(-2px); box-shadow: 0 8px 24px rgba(217, 119, 6, 0.5);
|
| 927 |
+
}
|
| 928 |
+
|
| 929 |
+
/* =============================================================
|
| 930 |
+
新手 3 步驟圖文出征指南彈窗 (Beginner Guide Modal)
|
| 931 |
+
============================================================= */
|
| 932 |
+
.beginner-guide-modal {
|
| 933 |
+
text-align: left; padding: 10px 4px; max-width: 620px; margin: 0 auto;
|
| 934 |
+
}
|
| 935 |
+
.beginner-guide-header {
|
| 936 |
+
text-align: center; margin-bottom: 18px;
|
| 937 |
+
}
|
| 938 |
+
.beginner-guide-title {
|
| 939 |
+
font-size: 22px; font-weight: 900; color: #b45309; margin: 6px 0 4px;
|
| 940 |
+
}
|
| 941 |
+
.beginner-guide-sub {
|
| 942 |
+
font-size: 13px; color: var(--text-dim); margin: 0;
|
| 943 |
+
}
|
| 944 |
+
.beginner-steps-container {
|
| 945 |
+
display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px;
|
| 946 |
+
}
|
| 947 |
+
.beginner-step-card {
|
| 948 |
+
display: flex; gap: 14px; align-items: flex-start;
|
| 949 |
+
background: var(--bg-1); border: 1.5px solid var(--card-border);
|
| 950 |
+
border-radius: 14px; padding: 14px 16px;
|
| 951 |
+
box-shadow: 0 2px 8px rgba(120, 70, 50, 0.04);
|
| 952 |
+
transition: transform 0.15s ease, border-color 0.15s ease;
|
| 953 |
+
}
|
| 954 |
+
.beginner-step-card:hover {
|
| 955 |
+
border-color: rgba(245, 158, 11, 0.5); transform: translateX(3px);
|
| 956 |
+
}
|
| 957 |
+
.step-badge-col {
|
| 958 |
+
display: flex; flex-direction: column; align-items: center; gap: 4px;
|
| 959 |
+
}
|
| 960 |
+
.step-num-badge {
|
| 961 |
+
width: 32px; height: 32px; border-radius: 50%;
|
| 962 |
+
background: linear-gradient(135deg, #f59e0b, #d97706);
|
| 963 |
+
color: #fff; font-size: 15px; font-weight: 900;
|
| 964 |
+
display: flex; align-items: center; justify-content: center;
|
| 965 |
+
box-shadow: 0 2px 6px rgba(217, 119, 6, 0.3);
|
| 966 |
+
}
|
| 967 |
+
.step-icon-img {
|
| 968 |
+
width: 44px; height: 44px; object-fit: contain; border-radius: 8px; margin-top: 4px;
|
| 969 |
+
}
|
| 970 |
+
.step-content { flex: 1; min-width: 0; }
|
| 971 |
+
.step-title {
|
| 972 |
+
font-size: 16px; font-weight: 800; color: var(--text); margin: 0 0 4px 0;
|
| 973 |
+
display: flex; align-items: center; gap: 6px;
|
| 974 |
+
}
|
| 975 |
+
.step-title .step-tag {
|
| 976 |
+
font-size: 11px; padding: 2px 8px; border-radius: 99px;
|
| 977 |
+
background: rgba(16, 185, 129, 0.15); color: #059669; font-weight: 700;
|
| 978 |
+
}
|
| 979 |
+
.step-desc {
|
| 980 |
+
font-size: 13px; color: var(--text-dim); line-height: 1.6; margin: 0;
|
| 981 |
+
}
|
| 982 |
+
.step-desc b { color: #b45309; }
|
| 983 |
+
|
| 984 |
+
.beginner-guide-footer-tip {
|
| 985 |
+
background: #f0fdf4; border: 1.5px solid rgba(5, 150, 105, 0.25);
|
| 986 |
+
border-radius: 12px; padding: 10px 14px; font-size: 12px; color: #065f46;
|
| 987 |
+
line-height: 1.5; margin-bottom: 18px;
|
| 988 |
+
}
|
| 989 |
+
|
| 990 |
+
/* =============================================================
|
| 991 |
+
首頁新手指引橫幅 (Beginner Banner)
|
| 992 |
+
============================================================= */
|
| 993 |
+
.beginner-banner {
|
| 994 |
+
display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
|
| 995 |
+
background: linear-gradient(135deg, #ecfdf5, #fef3c7);
|
| 996 |
+
border: 1.5px solid rgba(16, 185, 129, 0.35); border-radius: 12px;
|
| 997 |
+
padding: 10px 16px; margin-bottom: 12px;
|
| 998 |
+
box-shadow: 0 2px 10px rgba(16, 185, 129, 0.08);
|
| 999 |
+
animation: bannerFadeIn 0.3s ease;
|
| 1000 |
+
}
|
| 1001 |
+
@keyframes bannerFadeIn {
|
| 1002 |
+
from { opacity: 0; transform: translateY(-6px); }
|
| 1003 |
+
to { opacity: 1; transform: translateY(0); }
|
| 1004 |
+
}
|
| 1005 |
+
.beginner-banner-left {
|
| 1006 |
+
display: flex; align-items: center; gap: 10px; flex: 1; min-width: 260px;
|
| 1007 |
+
}
|
| 1008 |
+
.beginner-banner-icon { font-size: 22px; }
|
| 1009 |
+
.beginner-banner-text {
|
| 1010 |
+
font-size: 13px; font-weight: 600; color: #065f46; line-height: 1.5;
|
| 1011 |
+
}
|
| 1012 |
+
.beginner-banner-text b { color: #b45309; }
|
| 1013 |
+
.beginner-banner-btn {
|
| 1014 |
+
background: linear-gradient(135deg, #10b981, #059669);
|
| 1015 |
+
color: #fff; font-size: 12px; font-weight: 800; border: none;
|
| 1016 |
+
border-radius: 8px; padding: 6px 14px; cursor: pointer;
|
| 1017 |
+
box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
|
| 1018 |
+
transition: transform 0.15s ease, box-shadow 0.15s ease;
|
| 1019 |
+
white-space: nowrap;
|
| 1020 |
+
}
|
| 1021 |
+
.beginner-banner-btn:hover {
|
| 1022 |
+
transform: translateY(-1px); box-shadow: 0 4px 10px rgba(16, 185, 129, 0.4);
|
| 1023 |
+
}
|
| 1024 |
+
|
| 1025 |
+
|
docs/map-conquest-design.md
CHANGED
|
@@ -37,7 +37,7 @@
|
|
| 37 |
* 顯示當前產量 vs 擴軍預估產量、軍階里程碑進度條。
|
| 38 |
* 支援連續點擊升級(駐防擴軍)與升星(加官進爵),即時扣款刷新,無需關閉重開。
|
| 39 |
* 未收復城池直接顯示出征三項戰備檢驗與一鍵出征大按鈕。
|
| 40 |
-
* **真實資源圖示標準**:費用與標示全面改用高品質獨立素材圖示(`assets/icon_grain.jpg` 糧草袋、`assets/icon_tally.jpg`
|
| 41 |
|
| 42 |
---
|
| 43 |
|
|
@@ -172,7 +172,7 @@
|
|
| 172 |
### 3. 三大軍備箱手辦與物資掉落機率公示(開啟前可看機率)
|
| 173 |
依照「命名簡明系統化原則」,統一命名為成套且直觀的**軍備箱**系列。特別照顧答題易卡關的學生,青銅與白銀箱皆給予充足的卷軸支援:
|
| 174 |
|
| 175 |
-
| 寶箱名稱 | 專屬手辦資產 | 達成門檻 | 糧草軍資 |
|
| 176 |
| :--- | :---: | :---: | :---: | :---: | :--- |
|
| 177 |
| 🥉 **青銅軍備箱** | `assets/chest_bronze.png` | 答對 **1 ~ 5 題** | 5 分鐘掛機產量 (100%) | — | **穩定必得 1 張卷軸 (100%)**<br>(70% 掉落【刪去卷】,30% 掉落【偷看卷】),保障答題易錯學生每天都有救急道具可用! |
|
| 178 |
| 🥈 **白銀軍備箱** | `assets/chest_silver.png` | 答對 **6 ~ 10 題** | 15 分鐘掛機產量 (100%) | 20% 機率得 1 枚 | **必得 1~2 張卷軸**<br>(100% 必得【刪去卷】1 張,50% 機率得【偷看卷】1 張) |
|
|
@@ -185,7 +185,7 @@
|
|
| 185 |
### 4. 開寶箱震撼動畫演出流程
|
| 186 |
1. **寶箱蓄力震動**:點擊開箱後,寶箱手辦開始高頻搖晃(套用 `.rumble`,`@keyframes chestRumble` 動畫,劇烈左右抖動)。
|
| 187 |
2. **金芒爆發旋轉**:震動 1.2 秒後,寶箱後方爆發出璀璨的金色旋轉射線(`.chest-rays`,`@keyframes raysSpin` 金光四射)。
|
| 188 |
-
3. **戰利品升騰彈出**:物資卡片(糧草、
|
| 189 |
4. **一鍵收入軍資**:點擊領取按鈕後,物資正式記入存檔,天機閣狀態即刻刷新為已演武 (1/1) 灰字狀態。
|
| 190 |
|
| 191 |
### 5. 戰略錦囊道具系統(背包與測驗雙向互通)
|
|
|
|
| 37 |
* 顯示當前產量 vs 擴軍預估產量、軍階里程碑進度條。
|
| 38 |
* 支援連續點擊升級(駐防擴軍)與升星(加官進爵),即時扣款刷新,無需關閉重開。
|
| 39 |
* 未收復城池直接顯示出征三項戰備檢驗與一鍵出征大按鈕。
|
| 40 |
+
* **真實資源圖示標準**:費用與標示全面改用高品質獨立素材圖示(`assets/icon_grain.jpg` 糧草袋、`assets/icon_tally.jpg` 虎符),取代純文字 Emoji。
|
| 41 |
|
| 42 |
---
|
| 43 |
|
|
|
|
| 172 |
### 3. 三大軍備箱手辦與物資掉落機率公示(開啟前可看機率)
|
| 173 |
依照「命名簡明系統化原則」,統一命名為成套且直觀的**軍備箱**系列。特別照顧答題易卡關的學生,青銅與白銀箱皆給予充足的卷軸支援:
|
| 174 |
|
| 175 |
+
| 寶箱名稱 | 專屬手辦資產 | 達成門檻 | 糧草軍資 | 虎符 | 戰略錦囊卷軸(核心平衡支援) |
|
| 176 |
| :--- | :---: | :---: | :---: | :---: | :--- |
|
| 177 |
| 🥉 **青銅軍備箱** | `assets/chest_bronze.png` | 答對 **1 ~ 5 題** | 5 分鐘掛機產量 (100%) | — | **穩定必得 1 張卷軸 (100%)**<br>(70% 掉落【刪去卷】,30% 掉落【偷看卷】),保障答題易錯學生每天都有救急道具可用! |
|
| 178 |
| 🥈 **白銀軍備箱** | `assets/chest_silver.png` | 答對 **6 ~ 10 題** | 15 分鐘掛機產量 (100%) | 20% 機率得 1 枚 | **必得 1~2 張卷軸**<br>(100% 必得【刪去卷】1 張,50% 機率得【偷看卷】1 張) |
|
|
|
|
| 185 |
### 4. 開寶箱震撼動畫演出流程
|
| 186 |
1. **寶箱蓄力震動**:點擊開箱後,寶箱手辦開始高頻搖晃(套用 `.rumble`,`@keyframes chestRumble` 動畫,劇烈左右抖動)。
|
| 187 |
2. **金芒爆發旋轉**:震動 1.2 秒後,寶箱後方爆發出璀璨的金色旋轉射線(`.chest-rays`,`@keyframes raysSpin` 金光四射)。
|
| 188 |
+
3. **戰利品升騰彈出**:物資卡片(糧草、虎符、偷看卷、刪去卷)透過彈簧彈跳動畫(`@keyframes rewardsPop`)依序彈出。
|
| 189 |
4. **一鍵收入軍資**:點擊領取按鈕後,物資正式記入存檔,天機閣狀態即刻刷新為已演武 (1/1) 灰字狀態。
|
| 190 |
|
| 191 |
### 5. 戰略錦囊道具系統(背包與測驗雙向互通)
|
index.html
CHANGED
|
@@ -8,8 +8,8 @@
|
|
| 8 |
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 9 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 10 |
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&family=Noto+Sans+TC:wght@400;600;700;900&display=swap" rel="stylesheet">
|
| 11 |
-
<link rel="stylesheet" href="css/base.css">
|
| 12 |
-
<link rel="stylesheet" href="css/game.css?v=
|
| 13 |
</head>
|
| 14 |
<body>
|
| 15 |
<div id="modeBanner" class="mode-banner hidden"></div>
|
|
@@ -23,7 +23,7 @@
|
|
| 23 |
<!-- 登入 -->
|
| 24 |
<section id="viewLogin" class="view-center hidden">
|
| 25 |
<div class="login-card card">
|
| 26 |
-
<div class="login-logo"><img src="assets/icon_tally.jpg" class="login-tally-img" alt="
|
| 27 |
<h1 id="gameTitle" class="login-title">攻城掠地・霸業征途</h1>
|
| 28 |
<p class="dim login-sub">奪要塞、考試頒虎符、全班合力平天下!</p>
|
| 29 |
<form id="loginForm" class="stack" autocomplete="on">
|
|
@@ -59,11 +59,11 @@
|
|
| 59 |
<div class="res-sub num"><span id="valPerSec">0</span> 糧草/秒</div>
|
| 60 |
</div>
|
| 61 |
</div>
|
| 62 |
-
<div class="res res-bp" title="
|
| 63 |
-
<img class="res-thumb" src="assets/icon_tally.jpg" alt="
|
| 64 |
<div>
|
| 65 |
<div class="res-val num" id="valBp">0</div>
|
| 66 |
-
<div class="res-sub" id="lblBp">
|
| 67 |
</div>
|
| 68 |
</div>
|
| 69 |
<div class="res res-mult" title="全軍士氣倍率">
|
|
@@ -93,75 +93,69 @@
|
|
| 93 |
<main class="main">
|
| 94 |
<!-- 領地軍略 -->
|
| 95 |
<div class="pane" id="paneBuild">
|
| 96 |
-
<
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
<span class="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
</button>
|
| 104 |
-
<div class="
|
| 105 |
-
<
|
|
|
|
|
|
|
| 106 |
</div>
|
| 107 |
-
<div id="floatLayer" class="float-layer"></div>
|
| 108 |
</div>
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
</div>
|
| 113 |
-
<
|
| 114 |
-
</
|
| 115 |
-
<section class="grow">
|
| 116 |
-
<!-- 戰略沙盤大地圖 -->
|
| 117 |
-
<!-- 戰略沙盤大地圖(超大可拖曳滑動世界地圖) -->
|
| 118 |
-
<div class="card map-card" id="mapCard">
|
| 119 |
-
<div class="row map-header">
|
| 120 |
-
<div class="map-title-box">
|
| 121 |
-
<h2 class="pane-title">🗺️ 九州名都征伐沙盤</h2>
|
| 122 |
-
<span class="dim map-sub">沿外圍四方攻向山巔王城・點擊城池可直接升級與出征收復</span>
|
| 123 |
-
</div>
|
| 124 |
-
<div class="map-toolbar">
|
| 125 |
-
<div class="seg" id="buyAmt">
|
| 126 |
-
<button data-amt="1" class="active">x1</button>
|
| 127 |
-
<button data-amt="10">x10</button>
|
| 128 |
-
<button data-amt="max">最大</button>
|
| 129 |
-
</div>
|
| 130 |
-
<div class="map-nav-btns">
|
| 131 |
-
<button id="btnFocusFrontier" class="btn btn-ghost btn-sm" title="視角移至最新可攻城池">🧭 巡視前線</button>
|
| 132 |
-
<button id="btnFocusCapital" class="btn btn-ghost btn-sm" title="視角移至山巔王城">🏰 仰望王城</button>
|
| 133 |
-
</div>
|
| 134 |
-
</div>
|
| 135 |
-
</div>
|
| 136 |
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
</div>
|
|
|
|
| 145 |
</div>
|
| 146 |
|
| 147 |
-
<
|
|
|
|
| 148 |
<div class="inmap-town-panel hidden" id="inMapTownPanel"></div>
|
| 149 |
-
|
| 150 |
-
<div class="map-footer-row">
|
| 151 |
-
<div class="map-legend">
|
| 152 |
-
<span class="leg-item"><i class="leg-dot leg-locked"></i>敵境未開</span>
|
| 153 |
-
<span class="leg-item"><i class="leg-dot leg-ready"></i>兵臨城下(可出征)</span>
|
| 154 |
-
<span class="leg-item"><i class="leg-dot leg-active"></i>已收復歸順</span>
|
| 155 |
-
</div>
|
| 156 |
-
<button id="btnToggleList" class="btn btn-ghost btn-xs">📜 展開十都名錄全覽</button>
|
| 157 |
-
</div>
|
| 158 |
</div>
|
|
|
|
| 159 |
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
</section>
|
| 165 |
</div>
|
| 166 |
</div>
|
| 167 |
|
|
@@ -169,7 +163,7 @@
|
|
| 169 |
<div class="pane hidden" id="paneQuiz">
|
| 170 |
<div class="card quiz-intro">
|
| 171 |
<h2>📝 測驗:想變強,躲不掉考試</h2>
|
| 172 |
-
<p class="dim">達到 <b>85 分</b> 即通過。分數門檻(85/95/100)各有
|
| 173 |
已通過的範圍每天第一次複習 ≥85 分,還有<b>複習獎勵</b>。範圍越大,解鎖的改變越巨大!</p>
|
| 174 |
<div class="tier-flow" id="tierFlow"></div>
|
| 175 |
</div>
|
|
@@ -333,6 +327,6 @@
|
|
| 333 |
<button id="luckyChest" class="lucky hidden" aria-label="幸運寶箱">🎁</button>
|
| 334 |
</section>
|
| 335 |
|
| 336 |
-
<script type="module" src="js/game.js?v=
|
| 337 |
</body>
|
| 338 |
</html>
|
|
|
|
| 8 |
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 9 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 10 |
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&family=Noto+Sans+TC:wght@400;600;700;900&display=swap" rel="stylesheet">
|
| 11 |
+
<link rel="stylesheet" href="css/base.css?v=20261019g">
|
| 12 |
+
<link rel="stylesheet" href="css/game.css?v=20261019g">
|
| 13 |
</head>
|
| 14 |
<body>
|
| 15 |
<div id="modeBanner" class="mode-banner hidden"></div>
|
|
|
|
| 23 |
<!-- 登入 -->
|
| 24 |
<section id="viewLogin" class="view-center hidden">
|
| 25 |
<div class="login-card card">
|
| 26 |
+
<div class="login-logo"><img src="assets/icon_tally.jpg" class="login-tally-img" alt="虎符"></div>
|
| 27 |
<h1 id="gameTitle" class="login-title">攻城掠地・霸業征途</h1>
|
| 28 |
<p class="dim login-sub">奪要塞、考試頒虎符、全班合力平天下!</p>
|
| 29 |
<form id="loginForm" class="stack" autocomplete="on">
|
|
|
|
| 59 |
<div class="res-sub num"><span id="valPerSec">0</span> 糧草/秒</div>
|
| 60 |
</div>
|
| 61 |
</div>
|
| 62 |
+
<div class="res res-bp" title="虎符(測驗達標獲得)">
|
| 63 |
+
<img class="res-thumb" src="assets/icon_tally.jpg" alt="虎符">
|
| 64 |
<div>
|
| 65 |
<div class="res-val num" id="valBp">0</div>
|
| 66 |
+
<div class="res-sub" id="lblBp">虎符</div>
|
| 67 |
</div>
|
| 68 |
</div>
|
| 69 |
<div class="res res-mult" title="全軍士氣倍率">
|
|
|
|
| 93 |
<main class="main">
|
| 94 |
<!-- 領地軍略 -->
|
| 95 |
<div class="pane" id="paneBuild">
|
| 96 |
+
<!-- 戰略沙盤大地圖(100% 滿版全覽,巡營催糧優雅嵌於左上空曠處) -->
|
| 97 |
+
<div class="card map-card" id="mapCard">
|
| 98 |
+
<div class="row map-header">
|
| 99 |
+
<div class="map-title-box">
|
| 100 |
+
<h2 class="pane-title">🗺️ 九州名都征伐沙盤</h2>
|
| 101 |
+
<div class="map-legend-top">
|
| 102 |
+
<span class="leg-item"><i class="leg-dot leg-locked"></i>敵境未開</span>
|
| 103 |
+
<span class="leg-item"><i class="leg-dot leg-ready"></i>兵臨城下(可出征)</span>
|
| 104 |
+
<span class="leg-item"><i class="leg-dot leg-active"></i>已收復歸順</span>
|
| 105 |
+
</div>
|
| 106 |
+
</div>
|
| 107 |
+
<div class="map-toolbar">
|
| 108 |
+
<button id="btnGuide" class="btn btn-sm" style="background:linear-gradient(135deg, #10b981, #059669); color:#fff; border:none; font-weight:800; border-radius:8px; padding:6px 12px; cursor:pointer; box-shadow:0 2px 8px rgba(16,185,129,0.3); display:inline-flex; align-items:center; gap:4px;" title="查看新手 3 步驟出征指南">
|
| 109 |
+
<span>💡</span><span>新手指南</span>
|
| 110 |
</button>
|
| 111 |
+
<div class="seg" id="buyAmt">
|
| 112 |
+
<button data-amt="1" class="active">x1</button>
|
| 113 |
+
<button data-amt="10">x10</button>
|
| 114 |
+
<button data-amt="max">最大</button>
|
| 115 |
</div>
|
|
|
|
| 116 |
</div>
|
| 117 |
+
</div>
|
| 118 |
+
|
| 119 |
+
<!-- 新手 3 步驟動態引導橫幅 -->
|
| 120 |
+
<div id="beginnerBanner" class="beginner-banner hidden">
|
| 121 |
+
<div class="beginner-banner-left">
|
| 122 |
+
<span class="beginner-banner-icon">💡</span>
|
| 123 |
+
<span class="beginner-banner-text" id="beginnerBannerText">
|
| 124 |
+
<b>新手指引 Step 1</b>:全軍開局秒產為 0,請先點擊左上角【🌾 巡營催糧】賺取初始軍糧,再升級【景陽瓷都】開啟自動秒產!
|
| 125 |
+
</span>
|
| 126 |
</div>
|
| 127 |
+
<button id="btnBannerGuideDetail" class="beginner-banner-btn">查看 3 步驟圖文教學 ➔</button>
|
| 128 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
|
| 130 |
+
<!-- 大地圖視窗(自適應寬度全景呈現) -->
|
| 131 |
+
<div class="territory-map-wrap" id="territoryMapWrap">
|
| 132 |
+
<div class="territory-map" id="territoryMap">
|
| 133 |
+
<img class="map-bg" id="mapBgImg" src="assets/map_chibi.jpg" alt="領地沙盤大地圖">
|
| 134 |
+
<svg class="map-routes-svg" id="mapRoutesSvg" viewBox="0 0 100 100" preserveAspectRatio="none"></svg>
|
| 135 |
+
|
| 136 |
+
<!-- 左上角雲海天空處:巡營催糧帥印台(與沙盤自然融為一體) -->
|
| 137 |
+
<div class="work-overlay-card" id="workOverlayCard">
|
| 138 |
+
<button id="btnWork" class="work-btn" aria-label="巡營催糧">
|
| 139 |
+
<img class="work-thumb" src="assets/icon_grain.jpg" alt="糧草">
|
| 140 |
+
<span class="work-label">巡營催糧!</span>
|
| 141 |
+
<span class="work-val num">+<span id="valClick">1</span> 糧草</span>
|
| 142 |
+
</button>
|
| 143 |
+
<div class="work-limit-badge" id="workLimitBadge" title="每日最多巡營催糧 100 次,明日 00:00 自動重設">
|
| 144 |
+
<span>今日巡營剩餘:</span><b id="workLeftCount" class="num">100</b> / 100 次
|
| 145 |
</div>
|
| 146 |
+
<div id="floatLayer" class="float-layer"></div>
|
| 147 |
</div>
|
| 148 |
|
| 149 |
+
<div class="map-spots" id="mapSpots"></div>
|
| 150 |
+
<!-- 城池旁彈出之戰略指令浮窗(點擊城池就近在城池旁顯示) -->
|
| 151 |
<div class="inmap-town-panel hidden" id="inMapTownPanel"></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
</div>
|
| 153 |
+
</div>
|
| 154 |
|
| 155 |
+
<!-- 折疊備用清單(預設隱藏,維持代碼相容) -->
|
| 156 |
+
<div id="buildingListWrap" class="hidden">
|
| 157 |
+
<div id="buildingList" class="b-list"></div>
|
| 158 |
+
</div>
|
|
|
|
| 159 |
</div>
|
| 160 |
</div>
|
| 161 |
|
|
|
|
| 163 |
<div class="pane hidden" id="paneQuiz">
|
| 164 |
<div class="card quiz-intro">
|
| 165 |
<h2>📝 測驗:想變強,躲不掉考試</h2>
|
| 166 |
+
<p class="dim">達到 <b>85 分</b> 即通過。分數門檻(85/95/100)各有虎符獎勵,只補差額;
|
| 167 |
已通過的範圍每天第一次複習 ≥85 分,還有<b>複習獎勵</b>。範圍越大,解鎖的改變越巨大!</p>
|
| 168 |
<div class="tier-flow" id="tierFlow"></div>
|
| 169 |
</div>
|
|
|
|
| 327 |
<button id="luckyChest" class="lucky hidden" aria-label="幸運寶箱">🎁</button>
|
| 328 |
</section>
|
| 329 |
|
| 330 |
+
<script type="module" src="js/game.js?v=20261019g"></script>
|
| 331 |
</body>
|
| 332 |
</html>
|
js/admin.js
CHANGED
|
@@ -2,6 +2,7 @@ import { getDB, normCode } from './db.js';
|
|
| 2 |
import { $, $$, bind, withLoading, toast, openModal, fmtDateTime, fmt, esc, todayStr, addDays } from './util.js';
|
| 3 |
import { loadBankIndex } from './quiz.js';
|
| 4 |
import { SCHEDULE, TIERS, OPEN_OFFSET_DAYS } from './config.js';
|
|
|
|
| 5 |
|
| 6 |
let db, user, currentClassCode = null;
|
| 7 |
let classes = [], students = [], banks = [];
|
|
@@ -62,6 +63,7 @@ async function init() {
|
|
| 62 |
bind($('#btnAddClass'), 'click', modalAddClass);
|
| 63 |
bind($('#btnAddStudent'), 'click', modalAddStudent);
|
| 64 |
bind($('#btnSendGift'), 'click', modalSendGift);
|
|
|
|
| 65 |
bind($('#cbAllStudents'), 'change', (e) => {
|
| 66 |
$$('.cb-student').forEach(cb => cb.checked = e.target.checked);
|
| 67 |
});
|
|
@@ -236,7 +238,7 @@ function modalAddClass() {
|
|
| 236 |
// -------------------------------------------------------------
|
| 237 |
async function renderStudents() {
|
| 238 |
if (!currentClassCode) {
|
| 239 |
-
$('#tbStudents tbody').innerHTML = '<tr><td colspan="
|
| 240 |
$('#studentCount').textContent = '0 名學生';
|
| 241 |
return;
|
| 242 |
}
|
|
@@ -268,6 +270,12 @@ async function renderStudents() {
|
|
| 268 |
? `<span class="badge badge-mint" style="margin-left:4px;" title="勞權及SDGs達標 (${p.labor.best}分)">🛡️勞權合格</span>`
|
| 269 |
: `<span class="badge" style="margin-left:4px; opacity:0.65; background:#334155;" title="勞權及SDGs尚未達標">🛡️待測</span>`;
|
| 270 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 271 |
return `<tr>
|
| 272 |
<td class="cb-cell"><input type="checkbox" class="cb-student" data-uid="${s.uid}"></td>
|
| 273 |
<td class="num"><b>${esc(s.seat)}</b></td>
|
|
@@ -277,8 +285,9 @@ async function renderStudents() {
|
|
| 277 |
${bankOpts}
|
| 278 |
</select>
|
| 279 |
</td>
|
| 280 |
-
<td class="num">
|
| 281 |
-
<td class="num">
|
|
|
|
| 282 |
<td class="num">${passed} 項 ${laborBadge}</td>
|
| 283 |
<td>
|
| 284 |
<button class="btn btn-sm btn-reset-pin" data-idx="${i}">重設密碼</button>
|
|
@@ -379,7 +388,7 @@ function modalSendGift() {
|
|
| 379 |
<div class="mute" style="margin-bottom:15px">將發送給 <b>${selected.length}</b> 名學生</div>
|
| 380 |
<div class="form-grid">
|
| 381 |
<div><label class="mute">固定糧草數量 🌾</label><input type="number" id="gCoins" class="input" style="width:100%" value="0"></div>
|
| 382 |
-
<div><label class="mute">
|
| 383 |
<div style="grid-column: 1 / -1;">
|
| 384 |
<label class="mute">⏳ 贈送掛機收益時長(小時)</label>
|
| 385 |
<div style="display:flex; gap:8px; align-items:center; margin-top:4px;">
|
|
@@ -434,6 +443,227 @@ function modalSendGift() {
|
|
| 434 |
});
|
| 435 |
}
|
| 436 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 437 |
// -------------------------------------------------------------
|
| 438 |
// 紀錄查詢
|
| 439 |
// -------------------------------------------------------------
|
|
|
|
| 2 |
import { $, $$, bind, withLoading, toast, openModal, fmtDateTime, fmt, esc, todayStr, addDays } from './util.js';
|
| 3 |
import { loadBankIndex } from './quiz.js';
|
| 4 |
import { SCHEDULE, TIERS, OPEN_OFFSET_DAYS } from './config.js';
|
| 5 |
+
import { newGame, normalizeGame, derive, totalProd } from './engine.js?v=20261019e';
|
| 6 |
|
| 7 |
let db, user, currentClassCode = null;
|
| 8 |
let classes = [], students = [], banks = [];
|
|
|
|
| 63 |
bind($('#btnAddClass'), 'click', modalAddClass);
|
| 64 |
bind($('#btnAddStudent'), 'click', modalAddStudent);
|
| 65 |
bind($('#btnSendGift'), 'click', modalSendGift);
|
| 66 |
+
bind($('#btnResetPioneer'), 'click', modalResetPioneer);
|
| 67 |
bind($('#cbAllStudents'), 'change', (e) => {
|
| 68 |
$$('.cb-student').forEach(cb => cb.checked = e.target.checked);
|
| 69 |
});
|
|
|
|
| 238 |
// -------------------------------------------------------------
|
| 239 |
async function renderStudents() {
|
| 240 |
if (!currentClassCode) {
|
| 241 |
+
$('#tbStudents tbody').innerHTML = '<tr><td colspan="10" class="center mute">請先選擇或建立班級</td></tr>';
|
| 242 |
$('#studentCount').textContent = '0 名學生';
|
| 243 |
return;
|
| 244 |
}
|
|
|
|
| 270 |
? `<span class="badge badge-mint" style="margin-left:4px;" title="勞權及SDGs達標 (${p.labor.best}分)">🛡️勞權合格</span>`
|
| 271 |
: `<span class="badge" style="margin-left:4px; opacity:0.65; background:#334155;" title="勞權及SDGs尚未達標">🛡️待測</span>`;
|
| 272 |
|
| 273 |
+
const peekCount = g.items?.peek || 0;
|
| 274 |
+
const elimCount = g.items?.eliminate || 0;
|
| 275 |
+
const itemsBadge = (peekCount > 0 || elimCount > 0)
|
| 276 |
+
? `<span class="badge" style="background:rgba(245,158,11,0.15); border:1px solid rgba(245,158,11,0.35); color:#d97706; font-weight:700;" title="偷看卷 ${peekCount} 張 / 刪去卷 ${elimCount} 張">📜 ${peekCount} | ✂️ ${elimCount}</span>`
|
| 277 |
+
: `<span class="mute" style="font-size:12px;">無</span>`;
|
| 278 |
+
|
| 279 |
return `<tr>
|
| 280 |
<td class="cb-cell"><input type="checkbox" class="cb-student" data-uid="${s.uid}"></td>
|
| 281 |
<td class="num"><b>${esc(s.seat)}</b></td>
|
|
|
|
| 285 |
${bankOpts}
|
| 286 |
</select>
|
| 287 |
</td>
|
| 288 |
+
<td class="num">🌾 ${fmt(g.coins || 0)}</td>
|
| 289 |
+
<td class="num">🐅 ${fmt(g.blueprints || 0)}</td>
|
| 290 |
+
<td class="num" style="text-align:center;">${itemsBadge}</td>
|
| 291 |
<td class="num">${passed} 項 ${laborBadge}</td>
|
| 292 |
<td>
|
| 293 |
<button class="btn btn-sm btn-reset-pin" data-idx="${i}">重設密碼</button>
|
|
|
|
| 388 |
<div class="mute" style="margin-bottom:15px">將發送給 <b>${selected.length}</b> 名學生</div>
|
| 389 |
<div class="form-grid">
|
| 390 |
<div><label class="mute">固定糧草數量 🌾</label><input type="number" id="gCoins" class="input" style="width:100%" value="0"></div>
|
| 391 |
+
<div><label class="mute">虎符數量 🐅</label><input type="number" id="gBp" class="input" style="width:100%" value="0"></div>
|
| 392 |
<div style="grid-column: 1 / -1;">
|
| 393 |
<label class="mute">⏳ 贈送掛機收益時長(小時)</label>
|
| 394 |
<div style="display:flex; gap:8px; align-items:center; margin-top:4px;">
|
|
|
|
| 443 |
});
|
| 444 |
}
|
| 445 |
|
| 446 |
+
// -------------------------------------------------------------
|
| 447 |
+
// 封測先鋒功勳結算與重整進度
|
| 448 |
+
// -------------------------------------------------------------
|
| 449 |
+
export function calcPioneerReward(prodPerSec, student) {
|
| 450 |
+
const g = student?.game;
|
| 451 |
+
const hasPlayed = !!(g && (
|
| 452 |
+
prodPerSec > 0 ||
|
| 453 |
+
(g.clicks || 0) > 0 ||
|
| 454 |
+
(g.totalEarned || 0) > 0 ||
|
| 455 |
+
Object.values(g.buildings || {}).some(b => (b?.lv || 0) > 0)
|
| 456 |
+
));
|
| 457 |
+
|
| 458 |
+
if (prodPerSec >= 300) {
|
| 459 |
+
return {
|
| 460 |
+
rankTitle: '智勇大將軍',
|
| 461 |
+
peek: 3,
|
| 462 |
+
eliminate: 3,
|
| 463 |
+
hasPlayed: true,
|
| 464 |
+
desc: '秒產 ≥ 300 🌾 (每分 ≥ 1.8萬)'
|
| 465 |
+
};
|
| 466 |
+
} else if (prodPerSec >= 50) {
|
| 467 |
+
return {
|
| 468 |
+
rankTitle: '破陣前鋒',
|
| 469 |
+
peek: 2,
|
| 470 |
+
eliminate: 2,
|
| 471 |
+
hasPlayed: true,
|
| 472 |
+
desc: '秒產 ≥ 50 🌾 (每分 ≥ 3,000)'
|
| 473 |
+
};
|
| 474 |
+
} else if (prodPerSec >= 10) {
|
| 475 |
+
return {
|
| 476 |
+
rankTitle: '驍勇校尉',
|
| 477 |
+
peek: 1,
|
| 478 |
+
eliminate: 2,
|
| 479 |
+
hasPlayed: true,
|
| 480 |
+
desc: '秒產 ≥ 10 🌾 (每分 ≥ 600)'
|
| 481 |
+
};
|
| 482 |
+
} else if (hasPlayed) {
|
| 483 |
+
return {
|
| 484 |
+
rankTitle: '隨軍將士',
|
| 485 |
+
peek: 1,
|
| 486 |
+
eliminate: 1,
|
| 487 |
+
hasPlayed: true,
|
| 488 |
+
desc: '封測拓荒隨軍保底獎'
|
| 489 |
+
};
|
| 490 |
+
} else {
|
| 491 |
+
return {
|
| 492 |
+
rankTitle: '新募新兵',
|
| 493 |
+
peek: 0,
|
| 494 |
+
eliminate: 0,
|
| 495 |
+
hasPlayed: false,
|
| 496 |
+
desc: '未參與今日封測'
|
| 497 |
+
};
|
| 498 |
+
}
|
| 499 |
+
}
|
| 500 |
+
|
| 501 |
+
async function modalResetPioneer() {
|
| 502 |
+
if (!currentClassCode) return toast('請先選擇班級', 'error');
|
| 503 |
+
if (!students || students.length === 0) return toast('目前班級尚無學生資料', 'error');
|
| 504 |
+
|
| 505 |
+
const classInfo = (await db.getClass(currentClassCode)) || {};
|
| 506 |
+
|
| 507 |
+
// 試算全班學生的封測成績與換算獎勵
|
| 508 |
+
const rosterPlans = students.map(s => {
|
| 509 |
+
const g = s.game ? normalizeGame(s.game) : null;
|
| 510 |
+
let prod = 0;
|
| 511 |
+
if (g) {
|
| 512 |
+
const d = derive(s.progress || {}, classInfo, g);
|
| 513 |
+
prod = totalProd(g, d);
|
| 514 |
+
}
|
| 515 |
+
const reward = calcPioneerReward(prod, s);
|
| 516 |
+
return {
|
| 517 |
+
student: s,
|
| 518 |
+
game: g,
|
| 519 |
+
prod,
|
| 520 |
+
reward
|
| 521 |
+
};
|
| 522 |
+
});
|
| 523 |
+
|
| 524 |
+
const activePioneers = rosterPlans.filter(p => p.reward.hasPlayed).length;
|
| 525 |
+
|
| 526 |
+
const m = openModal(`
|
| 527 |
+
<div style="max-width:840px;">
|
| 528 |
+
<div style="display:flex; align-items:center; gap:12px; margin-bottom:12px;">
|
| 529 |
+
<span style="font-size:32px;">🎖️</span>
|
| 530 |
+
<div>
|
| 531 |
+
<h2 style="margin:0; font-size:20px; color:#b45309;">封測先鋒功勳結算 & 全軍進度重整</h2>
|
| 532 |
+
<p class="mute" style="margin:4px 0 0; font-size:13px;">班級:<b>${esc(currentClassCode)}</b>(共 ${students.length} 名學生,已參戰拓荒 ${activePioneers} 名)</p>
|
| 533 |
+
</div>
|
| 534 |
+
</div>
|
| 535 |
+
|
| 536 |
+
<div style="background:#fffbeb; border:1.5px solid rgba(217,119,6,0.3); border-radius:12px; padding:12px 16px; margin-bottom:14px; font-size:13px; line-height:1.6; color:#92400e;">
|
| 537 |
+
<b>⚠️ 結算與重整作業說明:</b><br>
|
| 538 |
+
1. 系統已自動讀取全班學生目前的每秒產量,並依階梯換算為專屬<b>【偷看卷】</b>與<b>【刪去卷】</b>。<br>
|
| 539 |
+
2. 執行後,全體學生的<b>糧草(15 🌾)、虎符(0 枚)、城池等級(Lv.0)將重整回開局狀態</b>。<br>
|
| 540 |
+
3. 換算獲得的卷軸將直接注入學生個人背包(<code>game.items</code>),可於天機閣或正式測驗隨時調用。<br>
|
| 541 |
+
4. <b>明日每位學生打開遊戲時,系統會主動彈出「封測先鋒冊封令」展示功勳與獎勵(單次顯示,領取後自動切換至新手 3 步驟圖文指南)</b>。
|
| 542 |
+
</div>
|
| 543 |
+
|
| 544 |
+
<!-- 結算預覽表格 -->
|
| 545 |
+
<div style="max-height:300px; overflow-y:auto; border:1px solid var(--card-border); border-radius:10px; margin-bottom:14px;">
|
| 546 |
+
<table class="tbl" style="width:100%; font-size:13px; margin:0;">
|
| 547 |
+
<thead style="position:sticky; top:0; background:var(--bg-2); z-index:2;">
|
| 548 |
+
<tr>
|
| 549 |
+
<th style="width:50px;">座號</th>
|
| 550 |
+
<th>姓名</th>
|
| 551 |
+
<th style="text-align:right;">封測每秒產量</th>
|
| 552 |
+
<th style="text-align:right;">換算每分</th>
|
| 553 |
+
<th style="text-align:center;">授予軍階</th>
|
| 554 |
+
<th style="text-align:center;">功勳錦囊獎勵</th>
|
| 555 |
+
</tr>
|
| 556 |
+
</thead>
|
| 557 |
+
<tbody>
|
| 558 |
+
${rosterPlans.map(p => {
|
| 559 |
+
const r = p.reward;
|
| 560 |
+
const prodSec = Math.round(p.prod);
|
| 561 |
+
const prodMin = Math.round(p.prod * 60);
|
| 562 |
+
const rankColor = r.rankTitle === '智勇大將軍' ? '#dc2626' : (r.rankTitle === '破陣前鋒' ? '#d97706' : (r.rankTitle === '驍勇校尉' ? '#2563eb' : '#4b5563'));
|
| 563 |
+
return `<tr>
|
| 564 |
+
<td class="num"><b>${esc(p.student.seat)}</b></td>
|
| 565 |
+
<td>${esc(p.student.name)}</td>
|
| 566 |
+
<td class="num" style="text-align:right;">🌾 ${fmt(prodSec)} /秒</td>
|
| 567 |
+
<td class="num mute" style="text-align:right;">${fmt(prodMin)} /分</td>
|
| 568 |
+
<td style="text-align:center;"><b style="color:${rankColor};">【${r.rankTitle}】</b></td>
|
| 569 |
+
<td style="text-align:center;">
|
| 570 |
+
<span class="badge" style="background:rgba(245,158,11,0.15); border:1px solid rgba(245,158,11,0.35); color:#d97706; font-weight:700;">
|
| 571 |
+
📜 偷看卷 × ${r.peek} | ✂️ 刪去卷 × ${r.eliminate}
|
| 572 |
+
</span>
|
| 573 |
+
</td>
|
| 574 |
+
</tr>`;
|
| 575 |
+
}).join('')}
|
| 576 |
+
</tbody>
|
| 577 |
+
</table>
|
| 578 |
+
</div>
|
| 579 |
+
|
| 580 |
+
<!-- 選項控制 -->
|
| 581 |
+
<div style="display:flex; flex-direction:column; gap:8px; margin-bottom:16px; background:var(--card-bg); padding:12px; border-radius:10px; border:1px solid var(--card-border);">
|
| 582 |
+
<label style="display:flex; align-items:center; gap:8px; font-size:13px; cursor:pointer;">
|
| 583 |
+
<input type="checkbox" id="chkGrantAllBaseline" checked style="width:16px; height:16px; cursor:pointer;">
|
| 584 |
+
<span><b>未登入/新進學生亦發放「隨軍將士」起步錦囊</b>(各給 📜 偷看卷 ×1、✂️ 刪去卷 ×1)</span>
|
| 585 |
+
</label>
|
| 586 |
+
<label style="display:flex; align-items:center; gap:8px; font-size:13px; cursor:pointer;">
|
| 587 |
+
<input type="checkbox" id="chkResetClassPool" checked style="width:16px; height:16px; cursor:pointer;">
|
| 588 |
+
<span><b>同步將當前班級的【全軍共拓設施捐獻值】重置為 0</b>(包含首破名錄與同袍協同池清空,確保明日全軍從零開拔)</span>
|
| 589 |
+
</label>
|
| 590 |
+
</div>
|
| 591 |
+
|
| 592 |
+
<div style="display:flex; justify-content:flex-end; gap:10px;">
|
| 593 |
+
<button class="btn" id="btnCancelPioneer">取消返回</button>
|
| 594 |
+
<button class="btn btn-gold" id="btnConfirmPioneerReset" style="font-weight:800; background:linear-gradient(135deg, #f59e0b, #d97706); color:#fff; border:none; box-shadow:0 4px 14px rgba(217,119,6,0.35); cursor:pointer;">
|
| 595 |
+
🚀 確認執行全班重置並存入錦囊
|
| 596 |
+
</button>
|
| 597 |
+
</div>
|
| 598 |
+
</div>
|
| 599 |
+
`);
|
| 600 |
+
|
| 601 |
+
bind($('#btnCancelPioneer', m.el), 'click', () => m.close());
|
| 602 |
+
|
| 603 |
+
bind($('#btnConfirmPioneerReset', m.el), 'click', () => {
|
| 604 |
+
if (!confirm(`確定要為【${currentClassCode}】全班 ${students.length} 位學生執行進度重整與發獎嗎?\\n此動作將把個人城池與糧草重設為開局狀態,並將卷軸存入學生背包!`)) return;
|
| 605 |
+
|
| 606 |
+
withLoading($('#btnConfirmPioneerReset', m.el), async () => {
|
| 607 |
+
try {
|
| 608 |
+
const grantBaseline = $('#chkGrantAllBaseline', m.el).checked;
|
| 609 |
+
const resetClassPool = $('#chkResetClassPool', m.el).checked;
|
| 610 |
+
|
| 611 |
+
// 批次重置學生
|
| 612 |
+
for (const item of rosterPlans) {
|
| 613 |
+
const s = item.student;
|
| 614 |
+
let r = item.reward;
|
| 615 |
+
if (!r.hasPlayed && grantBaseline) {
|
| 616 |
+
r = {
|
| 617 |
+
rankTitle: '隨軍將士',
|
| 618 |
+
peek: 1,
|
| 619 |
+
eliminate: 1,
|
| 620 |
+
hasPlayed: true,
|
| 621 |
+
desc: '隨軍將士起步錦囊'
|
| 622 |
+
};
|
| 623 |
+
}
|
| 624 |
+
|
| 625 |
+
const newG = newGame();
|
| 626 |
+
newG.items = {
|
| 627 |
+
peek: r.peek,
|
| 628 |
+
eliminate: r.eliminate
|
| 629 |
+
};
|
| 630 |
+
|
| 631 |
+
if (r.hasPlayed || r.peek > 0 || r.eliminate > 0) {
|
| 632 |
+
newG.alphaPioneer = {
|
| 633 |
+
rankTitle: r.rankTitle,
|
| 634 |
+
prodPerSec: Math.round(item.prod),
|
| 635 |
+
peek: r.peek,
|
| 636 |
+
eliminate: r.eliminate,
|
| 637 |
+
resetAt: Date.now()
|
| 638 |
+
};
|
| 639 |
+
newG.alphaNoticeSeen = false; // 單次顯示開關
|
| 640 |
+
}
|
| 641 |
+
|
| 642 |
+
await db.updateStudent(s.uid, {
|
| 643 |
+
game: newG
|
| 644 |
+
});
|
| 645 |
+
}
|
| 646 |
+
|
| 647 |
+
// 重置班級公共設施池
|
| 648 |
+
if (resetClassPool) {
|
| 649 |
+
await db.updateClass(currentClassCode, {
|
| 650 |
+
donated: 0,
|
| 651 |
+
firstConquers: {},
|
| 652 |
+
peerAid: {}
|
| 653 |
+
});
|
| 654 |
+
}
|
| 655 |
+
|
| 656 |
+
toast(`🎉 結算與重整成功!全班 ${students.length} 位學生已重設開局,卷軸已入庫,明日登入將主動顯示先鋒冊封令!`, 'success');
|
| 657 |
+
m.close();
|
| 658 |
+
await renderStudents();
|
| 659 |
+
} catch (err) {
|
| 660 |
+
console.error('重整與發獎失敗', err);
|
| 661 |
+
toast('結算重整失敗: ' + err.message, 'error');
|
| 662 |
+
}
|
| 663 |
+
});
|
| 664 |
+
});
|
| 665 |
+
}
|
| 666 |
+
|
| 667 |
// -------------------------------------------------------------
|
| 668 |
// 紀錄查詢
|
| 669 |
// -------------------------------------------------------------
|
js/config.js
CHANGED
|
@@ -176,9 +176,9 @@ export const COST_GROWTH = 1.15; // 每級成本成長率
|
|
| 176 |
export const LEVEL_MILESTONES = [10, 25, 50, 75, 100, 125, 150, 175, 200, 225, 250, 300, 350, 400];
|
| 177 |
export const MILESTONE_MULT = 2;
|
| 178 |
|
| 179 |
-
// 星級強化(用
|
| 180 |
-
// →
|
| 181 |
-
export const STAR_COSTS = [1, 2, 3, 5, 8]; // 第 1~5 星所需
|
| 182 |
export const STAR_MULT = 2;
|
| 183 |
export const STAR_BASE_MAX = STAR_COSTS.length; // 「基礎星」數量(顯示用)
|
| 184 |
export const STAR_EXTRA_MULT = 1.5; // 第 6 星起每顆倍率
|
|
@@ -221,8 +221,8 @@ export const LUCKY = {
|
|
| 221 |
};
|
| 222 |
|
| 223 |
// ---------- 測驗分級(25 → 50 → 100 → 200 → 全卷 的質變) ----------
|
| 224 |
-
// thresholds:達到分數門檻時累計可拿到的
|
| 225 |
-
// reviewBonus:已通過後,每天第一次複習 ≥85 分的額外
|
| 226 |
export const PASS_SCORE = 85;
|
| 227 |
export const TIERS = {
|
| 228 |
1: { name: '單元', size: 25, maxQuestions: 25, reward: { 85: 2, 95: 3, 100: 5 }, reviewBonus: 1, desc: '每通過一個單元,攻佔解鎖新要塞' },
|
|
@@ -249,17 +249,16 @@ export const SYSTEMS = {
|
|
| 249 |
export const GLOBAL_MULTS = { v1: 2, v2: 3, h1: 5, h2: 5, all: 10, labor: 1.5 };
|
| 250 |
|
| 251 |
// ---------- 班級共同目標 ----------
|
| 252 |
-
//
|
| 253 |
-
// 每個階段的捐獻值門檻;每達成一階,全班全域產量 +10%
|
| 254 |
export const CLASS_STAGES = [
|
| 255 |
-
{ need:
|
| 256 |
-
{ need:
|
| 257 |
-
{ need:
|
| 258 |
-
{ need:
|
| 259 |
-
{ need:
|
| 260 |
-
{ need:
|
| 261 |
-
{ need:
|
| 262 |
-
{ need:
|
| 263 |
];
|
| 264 |
export const CLASS_STAGE_BONUS = 0.10;
|
| 265 |
|
|
|
|
| 176 |
export const LEVEL_MILESTONES = [10, 25, 50, 75, 100, 125, 150, 175, 200, 225, 250, 300, 350, 400];
|
| 177 |
export const MILESTONE_MULT = 2;
|
| 178 |
|
| 179 |
+
// 星級強化(用虎符):第 1~5 星每顆 x2;第 6 星起無上限,每顆 x1.5、成本 x1.6 遞增
|
| 180 |
+
// → 虎符永遠有用途,高分學生能持續領先
|
| 181 |
+
export const STAR_COSTS = [1, 2, 3, 5, 8]; // 第 1~5 星所需虎符
|
| 182 |
export const STAR_MULT = 2;
|
| 183 |
export const STAR_BASE_MAX = STAR_COSTS.length; // 「基礎星」數量(顯示用)
|
| 184 |
export const STAR_EXTRA_MULT = 1.5; // 第 6 星起每顆倍率
|
|
|
|
| 221 |
};
|
| 222 |
|
| 223 |
// ---------- 測驗分級(25 → 50 → 100 → 200 → 全卷 的質變) ----------
|
| 224 |
+
// thresholds:達到分數門檻時累計可拿到的虎符總量(只補差額,不能重複刷)
|
| 225 |
+
// reviewBonus:已通過後,每天第一次複習 ≥85 分的額外虎符
|
| 226 |
export const PASS_SCORE = 85;
|
| 227 |
export const TIERS = {
|
| 228 |
1: { name: '單元', size: 25, maxQuestions: 25, reward: { 85: 2, 95: 3, 100: 5 }, reviewBonus: 1, desc: '每通過一個單元,攻佔解鎖新要塞' },
|
|
|
|
| 249 |
export const GLOBAL_MULTS = { v1: 2, v2: 3, h1: 5, h2: 5, all: 10, labor: 1.5 };
|
| 250 |
|
| 251 |
// ---------- 班級共同目標 ----------
|
| 252 |
+
// 直接以全班累積捐獻之「糧草總量」計算;每達成一階,全班全域產量 +10%
|
|
|
|
| 253 |
export const CLASS_STAGES = [
|
| 254 |
+
{ need: 1e6, name: '先鋒營寨', img: 'assets/stage_1.png', thumb: 'assets/stage_1.jpg', effect: '全軍產能 +10%', desc: '整飭前線鹿角柵欄,設帳備糧' },
|
| 255 |
+
{ need: 1e7, name: '邊防要塞', img: 'assets/stage_2.png', thumb: 'assets/stage_2.jpg', effect: '全軍產能 +10%', desc: '築石壘堡扼守險要,烽火連天' },
|
| 256 |
+
{ need: 1e8, name: '水陸連營', img: 'assets/stage_3.png', thumb: 'assets/stage_3.jpg', effect: '全軍產能 +10%', desc: '樓船列陣水陸呼應,江渚戒嚴' },
|
| 257 |
+
{ need: 1e9, name: '中原雄關', img: 'assets/stage_4.png', thumb: 'assets/stage_4.jpg', effect: '全軍產能 +10%', desc: '鎖鑰咽喉一夫當關,萬夫莫開' },
|
| 258 |
+
{ need: 1e10, name: '行軍大營', img: 'assets/stage_5.png', thumb: 'assets/stage_5.jpg', effect: '全軍產能 +10%', desc: '中軍金帳旌旗蔽日,金鼓震天' },
|
| 259 |
+
{ need: 1e11, name: '九州重鎮', img: 'assets/stage_6.png', thumb: 'assets/stage_6.jpg', effect: '全軍產能 +10%', desc: '固若金湯商旅輻輳,威鎮八方' },
|
| 260 |
+
{ need: 1e13, name: '天子王畿', img: 'assets/stage_7.png', thumb: 'assets/stage_7.jpg', effect: '全軍產能 +10%', desc: '金鑾玉階九重宮闕,四海歸心' },
|
| 261 |
+
{ need: 1e14, name: '萬里神州', img: 'assets/stage_8.png', thumb: 'assets/stage_8.jpg', effect: '全軍產能 +10%', desc: '祥雲瑞龍江山一統,千秋霸業' },
|
| 262 |
];
|
| 263 |
export const CLASS_STAGE_BONUS = 0.10;
|
| 264 |
|
js/db.js
CHANGED
|
@@ -182,6 +182,32 @@ class FirebaseBackend {
|
|
| 182 |
trafficTracker.recordOp({ type: 'write', source: 'updateClass', count: 1, estimatedBytes: 2048, note: `更新班級設定 (${code})` });
|
| 183 |
}
|
| 184 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
async deleteClass(code) {
|
| 186 |
await this.F.deleteDoc(this.d('classes', normCode(code)));
|
| 187 |
trafficTracker.recordOp({ type: 'delete', source: 'deleteClass', count: 1, estimatedBytes: 1024, note: `刪除班級 (${code})` });
|
|
@@ -440,6 +466,31 @@ class LocalBackend {
|
|
| 440 |
this.save(db);
|
| 441 |
}
|
| 442 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 443 |
async deleteClass(code) {
|
| 444 |
const db = this.load();
|
| 445 |
delete db.classes[normCode(code)];
|
|
|
|
| 182 |
trafficTracker.recordOp({ type: 'write', source: 'updateClass', count: 1, estimatedBytes: 2048, note: `更新班級設定 (${code})` });
|
| 183 |
}
|
| 184 |
|
| 185 |
+
async donate(code, amount) {
|
| 186 |
+
code = normCode(code);
|
| 187 |
+
const ref = this.d('classes', code);
|
| 188 |
+
await this.F.updateDoc(ref, {
|
| 189 |
+
donated: this.F.increment(amount)
|
| 190 |
+
});
|
| 191 |
+
trafficTracker.recordOp({ type: 'write', source: 'donate', count: 1, estimatedBytes: 1024, note: `班級軍餉捐獻 (${code})` });
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
async aidDonate(classCode, donor, targetUid, targetGame, realDonate) {
|
| 195 |
+
classCode = normCode(classCode);
|
| 196 |
+
const ref = this.d('classes', classCode);
|
| 197 |
+
await this.F.updateDoc(ref, {
|
| 198 |
+
donated: this.F.increment(realDonate),
|
| 199 |
+
[`peerAid.${targetUid}.lastAidAt`]: Date.now(),
|
| 200 |
+
[`peerAid.${targetUid}.donorName`]: donor.name || `座號${donor.seat}`,
|
| 201 |
+
[`peerAid.${targetUid}.donorSeat`]: donor.seat || ''
|
| 202 |
+
});
|
| 203 |
+
try {
|
| 204 |
+
await this.updateStudent(targetUid, { game: targetGame });
|
| 205 |
+
} catch (e) {
|
| 206 |
+
console.warn('嘗試直接更新被代捐同袍文檔受規則限制,已同步至班級協同池', e);
|
| 207 |
+
}
|
| 208 |
+
trafficTracker.recordOp({ type: 'write', source: 'aidDonate', count: 2, estimatedBytes: 3072, note: `同袍代捐軍餉 (${donor.seat || ''}號 -> ${targetUid.slice(0,6)})` });
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
async deleteClass(code) {
|
| 212 |
await this.F.deleteDoc(this.d('classes', normCode(code)));
|
| 213 |
trafficTracker.recordOp({ type: 'delete', source: 'deleteClass', count: 1, estimatedBytes: 1024, note: `刪除班級 (${code})` });
|
|
|
|
| 466 |
this.save(db);
|
| 467 |
}
|
| 468 |
|
| 469 |
+
async donate(code, amount) {
|
| 470 |
+
const db = this.load();
|
| 471 |
+
const c = db.classes[normCode(code)] || { donated: 0 };
|
| 472 |
+
c.donated = (c.donated || 0) + amount;
|
| 473 |
+
db.classes[normCode(code)] = c;
|
| 474 |
+
this.save(db);
|
| 475 |
+
}
|
| 476 |
+
|
| 477 |
+
async aidDonate(classCode, donor, targetUid, targetGame, realDonate) {
|
| 478 |
+
const db = this.load();
|
| 479 |
+
const c = db.classes[normCode(classCode)] || { donated: 0 };
|
| 480 |
+
c.donated = (c.donated || 0) + realDonate;
|
| 481 |
+
c.peerAid = c.peerAid || {};
|
| 482 |
+
c.peerAid[targetUid] = {
|
| 483 |
+
lastAidAt: Date.now(),
|
| 484 |
+
donorName: donor.name || `座號${donor.seat}`,
|
| 485 |
+
donorSeat: donor.seat || ''
|
| 486 |
+
};
|
| 487 |
+
db.classes[normCode(classCode)] = c;
|
| 488 |
+
if (db.students[targetUid]) {
|
| 489 |
+
db.students[targetUid].game = targetGame;
|
| 490 |
+
}
|
| 491 |
+
this.save(db);
|
| 492 |
+
}
|
| 493 |
+
|
| 494 |
async deleteClass(code) {
|
| 495 |
const db = this.load();
|
| 496 |
delete db.classes[normCode(code)];
|
js/engine.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
| 5 |
TIERS, PASS_SCORE, SCHEDULE, GLOBAL_MULTS, CLASS_STAGES, CLASS_STAGE_BONUS,
|
| 6 |
QUIZ_COIN_SECONDS, QUIZ_COIN_MIN, QUIZ_COIN_DAILY_FULL, QUIZ_COIN_REPEAT_RATIO,
|
| 7 |
OPEN_OFFSET_DAYS, SYSTEMS, WEEKLY_SCHEDULE, SLOTH_PENALTY_MULT,
|
| 8 |
-
} from './config.js?v=
|
| 9 |
import { todayStr, addDays } from './util.js';
|
| 10 |
|
| 11 |
export function newGame() {
|
|
@@ -285,12 +285,9 @@ export function advance(game, d, now = Date.now(), { offline = false } = {}) {
|
|
| 285 |
}
|
| 286 |
|
| 287 |
// ---------- 班級 ----------
|
| 288 |
-
// 捐獻
|
| 289 |
-
// (用累積值而非每次開根號,分多次小額捐獻不會比一次捐完更划算)
|
| 290 |
export function donationValue(prevCoins, addCoins, mult = 1) {
|
| 291 |
-
|
| 292 |
-
const after = Math.sqrt(Math.max(0, prevCoins + addCoins));
|
| 293 |
-
return (after - before) * mult;
|
| 294 |
}
|
| 295 |
|
| 296 |
export function classStage(donated) {
|
|
|
|
| 5 |
TIERS, PASS_SCORE, SCHEDULE, GLOBAL_MULTS, CLASS_STAGES, CLASS_STAGE_BONUS,
|
| 6 |
QUIZ_COIN_SECONDS, QUIZ_COIN_MIN, QUIZ_COIN_DAILY_FULL, QUIZ_COIN_REPEAT_RATIO,
|
| 7 |
OPEN_OFFSET_DAYS, SYSTEMS, WEEKLY_SCHEDULE, SLOTH_PENALTY_MULT,
|
| 8 |
+
} from './config.js?v=20261019e';
|
| 9 |
import { todayStr, addDays } from './util.js';
|
| 10 |
|
| 11 |
export function newGame() {
|
|
|
|
| 285 |
}
|
| 286 |
|
| 287 |
// ---------- 班級 ----------
|
| 288 |
+
// 依使用者需求:直接以捐獻之糧草數量 1:1 累積呈現(乘上同袍共鳴加成倍率)
|
|
|
|
| 289 |
export function donationValue(prevCoins, addCoins, mult = 1) {
|
| 290 |
+
return addCoins * (mult || 1);
|
|
|
|
|
|
|
| 291 |
}
|
| 292 |
|
| 293 |
export function classStage(donated) {
|
js/game.js
CHANGED
|
@@ -2,13 +2,13 @@ import { getDB, DBError } from './db.js';
|
|
| 2 |
import {
|
| 3 |
BUILDINGS, TIERS, SCHEDULE, PASS_SCORE, THEME, QUIZ_COIN_MIN, QUIZ_COIN_SECONDS,
|
| 4 |
CLASS_STAGES, LUCKY, STAR_BASE_MAX, QUIZ_COIN_DAILY_FULL, WEEKLY_SCHEDULE, SLOTH_PENALTY_MULT
|
| 5 |
-
} from './config.js?v=
|
| 6 |
import {
|
| 7 |
newGame, normalizeGame, derive, isUnlocked, levelCost, maxAffordable, bulkCost,
|
| 8 |
starCost, nextStarMult, donationValue, clickValue, advance, classStage, isRangeOpen,
|
| 9 |
computeQuizReward, unlockText, totalProd, buildingProd, milestoneCount, nextMilestone, isPassed, getWeekStatus,
|
| 10 |
canConquer, getConquerRequirements, conquerTown, isPrereqMet, getTianjiStatus
|
| 11 |
-
} from './engine.js?v=
|
| 12 |
import { $, $$, fmt, fmtTime, todayStr, bind, withLoading, toast, openModal, esc, fmtDateTime, shuffle } from './util.js';
|
| 13 |
import { loadBankIndex, buildQuiz, loadBank } from './quiz.js';
|
| 14 |
|
|
@@ -88,6 +88,12 @@ async function init() {
|
|
| 88 |
await db.logout();
|
| 89 |
}));
|
| 90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
// 切到背景 / 關閉分頁時補存(取代高頻率定時存檔)
|
| 92 |
bind(document, 'visibilitychange', () => { if (document.hidden) saveOnLeave(); });
|
| 93 |
bind(window, 'pagehide', saveOnLeave);
|
|
@@ -139,6 +145,7 @@ async function loadStudentData() {
|
|
| 139 |
checkGifts();
|
| 140 |
switchTab('build');
|
| 141 |
setTimeout(() => checkClassMilestones(), 600);
|
|
|
|
| 142 |
}
|
| 143 |
|
| 144 |
// 存檔:同一時間只會有一個寫入;寫入中又有新請求時,結束後再補存一次(確保最新資料寫入)
|
|
@@ -334,101 +341,37 @@ const STRATEGIC_ROUTES = [
|
|
| 334 |
['b8', 'b10'], // 軍機策府 -> 霸業王城 (直搗天下皇城)
|
| 335 |
];
|
| 336 |
|
| 337 |
-
// 初始化大地圖
|
| 338 |
function initMapDrag() {
|
| 339 |
const wrap = $('#territoryMapWrap');
|
| 340 |
if (!wrap || wrap.dataset.dragInited) return;
|
| 341 |
wrap.dataset.dragInited = 'true';
|
| 342 |
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
};
|
| 352 |
-
|
| 353 |
-
const onMove = (clientX, clientY) => {
|
| 354 |
-
if (!isMapDragging) return;
|
| 355 |
-
const dx = clientX - mapDragStartX;
|
| 356 |
-
const dy = clientY - mapDragStartY;
|
| 357 |
-
if (Math.abs(dx) > 4 || Math.abs(dy) > 4) mapHasDragged = true;
|
| 358 |
-
wrap.scrollLeft = mapScrollStartX - dx;
|
| 359 |
-
wrap.scrollTop = mapScrollStartY - dy;
|
| 360 |
-
};
|
| 361 |
-
|
| 362 |
-
const onUp = () => {
|
| 363 |
-
if (isMapDragging) {
|
| 364 |
-
isMapDragging = false;
|
| 365 |
-
wrap.classList.remove('dragging');
|
| 366 |
-
$('#mapDragHint')?.classList.add('fadeout');
|
| 367 |
}
|
| 368 |
-
};
|
| 369 |
-
|
| 370 |
-
// 滑鼠事件
|
| 371 |
-
wrap.addEventListener('mousedown', (e) => {
|
| 372 |
-
if (e.target.closest('.map-spot') || e.target.closest('.inmap-town-panel')) return;
|
| 373 |
-
onDown(e.clientX, e.clientY);
|
| 374 |
});
|
| 375 |
-
window.addEventListener('mousemove', (e) => onMove(e.clientX, e.clientY));
|
| 376 |
-
window.addEventListener('mouseup', onUp);
|
| 377 |
|
| 378 |
-
// iPad / 手機觸控支援(徹底隔離頁面滾動與城池點擊)
|
| 379 |
-
wrap.addEventListener('touchstart', (e) => {
|
| 380 |
-
if (e.touches.length === 1 && !e.target.closest('.map-spot') && !e.target.closest('.inmap-town-panel')) {
|
| 381 |
-
onDown(e.touches[0].clientX, e.touches[0].clientY);
|
| 382 |
-
}
|
| 383 |
-
}, { passive: true });
|
| 384 |
-
|
| 385 |
-
window.addEventListener('touchmove', (e) => {
|
| 386 |
-
if (isMapDragging && e.touches.length === 1) {
|
| 387 |
-
// 正在拖曳沙盤時,阻止 iPad Safari 預設的整頁上下彈跳與捲動
|
| 388 |
-
if (e.cancelable) e.preventDefault();
|
| 389 |
-
onMove(e.touches[0].clientX, e.touches[0].clientY);
|
| 390 |
-
}
|
| 391 |
-
}, { passive: false });
|
| 392 |
-
|
| 393 |
-
window.addEventListener('touchend', onUp);
|
| 394 |
-
window.addEventListener('touchcancel', onUp);
|
| 395 |
-
|
| 396 |
-
// 視角快捷按鈕
|
| 397 |
-
$('#btnFocusFrontier')?.addEventListener('click', () => {
|
| 398 |
-
const readyTown = BUILDINGS.find(b => (game.buildings[b.id]?.lv || 0) === 0 && canConquer(b, game, dState)) || BUILDINGS[0];
|
| 399 |
-
focusTownOnMap(readyTown.id);
|
| 400 |
-
});
|
| 401 |
-
$('#btnFocusCapital')?.addEventListener('click', () => {
|
| 402 |
-
focusTownOnMap('b10');
|
| 403 |
-
});
|
| 404 |
|
| 405 |
// 全覽清單開關
|
| 406 |
$('#btnToggleList')?.addEventListener('click', () => {
|
| 407 |
const listWrap = $('#buildingListWrap');
|
| 408 |
-
|
| 409 |
-
|
|
|
|
|
|
|
| 410 |
});
|
| 411 |
-
|
| 412 |
-
// 預設將視角平滑滾動到起點城鎮 (b1 附近)
|
| 413 |
-
setTimeout(() => focusTownOnMap(selectedTownId || 'b1', false), 200);
|
| 414 |
}
|
| 415 |
|
| 416 |
-
//
|
| 417 |
function focusTownOnMap(bid, smooth = true) {
|
| 418 |
selectedTownId = bid;
|
| 419 |
-
const wrap = $('#territoryMapWrap');
|
| 420 |
-
const pos = getTownLayout(bid);
|
| 421 |
-
if (wrap && pos) {
|
| 422 |
-
const mapW = 1400;
|
| 423 |
-
const mapH = 1400 * (9 / 16);
|
| 424 |
-
const targetX = (pos.x / 100) * mapW - wrap.clientWidth / 2;
|
| 425 |
-
const targetY = (pos.y / 100) * mapH - wrap.clientHeight / 2;
|
| 426 |
-
wrap.scrollTo({
|
| 427 |
-
left: Math.max(0, targetX),
|
| 428 |
-
top: Math.max(0, targetY),
|
| 429 |
-
behavior: smooth ? 'smooth' : 'auto',
|
| 430 |
-
});
|
| 431 |
-
}
|
| 432 |
renderMapSpots();
|
| 433 |
renderInMapTownPanel();
|
| 434 |
}
|
|
@@ -496,12 +439,12 @@ function renderMapSpots() {
|
|
| 496 |
let visualBody = '';
|
| 497 |
if (b.id === 'b10') {
|
| 498 |
visualBody = `
|
| 499 |
-
<div class="spot-capital-wrap" style="width:${size + 20}px; height:${size}px;" title="霸業王城・萬里神州天下名都">
|
| 500 |
${iconBadge}
|
| 501 |
</div>`;
|
| 502 |
} else {
|
| 503 |
visualBody = `
|
| 504 |
-
<div class="spot-building-wrap" style="width:${size}px; height:${size}px;">
|
| 505 |
<img class="spot-building-img" src="assets/building_${b.id}.png" alt="${b.name}">
|
| 506 |
${costBadge}
|
| 507 |
${iconBadge}
|
|
@@ -527,7 +470,7 @@ function renderMapSpots() {
|
|
| 527 |
const tianjiHtml = `
|
| 528 |
<div class="map-spot spot-tianji ${tianjiDone ? 'tianji-done' : ''}" style="left:${tianjiLayout.x}%; top:${tianjiLayout.y}%;" data-tianji="true" title="天機閣・每日60秒急速快答演武">
|
| 529 |
<span class="spot-badge-daily">${tianjiDone ? '今日遊玩次數 (1/1)' : '今日遊玩次數 (0/1)'}</span>
|
| 530 |
-
<div class="spot-tianji-wrap" style="width:${tianjiLayout.size}px; height:${tianjiLayout.size}px;">
|
| 531 |
<img class="spot-tianji-img" src="assets/building_tianji.png" alt="天機閣">
|
| 532 |
</div>
|
| 533 |
<div class="spot-label">
|
|
@@ -560,7 +503,7 @@ function renderMapSpots() {
|
|
| 560 |
renderInMapTownPanel();
|
| 561 |
}
|
| 562 |
|
| 563 |
-
// 渲染地圖內置戰略指令面板(城池資訊與升級/出征按鈕直接
|
| 564 |
function renderInMapTownPanel() {
|
| 565 |
const panel = $('#inMapTownPanel');
|
| 566 |
if (!panel) return;
|
|
@@ -580,6 +523,34 @@ function renderInMapTownPanel() {
|
|
| 580 |
|
| 581 |
panel.classList.remove('hidden');
|
| 582 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 583 |
let bodyHtml = '';
|
| 584 |
|
| 585 |
if (!un) {
|
|
@@ -745,6 +716,7 @@ function renderInMapTownPanel() {
|
|
| 745 |
renderRes();
|
| 746 |
renderInMapTownPanel();
|
| 747 |
renderMapSpots();
|
|
|
|
| 748 |
markDirty();
|
| 749 |
} else {
|
| 750 |
toast('糧草不足,請巡營催糧或稍候輜重!', 'error');
|
|
@@ -766,50 +738,234 @@ function renderInMapTownPanel() {
|
|
| 766 |
renderMapSpots();
|
| 767 |
markDirty();
|
| 768 |
} else {
|
| 769 |
-
toast(`
|
| 770 |
}
|
| 771 |
});
|
| 772 |
}
|
| 773 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 774 |
function renderBuild() {
|
| 775 |
$('#valClick').textContent = fmt(clickValue(game, dState));
|
| 776 |
updateWorkButton();
|
| 777 |
renderMapSpots();
|
|
|
|
| 778 |
|
| 779 |
const capturedCount = BUILDINGS.filter(b => (game.buildings[b.id]?.lv || 0) > 0).length;
|
| 780 |
|
| 781 |
-
// 升級統計
|
| 782 |
-
const
|
| 783 |
-
|
| 784 |
-
|
| 785 |
-
|
| 786 |
-
|
| 787 |
-
|
| 788 |
-
|
| 789 |
-
|
| 790 |
-
|
| 791 |
-
|
| 792 |
-
|
| 793 |
-
|
| 794 |
-
|
| 795 |
-
|
| 796 |
-
|
| 797 |
-
const
|
| 798 |
-
if (
|
| 799 |
-
|
| 800 |
-
if (!reqs.prereqMet) {
|
| 801 |
-
$('#nextGoal').innerHTML = `💡 欲出征<b>【${openTown.name}】</b>,需先收復前置城鎮:<b>${reqs.missingPrereqs.join('、')}</b>!`;
|
| 802 |
-
} else if (!reqs.tallyMet) {
|
| 803 |
-
$('#nextGoal').innerHTML = `💡 出征<b>【${openTown.name}】</b>尚缺 <b>${reqs.tallyNeed - reqs.tallyHave}</b> 枚虎符!前往<b>軍機策驗</b>考高分或每日複習累積!`;
|
| 804 |
-
} else {
|
| 805 |
-
$('#nextGoal').innerHTML = `💡 出征<b>【${openTown.name}】</b>尚欠糧草輜重!請先駐防升級已收復城鎮,提高每秒糧草產量!`;
|
| 806 |
-
}
|
| 807 |
} else {
|
| 808 |
-
|
| 809 |
-
|
| 810 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 811 |
} else {
|
| 812 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 813 |
}
|
| 814 |
}
|
| 815 |
}
|
|
@@ -939,7 +1095,7 @@ function renderBuild() {
|
|
| 939 |
if (!reqs.prereqMet) {
|
| 940 |
toast(`前置要塞未連通,需先攻克:${reqs.missingPrereqs.join('、')}!`, 'error');
|
| 941 |
} else if (!reqs.tallyMet) {
|
| 942 |
-
toast(`
|
| 943 |
} else {
|
| 944 |
toast('糧草儲備不足,請駐防升級已佔領城鎮累積輜重!', 'error');
|
| 945 |
}
|
|
@@ -981,7 +1137,7 @@ function renderBuild() {
|
|
| 981 |
renderBuild();
|
| 982 |
markDirty();
|
| 983 |
} else {
|
| 984 |
-
toast('
|
| 985 |
}
|
| 986 |
}));
|
| 987 |
|
|
@@ -1144,18 +1300,24 @@ async function getTianjiQuestions() {
|
|
| 1144 |
try {
|
| 1145 |
const bank = await loadBank(bankId);
|
| 1146 |
if (bank && Array.isArray(bank.questions) && bank.questions.length > 0) {
|
| 1147 |
-
// 依當前
|
| 1148 |
-
|
| 1149 |
-
|
| 1150 |
-
|
| 1151 |
-
|
| 1152 |
-
|
| 1153 |
-
|
| 1154 |
-
|
| 1155 |
-
|
| 1156 |
-
|
| 1157 |
-
|
| 1158 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1159 |
}
|
| 1160 |
} catch (err) {
|
| 1161 |
console.warn('載入題庫失敗,使用備用題目', err);
|
|
@@ -1164,7 +1326,7 @@ async function getTianjiQuestions() {
|
|
| 1164 |
if (!pool || pool.length === 0) {
|
| 1165 |
pool = [
|
| 1166 |
{ q: '在戰略推演中,兵馬未動,何者先行?', o: ['糧草輜重', '金旗帥印', '戰鼓齊鳴', '先鋒部隊'], a: 'A' },
|
| 1167 |
-
{ q: '以下何者為大軍出征收復名都之核心重要憑證?', o: ['免死金牌', '
|
| 1168 |
{ q: '守禦九州要塞時,最關鍵的基礎戰略資源為何?', o: ['軍備糧草', '精美絲綢', '金銀珠寶', '樓船木材'], a: 'A' },
|
| 1169 |
{ q: '哪一座九州名都專門以產出萬頃稻浪、囤積軍糧著稱?', o: ['平原稻鄉', '景陽瓷都', '百草藥谷', '神兵鐵城'], a: 'A' },
|
| 1170 |
{ q: '天機閣每日急速挑戰演武中,初始士氣心為幾顆?', o: ['1 顆心', '2 顆心', '3 顆心', '5 顆心'], a: 'C' },
|
|
@@ -1285,7 +1447,7 @@ function openTianjiModal() {
|
|
| 1285 |
<img src="assets/chest_gold.png" class="chest-preview-img" alt="黃金軍備箱">
|
| 1286 |
<b style="font-size:13px; color:#b45309;">黃金軍備箱</b>
|
| 1287 |
<span class="chest-target-tag tag-gold">答對 11 題以上</span>
|
| 1288 |
-
<span style="font-size:11px; color:var(--text-mute);">100% 必得
|
| 1289 |
</div>
|
| 1290 |
</div>
|
| 1291 |
|
|
@@ -1319,14 +1481,14 @@ function openTianjiModal() {
|
|
| 1319 |
<td>6 ~ 10 題</td>
|
| 1320 |
<td>🌾 15 分鐘糧草 (100%)</td>
|
| 1321 |
<td>✂️ 刪去卷 (100%)<br>📜 偷看卷 (50%)</td>
|
| 1322 |
-
<td>🐅
|
| 1323 |
</tr>
|
| 1324 |
<tr>
|
| 1325 |
<td><b style="color:#b45309;">🥇 黃金軍備箱</b></td>
|
| 1326 |
<td>11 題以上</td>
|
| 1327 |
<td>🌾 30 分鐘暴風糧草 (100%)</td>
|
| 1328 |
<td>📜 偷看卷 1~2張 (100%)<br>✂️ 刪去卷 1張 (100%)</td>
|
| 1329 |
-
<td>🐅
|
| 1330 |
</tr>
|
| 1331 |
</tbody>
|
| 1332 |
</table>
|
|
@@ -1363,7 +1525,8 @@ function openTianjiModal() {
|
|
| 1363 |
const btnStart = $('#btnStartTianjiArena', modal.el);
|
| 1364 |
if (btnStart) {
|
| 1365 |
bind(btnStart, 'click', () => {
|
| 1366 |
-
|
|
|
|
| 1367 |
});
|
| 1368 |
}
|
| 1369 |
|
|
@@ -1373,15 +1536,15 @@ function openTianjiModal() {
|
|
| 1373 |
}
|
| 1374 |
}
|
| 1375 |
|
| 1376 |
-
// 60秒急速快答挑戰競技場
|
| 1377 |
-
async function startTianjiArena(
|
| 1378 |
-
modal
|
| 1379 |
<div style="text-align:center; padding:40px 10px;">
|
| 1380 |
<div class="loader" style="margin:0 auto 16px;"></div>
|
| 1381 |
<h3 style="margin:0;">天機推演題庫中…</h3>
|
| 1382 |
-
<p class="dim" style="font-size:13px; margin-top:6px;">匯集當週各單元戰略題庫・限時 60 秒・3 顆士氣心</p>
|
| 1383 |
</div>
|
| 1384 |
-
`;
|
| 1385 |
|
| 1386 |
let questions = [];
|
| 1387 |
try {
|
|
@@ -1393,6 +1556,21 @@ async function startTianjiArena(modal) {
|
|
| 1393 |
return;
|
| 1394 |
}
|
| 1395 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1396 |
let timeLeft = 60;
|
| 1397 |
let hearts = 3;
|
| 1398 |
let correctCount = 0;
|
|
@@ -1402,15 +1580,22 @@ async function startTianjiArena(modal) {
|
|
| 1402 |
let answered = false;
|
| 1403 |
const wrongLogs = [];
|
| 1404 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1405 |
const renderArenaQ = () => {
|
| 1406 |
if (hearts <= 0) {
|
| 1407 |
-
|
| 1408 |
-
showChestUnboxModal(modal, correctCount, 'defeat', wrongLogs);
|
| 1409 |
return;
|
| 1410 |
}
|
| 1411 |
if (timeLeft <= 0) {
|
| 1412 |
-
|
| 1413 |
-
showChestUnboxModal(modal, correctCount, 'timeout', wrongLogs);
|
| 1414 |
return;
|
| 1415 |
}
|
| 1416 |
if (qIdx >= questions.length) {
|
|
@@ -1545,8 +1730,7 @@ async function startTianjiArena(modal) {
|
|
| 1545 |
correctText: q.o[q.a.charCodeAt(0) - 65],
|
| 1546 |
});
|
| 1547 |
if (hearts <= 0) {
|
| 1548 |
-
|
| 1549 |
-
setTimeout(() => showChestUnboxModal(modal, correctCount, 'defeat', wrongLogs), 600);
|
| 1550 |
} else {
|
| 1551 |
qIdx++;
|
| 1552 |
setTimeout(renderArenaQ, 600);
|
|
@@ -1569,8 +1753,7 @@ async function startTianjiArena(modal) {
|
|
| 1569 |
num.textContent = `⏱️ ${Math.max(0, Math.ceil(timeLeft))}s`;
|
| 1570 |
}
|
| 1571 |
if (timeLeft <= 0) {
|
| 1572 |
-
|
| 1573 |
-
showChestUnboxModal(modal, correctCount, 'timeout', wrongLogs);
|
| 1574 |
}
|
| 1575 |
}, 100);
|
| 1576 |
|
|
@@ -1716,7 +1899,7 @@ function showChestUnboxModal(modal, correctCount, reason, wrongLogs = []) {
|
|
| 1716 |
<tr><td>🌾 糧草補給 (15分鐘掛機產量)</td><td style="text-align:right;"><b>100%</b></td></tr>
|
| 1717 |
<tr><td>✂️ 刪去卷 (1張)</td><td style="text-align:right;"><b>100%</b></td></tr>
|
| 1718 |
<tr><td>📜 偷看卷 (1張)</td><td style="text-align:right;"><b>50%</b></td></tr>
|
| 1719 |
-
<tr><td>🐅
|
| 1720 |
</tbody>
|
| 1721 |
</table>
|
| 1722 |
` : `
|
|
@@ -1725,7 +1908,7 @@ function showChestUnboxModal(modal, correctCount, reason, wrongLogs = []) {
|
|
| 1725 |
<thead><tr><th>物資項目</th><th style="text-align:right;">掉落機率</th></tr></thead>
|
| 1726 |
<tbody>
|
| 1727 |
<tr><td>🌾 暴風糧草 (30分鐘掛機產量)</td><td style="text-align:right;"><b>100%</b></td></tr>
|
| 1728 |
-
<tr><td>🐅
|
| 1729 |
<tr><td>📜 偷看卷 (1~2張)</td><td style="text-align:right;"><b>100%</b></td></tr>
|
| 1730 |
<tr><td>✂️ 刪去卷 (1張)</td><td style="text-align:right;"><b>100%</b></td></tr>
|
| 1731 |
</tbody>
|
|
@@ -1809,9 +1992,9 @@ function showChestUnboxModal(modal, correctCount, reason, wrongLogs = []) {
|
|
| 1809 |
if (rewards.bp > 0) {
|
| 1810 |
cardsHtml += `
|
| 1811 |
<div class="reward-item-card">
|
| 1812 |
-
<img src="assets/icon_tally.jpg" alt="
|
| 1813 |
<b>+${rewards.bp} 枚</b>
|
| 1814 |
-
<span>
|
| 1815 |
</div>
|
| 1816 |
`;
|
| 1817 |
}
|
|
@@ -2087,7 +2270,7 @@ window.appStartQuiz = async (rid) => {
|
|
| 2087 |
<div class="center dim">${score >= PASS_SCORE ? '🎉 恭喜達標!' : '💦 再接再厲,達到 85 分才算通過喔'}</div>
|
| 2088 |
<div class="reward-box">
|
| 2089 |
<span class="badge badge-gold">🌾 +${fmt(coins)} 糧草</span>
|
| 2090 |
-
${blueprints > 0 ? `<span class="badge badge-sky">🐅 +${blueprints}
|
| 2091 |
</div>
|
| 2092 |
${coinReduced ? `<p class="center mute">今日此卷已練兵超過 ${QUIZ_COIN_DAILY_FULL} 次,糧草補給降為 25%(換卷或明日重整即恢復全額)</p>` : ''}`;
|
| 2093 |
|
|
@@ -2164,24 +2347,42 @@ function renderClass() {
|
|
| 2164 |
|
| 2165 |
const list = CLASS_STAGES.map((s, i) => {
|
| 2166 |
const done = d >= s.need;
|
| 2167 |
-
|
| 2168 |
-
|
| 2169 |
-
<
|
| 2170 |
-
|
| 2171 |
-
|
| 2172 |
-
<span
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2173 |
</div>
|
| 2174 |
<div class="dim" style="font-size:11px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;">${s.desc || ''}</div>
|
| 2175 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2176 |
</li>`;
|
| 2177 |
}).join('');
|
| 2178 |
$('#stageList').innerHTML = list;
|
| 2179 |
|
| 2180 |
-
// 達標即關閉個人捐獻入口(
|
| 2181 |
-
const
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2182 |
const lockedNotice = $('#donateLockedNotice');
|
| 2183 |
const donateRow = $('#donateRow');
|
| 2184 |
-
if (lockedNotice)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2185 |
if (donateRow) {
|
| 2186 |
$$('button', donateRow).forEach(b => {
|
| 2187 |
b.classList.toggle('disabled', isWeeklyLocked);
|
|
@@ -2193,18 +2394,26 @@ function renderClass() {
|
|
| 2193 |
// 捐獻綁定
|
| 2194 |
$$('.donate-row .btn').forEach(btn => {
|
| 2195 |
bind(btn, 'click', async () => {
|
| 2196 |
-
if (isWeeklyLocked) {
|
| 2197 |
-
toast('🎯 本週軍餉
|
| 2198 |
return;
|
| 2199 |
}
|
| 2200 |
const pct = parseFloat(btn.dataset.pct);
|
| 2201 |
-
|
| 2202 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2203 |
|
| 2204 |
const realDonate = donationValue(game.donatedCoins || 0, amt, dState.donateMult);
|
| 2205 |
game.coins -= amt;
|
| 2206 |
game.donatedCoins = (game.donatedCoins || 0) + amt;
|
| 2207 |
-
game.donated
|
| 2208 |
classInfo.donated = (classInfo.donated || 0) + realDonate;
|
| 2209 |
|
| 2210 |
// 每週捐獻進度結算與欠額優先償還
|
|
@@ -2232,7 +2441,7 @@ function renderClass() {
|
|
| 2232 |
if (repaidSloth) {
|
| 2233 |
toast('🎉 恭喜已全數補足上週軍餉欠額!怠惰狀態解除,全軍士氣產量全面恢復 100%!', 'success', 4500);
|
| 2234 |
} else {
|
| 2235 |
-
toast(`捐出 ${fmt(amt)} 糧草充作軍餉 → +${fmt(realDonate)}
|
| 2236 |
}
|
| 2237 |
|
| 2238 |
try {
|
|
@@ -2240,8 +2449,7 @@ function renderClass() {
|
|
| 2240 |
save(),
|
| 2241 |
db.donate(student.classCode, realDonate)
|
| 2242 |
]);
|
| 2243 |
-
|
| 2244 |
-
classInfo = await db.getClass(student.classCode);
|
| 2245 |
dState = derive(progress, classInfo, game);
|
| 2246 |
renderClass();
|
| 2247 |
checkClassMilestones();
|
|
@@ -2418,10 +2626,10 @@ function openAidDonateModal(target) {
|
|
| 2418 |
</div>
|
| 2419 |
`;
|
| 2420 |
|
| 2421 |
-
openModal(
|
| 2422 |
|
| 2423 |
// 綁定點選代捐按鈕
|
| 2424 |
-
const modalEl =
|
| 2425 |
if (!modalEl) return;
|
| 2426 |
|
| 2427 |
const executeAid = async (amt) => {
|
|
@@ -2434,8 +2642,8 @@ function openAidDonateModal(target) {
|
|
| 2434 |
const realDonate = donationValue(game.donatedCoins || 0, amt, dState.donateMult);
|
| 2435 |
game.coins -= amt;
|
| 2436 |
game.donatedCoins = (game.donatedCoins || 0) + amt;
|
| 2437 |
-
game.donated
|
| 2438 |
-
classInfo.donated = (classInfo.donated || 0) + realDonate;
|
| 2439 |
|
| 2440 |
// 填補同學的週進度與怠惰
|
| 2441 |
targetGame.weeklyDonated = targetGame.weeklyDonated || {};
|
|
@@ -2449,9 +2657,14 @@ function openAidDonateModal(target) {
|
|
| 2449 |
targetGame.weeklyDonated[currentW.id] = (targetGame.weeklyDonated[currentW.id] || 0) + leftAid;
|
| 2450 |
}
|
| 2451 |
target.game = targetGame;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2452 |
|
| 2453 |
// 關閉 Modal
|
| 2454 |
-
|
| 2455 |
|
| 2456 |
// 重新推導
|
| 2457 |
dState = derive(progress, classInfo, game);
|
|
@@ -2464,10 +2677,9 @@ function openAidDonateModal(target) {
|
|
| 2464 |
try {
|
| 2465 |
await Promise.all([
|
| 2466 |
save(),
|
| 2467 |
-
db.
|
| 2468 |
-
db.donate(student.classCode, realDonate)
|
| 2469 |
]);
|
| 2470 |
-
classInfo = await db.getClass(student.classCode);
|
| 2471 |
dState = derive(progress, classInfo, game);
|
| 2472 |
renderClass();
|
| 2473 |
renderClassRosterTable();
|
|
@@ -2477,7 +2689,7 @@ function openAidDonateModal(target) {
|
|
| 2477 |
};
|
| 2478 |
|
| 2479 |
modalEl.querySelectorAll('.btn-aid-opt').forEach(b => {
|
| 2480 |
-
|
| 2481 |
const amt = parseInt(b.dataset.amt);
|
| 2482 |
executeAid(amt);
|
| 2483 |
});
|
|
@@ -2485,8 +2697,9 @@ function openAidDonateModal(target) {
|
|
| 2485 |
|
| 2486 |
const btnCustom = modalEl.querySelector('#btnAidCustomGo');
|
| 2487 |
if (btnCustom) {
|
| 2488 |
-
|
| 2489 |
const inVal = parseInt(modalEl.querySelector('#inAidCustom').value);
|
|
|
|
| 2490 |
executeAid(inVal);
|
| 2491 |
});
|
| 2492 |
}
|
|
@@ -2674,7 +2887,7 @@ window.appClaimGift = async (id) => {
|
|
| 2674 |
game.totalEarned += totalCoinsGained;
|
| 2675 |
}
|
| 2676 |
if (res.bp) game.blueprints += res.bp;
|
| 2677 |
-
toast(`領取成功!${totalCoinsGained > 0 ? `獲得 +${fmt(totalCoinsGained)} 糧草 ` : ''}${res.bp ? `+${res.bp}
|
| 2678 |
save();
|
| 2679 |
renderRes();
|
| 2680 |
myGifts = myGifts.filter(x => x.id !== id);
|
|
|
|
| 2 |
import {
|
| 3 |
BUILDINGS, TIERS, SCHEDULE, PASS_SCORE, THEME, QUIZ_COIN_MIN, QUIZ_COIN_SECONDS,
|
| 4 |
CLASS_STAGES, LUCKY, STAR_BASE_MAX, QUIZ_COIN_DAILY_FULL, WEEKLY_SCHEDULE, SLOTH_PENALTY_MULT
|
| 5 |
+
} from './config.js?v=20261019e';
|
| 6 |
import {
|
| 7 |
newGame, normalizeGame, derive, isUnlocked, levelCost, maxAffordable, bulkCost,
|
| 8 |
starCost, nextStarMult, donationValue, clickValue, advance, classStage, isRangeOpen,
|
| 9 |
computeQuizReward, unlockText, totalProd, buildingProd, milestoneCount, nextMilestone, isPassed, getWeekStatus,
|
| 10 |
canConquer, getConquerRequirements, conquerTown, isPrereqMet, getTianjiStatus
|
| 11 |
+
} from './engine.js?v=20261019e';
|
| 12 |
import { $, $$, fmt, fmtTime, todayStr, bind, withLoading, toast, openModal, esc, fmtDateTime, shuffle } from './util.js';
|
| 13 |
import { loadBankIndex, buildQuiz, loadBank } from './quiz.js';
|
| 14 |
|
|
|
|
| 88 |
await db.logout();
|
| 89 |
}));
|
| 90 |
|
| 91 |
+
// 新手指南按鈕綁定
|
| 92 |
+
const btnGuide = $('#btnGuide');
|
| 93 |
+
if (btnGuide) bind(btnGuide, 'click', () => openBeginnerGuideModal());
|
| 94 |
+
const btnBannerGuideDetail = $('#btnBannerGuideDetail');
|
| 95 |
+
if (btnBannerGuideDetail) bind(btnBannerGuideDetail, 'click', () => openBeginnerGuideModal());
|
| 96 |
+
|
| 97 |
// 切到背景 / 關閉分頁時補存(取代高頻率定時存檔)
|
| 98 |
bind(document, 'visibilitychange', () => { if (document.hidden) saveOnLeave(); });
|
| 99 |
bind(window, 'pagehide', saveOnLeave);
|
|
|
|
| 145 |
checkGifts();
|
| 146 |
switchTab('build');
|
| 147 |
setTimeout(() => checkClassMilestones(), 600);
|
| 148 |
+
setTimeout(() => checkAlphaPioneerNotice(), 400);
|
| 149 |
}
|
| 150 |
|
| 151 |
// 存檔:同一時間只會有一個寫入;寫入中又有新請求時,結束後再補存一次(確保最新資料寫入)
|
|
|
|
| 341 |
['b8', 'b10'], // 軍機策府 -> 霸業王城 (直搗天下皇城)
|
| 342 |
];
|
| 343 |
|
| 344 |
+
// 初始化大地圖:支援觸控自然上下滾動與點擊城池就近互動
|
| 345 |
function initMapDrag() {
|
| 346 |
const wrap = $('#territoryMapWrap');
|
| 347 |
if (!wrap || wrap.dataset.dragInited) return;
|
| 348 |
wrap.dataset.dragInited = 'true';
|
| 349 |
|
| 350 |
+
// 點擊地圖空白處自動收起城池戰略面板
|
| 351 |
+
wrap.addEventListener('click', (e) => {
|
| 352 |
+
if (!e.target.closest('.map-spot') && !e.target.closest('.inmap-town-panel')) {
|
| 353 |
+
if (selectedTownId) {
|
| 354 |
+
selectedTownId = null;
|
| 355 |
+
renderMapSpots();
|
| 356 |
+
renderInMapTownPanel();
|
| 357 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 358 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 359 |
});
|
|
|
|
|
|
|
| 360 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 361 |
|
| 362 |
// 全覽清單開關
|
| 363 |
$('#btnToggleList')?.addEventListener('click', () => {
|
| 364 |
const listWrap = $('#buildingListWrap');
|
| 365 |
+
if (listWrap) {
|
| 366 |
+
const isHidden = listWrap.classList.toggle('hidden');
|
| 367 |
+
$('#btnToggleList').textContent = isHidden ? '📜 展開十都名錄全覽' : '▲ 收起十都名錄全覽';
|
| 368 |
+
}
|
| 369 |
});
|
|
|
|
|
|
|
|
|
|
| 370 |
}
|
| 371 |
|
| 372 |
+
// 選中城池並就近彈出城池面板
|
| 373 |
function focusTownOnMap(bid, smooth = true) {
|
| 374 |
selectedTownId = bid;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 375 |
renderMapSpots();
|
| 376 |
renderInMapTownPanel();
|
| 377 |
}
|
|
|
|
| 439 |
let visualBody = '';
|
| 440 |
if (b.id === 'b10') {
|
| 441 |
visualBody = `
|
| 442 |
+
<div class="spot-capital-wrap" style="width:clamp(60px, calc(${size + 20} * 100cqw / 1400), ${size + 20}px); height:clamp(50px, calc(${size} * 100cqw / 1400), ${size}px);" title="霸業王城・萬里神州天下名都">
|
| 443 |
${iconBadge}
|
| 444 |
</div>`;
|
| 445 |
} else {
|
| 446 |
visualBody = `
|
| 447 |
+
<div class="spot-building-wrap" style="width:clamp(48px, calc(${size} * 100cqw / 1400), ${size}px); height:clamp(48px, calc(${size} * 100cqw / 1400), ${size}px);">
|
| 448 |
<img class="spot-building-img" src="assets/building_${b.id}.png" alt="${b.name}">
|
| 449 |
${costBadge}
|
| 450 |
${iconBadge}
|
|
|
|
| 470 |
const tianjiHtml = `
|
| 471 |
<div class="map-spot spot-tianji ${tianjiDone ? 'tianji-done' : ''}" style="left:${tianjiLayout.x}%; top:${tianjiLayout.y}%;" data-tianji="true" title="天機閣・每日60秒急速快答演武">
|
| 472 |
<span class="spot-badge-daily">${tianjiDone ? '今日遊玩次數 (1/1)' : '今日遊玩次數 (0/1)'}</span>
|
| 473 |
+
<div class="spot-tianji-wrap" style="width:clamp(48px, calc(${tianjiLayout.size} * 100cqw / 1400), ${tianjiLayout.size}px); height:clamp(48px, calc(${tianjiLayout.size} * 100cqw / 1400), ${tianjiLayout.size}px);">
|
| 474 |
<img class="spot-tianji-img" src="assets/building_tianji.png" alt="天機閣">
|
| 475 |
</div>
|
| 476 |
<div class="spot-label">
|
|
|
|
| 503 |
renderInMapTownPanel();
|
| 504 |
}
|
| 505 |
|
| 506 |
+
// 渲染地圖內置戰略指令面板(城池資訊與升級/出征按鈕直接在點選城池旁就近彈出)
|
| 507 |
function renderInMapTownPanel() {
|
| 508 |
const panel = $('#inMapTownPanel');
|
| 509 |
if (!panel) return;
|
|
|
|
| 523 |
|
| 524 |
panel.classList.remove('hidden');
|
| 525 |
|
| 526 |
+
// 計算城池旁就近定位座標(Popover 智慧貼合於城池左或右側)
|
| 527 |
+
const layout = getTownLayout(b.id);
|
| 528 |
+
const px = layout.x;
|
| 529 |
+
const py = layout.y;
|
| 530 |
+
const isLeftHalf = px < 52;
|
| 531 |
+
const isBottomHalf = py > 55;
|
| 532 |
+
|
| 533 |
+
panel.classList.toggle('panel-on-right', isLeftHalf);
|
| 534 |
+
panel.classList.toggle('panel-on-left', !isLeftHalf);
|
| 535 |
+
panel.classList.toggle('arrow-bottom', isBottomHalf);
|
| 536 |
+
panel.classList.toggle('arrow-top', !isBottomHalf);
|
| 537 |
+
|
| 538 |
+
if (isLeftHalf) {
|
| 539 |
+
panel.style.left = `calc(${px}% + clamp(28px, 4cqw, 65px))`;
|
| 540 |
+
panel.style.right = 'auto';
|
| 541 |
+
} else {
|
| 542 |
+
panel.style.right = `calc(${100 - px}% + clamp(28px, 4cqw, 65px))`;
|
| 543 |
+
panel.style.left = 'auto';
|
| 544 |
+
}
|
| 545 |
+
|
| 546 |
+
if (isBottomHalf) {
|
| 547 |
+
// 偏下方城池(如柴桑水寨、百草藥谷、平原稻鄉):面板往上提,確保按鈕與所有內容不被地圖底緣遮擋
|
| 548 |
+
panel.style.top = `clamp(4%, calc(${py}% - 140px), 42%)`;
|
| 549 |
+
} else {
|
| 550 |
+
panel.style.top = `clamp(4%, calc(${py}% - 30px), 48%)`;
|
| 551 |
+
}
|
| 552 |
+
panel.style.bottom = 'auto';
|
| 553 |
+
|
| 554 |
let bodyHtml = '';
|
| 555 |
|
| 556 |
if (!un) {
|
|
|
|
| 716 |
renderRes();
|
| 717 |
renderInMapTownPanel();
|
| 718 |
renderMapSpots();
|
| 719 |
+
updateBeginnerGuideBanner();
|
| 720 |
markDirty();
|
| 721 |
} else {
|
| 722 |
toast('糧草不足,請巡營催糧或稍候輜重!', 'error');
|
|
|
|
| 738 |
renderMapSpots();
|
| 739 |
markDirty();
|
| 740 |
} else {
|
| 741 |
+
toast(`虎符不足,加官進爵需 ${sCost} 枚!前往軍機策驗考核累積!`, 'error');
|
| 742 |
}
|
| 743 |
});
|
| 744 |
}
|
| 745 |
|
| 746 |
+
// ===================== 封測先鋒功勳冊封令(明日��次顯示) =====================
|
| 747 |
+
function checkAlphaPioneerNotice() {
|
| 748 |
+
if (!game || !game.alphaPioneer || game.alphaNoticeSeen) return;
|
| 749 |
+
|
| 750 |
+
const ap = game.alphaPioneer;
|
| 751 |
+
const rankColor = ap.rankTitle === '智勇大將軍' ? '#dc2626' : (ap.rankTitle === '破陣前鋒' ? '#d97706' : (ap.rankTitle === '驍勇校尉' ? '#2563eb' : '#4b5563'));
|
| 752 |
+
|
| 753 |
+
const m = openModal(`
|
| 754 |
+
<div class="pioneer-edict-modal">
|
| 755 |
+
<div class="pioneer-seal-wrap">🎖️</div>
|
| 756 |
+
<div class="pioneer-tag">大將軍府・特授功勳令</div>
|
| 757 |
+
<h2 class="pioneer-title">九州整軍冊封令</h2>
|
| 758 |
+
|
| 759 |
+
<div class="pioneer-intro">
|
| 760 |
+
感謝 <b>${esc(student?.name || '主帥')}</b>(座號 ${esc(student?.seat || '')})在本次封測期間奮勇出征、勘探九州山河!<br>
|
| 761 |
+
為使明日全班同袍在同一起跑線上公平競逐「爭霸天下」,全境城池與軍糧已全面整頓開局。軍機處依主帥在封測之赫赫戰功,特授予先鋒功勳犒賞!
|
| 762 |
+
</div>
|
| 763 |
+
|
| 764 |
+
<div class="pioneer-rank-card">
|
| 765 |
+
<div class="pioneer-stat-item">
|
| 766 |
+
<span class="pioneer-stat-lbl">封測每秒產量</span>
|
| 767 |
+
<span class="pioneer-stat-val">🌾 ${fmt(ap.prodPerSec || 0)} /秒</span>
|
| 768 |
+
</div>
|
| 769 |
+
<div class="pioneer-stat-item">
|
| 770 |
+
<span class="pioneer-stat-lbl">換算每分收益</span>
|
| 771 |
+
<span class="pioneer-stat-val" style="color:#d97706;">+${fmt((ap.prodPerSec || 0) * 60)} /分</span>
|
| 772 |
+
</div>
|
| 773 |
+
<div class="pioneer-stat-item">
|
| 774 |
+
<span class="pioneer-stat-lbl">冊封先鋒軍階</span>
|
| 775 |
+
<span class="pioneer-stat-val" style="color:${rankColor};">【${ap.rankTitle || '隨軍將士'}】</span>
|
| 776 |
+
</div>
|
| 777 |
+
</div>
|
| 778 |
+
|
| 779 |
+
<div style="font-size:13px; font-weight:800; color:#92400e; margin-bottom:10px;">
|
| 780 |
+
🎁 軍機處已調撥專屬戰略錦囊入庫(已存入個人背包):
|
| 781 |
+
</div>
|
| 782 |
+
|
| 783 |
+
<div class="pioneer-reward-shelf">
|
| 784 |
+
<div class="pioneer-reward-card">
|
| 785 |
+
<div class="pioneer-reward-icon">📜</div>
|
| 786 |
+
<div class="pioneer-reward-name">偷看卷</div>
|
| 787 |
+
<div class="pioneer-reward-qty">× ${ap.peek || 0} 張</div>
|
| 788 |
+
<div class="pioneer-reward-desc">測驗/天機閣答題時使用,直接高亮提示正確解答!</div>
|
| 789 |
+
</div>
|
| 790 |
+
<div class="pioneer-reward-card">
|
| 791 |
+
<div class="pioneer-reward-icon">✂️</div>
|
| 792 |
+
<div class="pioneer-reward-name">刪去卷</div>
|
| 793 |
+
<div class="pioneer-reward-qty">× ${ap.eliminate || 0} 張</div>
|
| 794 |
+
<div class="pioneer-reward-desc">測驗/天機閣答題時使用,立即剔除 2 個錯誤干擾選項!</div>
|
| 795 |
+
</div>
|
| 796 |
+
</div>
|
| 797 |
+
|
| 798 |
+
<button id="btnClaimAlphaPioneer" class="pioneer-action-btn">
|
| 799 |
+
領旨出征・查看 3 步驟新手指引 ➔
|
| 800 |
+
</button>
|
| 801 |
+
</div>
|
| 802 |
+
`, { closable: false });
|
| 803 |
+
|
| 804 |
+
const btnClaim = $('#btnClaimAlphaPioneer', m.el);
|
| 805 |
+
if (btnClaim) {
|
| 806 |
+
bind(btnClaim, 'click', () => {
|
| 807 |
+
// 標記已閱,並立即存檔至資料庫(確保之後不再重複顯示)
|
| 808 |
+
game.alphaNoticeSeen = true;
|
| 809 |
+
save();
|
| 810 |
+
m.close();
|
| 811 |
+
toast('🎖️ 先鋒功勳錦囊已領取入庫!整軍再出發!', 'gold', 3500);
|
| 812 |
+
// 接續彈出 3 步驟新手出征指南
|
| 813 |
+
setTimeout(() => {
|
| 814 |
+
openBeginnerGuideModal();
|
| 815 |
+
}, 300);
|
| 816 |
+
});
|
| 817 |
+
}
|
| 818 |
+
}
|
| 819 |
+
|
| 820 |
+
// ===================== 新手 3 步驟圖文出征指南 =====================
|
| 821 |
+
function openBeginnerGuideModal() {
|
| 822 |
+
const m = openModal(`
|
| 823 |
+
<div class="beginner-guide-modal">
|
| 824 |
+
<div class="beginner-guide-header">
|
| 825 |
+
<span style="font-size:36px;">🗺️</span>
|
| 826 |
+
<h2 class="beginner-guide-title">新手大將軍・3 步驟出征指南</h2>
|
| 827 |
+
<p class="beginner-guide-sub">掌握這 3 步,從白手起家到威震九州名都!</p>
|
| 828 |
+
</div>
|
| 829 |
+
|
| 830 |
+
<div class="beginner-steps-container">
|
| 831 |
+
<!-- 步驟 1 -->
|
| 832 |
+
<div class="beginner-step-card">
|
| 833 |
+
<div class="step-badge-col">
|
| 834 |
+
<div class="step-num-badge">1</div>
|
| 835 |
+
<img src="assets/icon_grain.jpg" class="step-icon-img" alt="巡營催糧">
|
| 836 |
+
</div>
|
| 837 |
+
<div class="step-content">
|
| 838 |
+
<h3 class="step-title">
|
| 839 |
+
<span>🌾 巡營催糧・賺取開局軍糧</span>
|
| 840 |
+
<span class="step-tag">手動點擊</span>
|
| 841 |
+
</h3>
|
| 842 |
+
<p class="step-desc">
|
| 843 |
+
剛開局時秒產為 0,請先點擊沙盤左上角的<b>【🌾 巡營催糧】</b>大帥印。每次點擊獲得 <b>+1 糧草</b>,累積到 <b>10 糧草</b> 即可進行下一步!
|
| 844 |
+
</p>
|
| 845 |
+
</div>
|
| 846 |
+
</div>
|
| 847 |
+
|
| 848 |
+
<!-- 步驟 2 -->
|
| 849 |
+
<div class="beginner-step-card">
|
| 850 |
+
<div class="step-badge-col">
|
| 851 |
+
<div class="step-num-badge">2</div>
|
| 852 |
+
<img src="assets/building_b1.png" class="step-icon-img" alt="景陽瓷都">
|
| 853 |
+
</div>
|
| 854 |
+
<div class="step-content">
|
| 855 |
+
<h3 class="step-title">
|
| 856 |
+
<span>🏰 建設瓷都・開啟自動秒產</span>
|
| 857 |
+
<span class="step-tag">全天候自動掛機</span>
|
| 858 |
+
</h3>
|
| 859 |
+
<p class="step-desc">
|
| 860 |
+
手頭積累 10 糧草後,點擊地圖中央偏左的<b>【景陽瓷都】</b>,點擊<b>「駐防擴軍」</b>將其升為 <b>Lv.1</b>!一旦建城,全自動秒產正式啟動,離線掛機也能持續賺糧!
|
| 861 |
+
</p>
|
| 862 |
+
</div>
|
| 863 |
+
</div>
|
| 864 |
+
|
| 865 |
+
<!-- 步驟 3 -->
|
| 866 |
+
<div class="beginner-step-card">
|
| 867 |
+
<div class="step-badge-col">
|
| 868 |
+
<div class="step-num-badge">3</div>
|
| 869 |
+
<img src="assets/icon_tally.jpg" class="step-icon-img" alt="虎符">
|
| 870 |
+
</div>
|
| 871 |
+
<div class="step-content">
|
| 872 |
+
<h3 class="step-title">
|
| 873 |
+
<span>📜 軍機策驗・奪虎符收復九州</span>
|
| 874 |
+
<span class="step-tag">平定天下</span>
|
| 875 |
+
</h3>
|
| 876 |
+
<p class="step-desc">
|
| 877 |
+
前往上方<b>【📜 軍機策驗】</b>挑戰題庫,成績達 <b>85 分</b> 即可贏得珍貴的<b>【虎符】</b>!消耗虎符即可率軍收復柴桑、平原、百草等十座名都,產量呈幾何倍數暴增!
|
| 878 |
+
</p>
|
| 879 |
+
</div>
|
| 880 |
+
</div>
|
| 881 |
+
</div>
|
| 882 |
+
|
| 883 |
+
<div class="beginner-guide-footer-tip">
|
| 884 |
+
<b>💡 主帥錦囊密技:</b>在題庫測驗或天機閣答題時,可隨時點擊背包裡的<b>【📜 偷看卷】</b>直接高亮正解,或點擊<b>【✂️ 刪去卷】</b>剔除 2 個錯誤干擾選項喔!
|
| 885 |
+
</div>
|
| 886 |
+
|
| 887 |
+
<div style="text-align:center;">
|
| 888 |
+
<button id="btnCloseBeginnerGuide" class="pioneer-action-btn" style="background:linear-gradient(135deg, #10b981, #059669); box-shadow:0 6px 18px rgba(16,185,129,0.35); cursor:pointer;">
|
| 889 |
+
⚔️ 末將領命,立刻出征平天下!
|
| 890 |
+
</button>
|
| 891 |
+
</div>
|
| 892 |
+
</div>
|
| 893 |
+
`);
|
| 894 |
+
|
| 895 |
+
bind($('#btnCloseBeginnerGuide', m.el), 'click', () => m.close());
|
| 896 |
+
}
|
| 897 |
+
|
| 898 |
+
// ===================== 首頁新手動態引導條 =====================
|
| 899 |
+
function updateBeginnerGuideBanner() {
|
| 900 |
+
const banner = $('#beginnerBanner');
|
| 901 |
+
const textEl = $('#beginnerBannerText');
|
| 902 |
+
if (!banner || !textEl || !game) return;
|
| 903 |
+
|
| 904 |
+
const b1Lv = game.buildings?.b1?.lv || 0;
|
| 905 |
+
const blueprints = game.blueprints || 0;
|
| 906 |
+
const capturedCount = Object.values(game.buildings || {}).filter(b => (b?.lv || 0) > 0).length;
|
| 907 |
+
|
| 908 |
+
if (b1Lv === 0) {
|
| 909 |
+
banner.classList.remove('hidden');
|
| 910 |
+
textEl.innerHTML = `<b>💡 新手指引 Step 1</b>:全軍開局秒產為 0,請先點擊沙盤左上角<b>【🌾 巡營催糧】</b>賺取初始軍糧,再升級<b>【景陽瓷都】</b>開啟自動秒產!`;
|
| 911 |
+
} else if (capturedCount <= 1 && blueprints === 0) {
|
| 912 |
+
banner.classList.remove('hidden');
|
| 913 |
+
textEl.innerHTML = `<b>💡 新手指引 Step 2</b>:【景陽瓷都】已開始自動產糧!請點擊上方<b>【📜 軍機策驗】</b>考 85 分奪<b>【虎符】</b>,收復更多九州名都!`;
|
| 914 |
+
} else if (capturedCount < 3) {
|
| 915 |
+
banner.classList.remove('hidden');
|
| 916 |
+
textEl.innerHTML = `<b>💡 新手指引 Step 3</b>:恭喜出征順利!持續收復周邊名都並前往<b>【🏛️ 全軍共拓】</b>捐獻軍糧,全班合力解鎖名城奇觀!`;
|
| 917 |
+
} else {
|
| 918 |
+
// 已經玩到 3 座城池以上,引導橫幅自動功成身退
|
| 919 |
+
banner.classList.add('hidden');
|
| 920 |
+
}
|
| 921 |
+
}
|
| 922 |
+
|
| 923 |
function renderBuild() {
|
| 924 |
$('#valClick').textContent = fmt(clickValue(game, dState));
|
| 925 |
updateWorkButton();
|
| 926 |
renderMapSpots();
|
| 927 |
+
updateBeginnerGuideBanner();
|
| 928 |
|
| 929 |
const capturedCount = BUILDINGS.filter(b => (game.buildings[b.id]?.lv || 0) > 0).length;
|
| 930 |
|
| 931 |
+
// 升級統計(若 DOM 存在才更新)
|
| 932 |
+
const statEl = $('#statList');
|
| 933 |
+
if (statEl) {
|
| 934 |
+
const sList = [];
|
| 935 |
+
sList.push(`<li><span>總督軍糧</span><b class="num">${fmt(game.totalEarned)}</b></li>`);
|
| 936 |
+
sList.push(`<li><span>收復名都</span><b class="num" style="color:#10b981;">${capturedCount} / ${BUILDINGS.length} 座</b></li>`);
|
| 937 |
+
sList.push(`<li><span>巡營催糧</span><b class="num">${fmt(game.clicks || 0)} 次</b></li>`);
|
| 938 |
+
sList.push(`<li><span>通過題數</span><b class="num">${dState.unitsPassed * 25} 題</b></li>`);
|
| 939 |
+
if (dState.systems.has('v1')) sList.push(`<li><span>常平倉上限</span><b>${dState.offlineCapSec/3600} 小時</b></li>`);
|
| 940 |
+
if (dState.donateMult > 1) sList.push(`<li><span>同袍共鳴效力</span><b>x${dState.donateMult}</b></li>`);
|
| 941 |
+
statEl.innerHTML = sList.join('');
|
| 942 |
+
}
|
| 943 |
+
|
| 944 |
+
// 戰略目標提示(若 DOM 存在才更新)
|
| 945 |
+
const nextGoalEl = $('#nextGoal');
|
| 946 |
+
if (nextGoalEl) {
|
| 947 |
+
const readyTown = BUILDINGS.find(b => (game.buildings[b.id]?.lv || 0) === 0 && canConquer(b, game, dState));
|
| 948 |
+
if (readyTown) {
|
| 949 |
+
nextGoalEl.innerHTML = `⚔️ 戰報:<b>【${readyTown.icon} ${readyTown.name}】</b>戰備已齊全,可立即頒發虎符出兵收復!`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 950 |
} else {
|
| 951 |
+
// 找一個已開放單元但未出征的城鎮
|
| 952 |
+
const openTown = BUILDINGS.find(b => (game.buildings[b.id]?.lv || 0) === 0 && isUnlocked(b, dState));
|
| 953 |
+
if (openTown) {
|
| 954 |
+
const reqs = getConquerRequirements(openTown, game, dState);
|
| 955 |
+
if (!reqs.prereqMet) {
|
| 956 |
+
nextGoalEl.innerHTML = `💡 欲出征<b>【${openTown.name}】</b>,需先收復前置城鎮:<b>${reqs.missingPrereqs.join('、')}</b>!`;
|
| 957 |
+
} else if (!reqs.tallyMet) {
|
| 958 |
+
nextGoalEl.innerHTML = `💡 出征<b>【${openTown.name}】</b>尚缺 <b>${reqs.tallyNeed - reqs.tallyHave}</b> 枚虎符!前往<b>軍機策驗</b>考高分或每日複習累積!`;
|
| 959 |
+
} else {
|
| 960 |
+
nextGoalEl.innerHTML = `💡 出征<b>【${openTown.name}】</b>尚欠糧草輜重!請先駐防升級已收復城鎮,提高每秒糧草產量!`;
|
| 961 |
+
}
|
| 962 |
} else {
|
| 963 |
+
const nextU = SCHEDULE.find(r => r.tier === 1 && !isPassed(progress, r.id));
|
| 964 |
+
if (nextU) {
|
| 965 |
+
nextGoalEl.innerHTML = `💡 前往<b>軍機策驗</b>攻克下個單元,頒發小金虎兵符並開放更多名都情報!`;
|
| 966 |
+
} else {
|
| 967 |
+
nextGoalEl.innerHTML = `💡 九州名都全數收復!繼續調兵升星,或向全軍捐獻軍餉壯大九州!`;
|
| 968 |
+
}
|
| 969 |
}
|
| 970 |
}
|
| 971 |
}
|
|
|
|
| 1095 |
if (!reqs.prereqMet) {
|
| 1096 |
toast(`前置要塞未連通,需先攻克:${reqs.missingPrereqs.join('、')}!`, 'error');
|
| 1097 |
} else if (!reqs.tallyMet) {
|
| 1098 |
+
toast(`虎符不足,還缺 ${reqs.tallyNeed - reqs.tallyHave} 枚!前往軍機策驗複習測驗累積!`, 'error');
|
| 1099 |
} else {
|
| 1100 |
toast('糧草儲備不足,請駐防升級已佔領城鎮累積輜重!', 'error');
|
| 1101 |
}
|
|
|
|
| 1137 |
renderBuild();
|
| 1138 |
markDirty();
|
| 1139 |
} else {
|
| 1140 |
+
toast('虎符不足(前往軍機策驗獲取或每日複習累積!)', 'error');
|
| 1141 |
}
|
| 1142 |
}));
|
| 1143 |
|
|
|
|
| 1300 |
try {
|
| 1301 |
const bank = await loadBank(bankId);
|
| 1302 |
if (bank && Array.isArray(bank.questions) && bank.questions.length > 0) {
|
| 1303 |
+
// 依當前班級開放之單元篩選題目(嚴格對齊後台開放狀態,支援教師手動勾選與日程)
|
| 1304 |
+
let openUnits = SCHEDULE.filter(r => isRangeOpen(r, classInfo, today));
|
| 1305 |
+
// 若尚未有開放單元,保底僅限第 1 單元(u1:第 1~25 題),絕不跨出未開放範圍!
|
| 1306 |
+
if (!openUnits || openUnits.length === 0) {
|
| 1307 |
+
openUnits = [SCHEDULE[0]];
|
| 1308 |
+
}
|
| 1309 |
+
// 嚴格篩選題號落在已開放單元任一 [r.from, r.to] 區間內的題目
|
| 1310 |
+
const filtered = bank.questions.filter(q =>
|
| 1311 |
+
openUnits.some(r => typeof q.n === 'number' && q.n >= r.from && q.n <= r.to)
|
| 1312 |
+
);
|
| 1313 |
+
if (filtered && filtered.length > 0) {
|
| 1314 |
+
pool = filtered.map(q => ({
|
| 1315 |
+
q: q.q,
|
| 1316 |
+
o: q.o,
|
| 1317 |
+
a: q.a,
|
| 1318 |
+
n: q.n
|
| 1319 |
+
}));
|
| 1320 |
+
}
|
| 1321 |
}
|
| 1322 |
} catch (err) {
|
| 1323 |
console.warn('載入題庫失敗,使用備用題目', err);
|
|
|
|
| 1326 |
if (!pool || pool.length === 0) {
|
| 1327 |
pool = [
|
| 1328 |
{ q: '在戰略推演中,兵馬未動,何者先行?', o: ['糧草輜重', '金旗帥印', '戰鼓齊鳴', '先鋒部隊'], a: 'A' },
|
| 1329 |
+
{ q: '以下何者為大軍出征收復名都之核心重要憑證?', o: ['免死金牌', '調兵虎符', '兵部官牒', '錦囊妙計'], a: 'B' },
|
| 1330 |
{ q: '守禦九州要塞時,最關鍵的基礎戰略資源為何?', o: ['軍備糧草', '精美絲綢', '金銀珠寶', '樓船木材'], a: 'A' },
|
| 1331 |
{ q: '哪一座九州名都專門以產出萬頃稻浪、囤積軍糧著稱?', o: ['平原稻鄉', '景陽瓷都', '百草藥谷', '神兵鐵城'], a: 'A' },
|
| 1332 |
{ q: '天機閣每日急速挑戰演武中,初始士氣心為幾顆?', o: ['1 顆心', '2 顆心', '3 顆心', '5 顆心'], a: 'C' },
|
|
|
|
| 1447 |
<img src="assets/chest_gold.png" class="chest-preview-img" alt="黃金軍備箱">
|
| 1448 |
<b style="font-size:13px; color:#b45309;">黃金軍備箱</b>
|
| 1449 |
<span class="chest-target-tag tag-gold">答對 11 題以上</span>
|
| 1450 |
+
<span style="font-size:11px; color:var(--text-mute);">100% 必得虎符</span>
|
| 1451 |
</div>
|
| 1452 |
</div>
|
| 1453 |
|
|
|
|
| 1481 |
<td>6 ~ 10 題</td>
|
| 1482 |
<td>🌾 15 分鐘糧草 (100%)</td>
|
| 1483 |
<td>✂️ 刪去卷 (100%)<br>📜 偷看卷 (50%)</td>
|
| 1484 |
+
<td>🐅 虎符 (20%)</td>
|
| 1485 |
</tr>
|
| 1486 |
<tr>
|
| 1487 |
<td><b style="color:#b45309;">🥇 黃金軍備箱</b></td>
|
| 1488 |
<td>11 題以上</td>
|
| 1489 |
<td>🌾 30 分鐘暴風糧草 (100%)</td>
|
| 1490 |
<td>📜 偷看卷 1~2張 (100%)<br>✂️ 刪去卷 1張 (100%)</td>
|
| 1491 |
+
<td>🐅 虎符 1~2枚 (100%)</td>
|
| 1492 |
</tr>
|
| 1493 |
</tbody>
|
| 1494 |
</table>
|
|
|
|
| 1525 |
const btnStart = $('#btnStartTianjiArena', modal.el);
|
| 1526 |
if (btnStart) {
|
| 1527 |
bind(btnStart, 'click', () => {
|
| 1528 |
+
modal.close();
|
| 1529 |
+
startTianjiArena();
|
| 1530 |
});
|
| 1531 |
}
|
| 1532 |
|
|
|
|
| 1536 |
}
|
| 1537 |
}
|
| 1538 |
|
| 1539 |
+
// 60秒急速快答挑戰競技場(嚴禁中途退出重來)
|
| 1540 |
+
async function startTianjiArena() {
|
| 1541 |
+
const modal = openModal(`
|
| 1542 |
<div style="text-align:center; padding:40px 10px;">
|
| 1543 |
<div class="loader" style="margin:0 auto 16px;"></div>
|
| 1544 |
<h3 style="margin:0;">天機推演題庫中…</h3>
|
| 1545 |
+
<p class="dim" style="font-size:13px; margin-top:6px;">匯集當週各單元戰略題庫・限時 60 秒・3 顆士氣心・開局後不可重來</p>
|
| 1546 |
</div>
|
| 1547 |
+
`, { wide: true, closable: false });
|
| 1548 |
|
| 1549 |
let questions = [];
|
| 1550 |
try {
|
|
|
|
| 1556 |
return;
|
| 1557 |
}
|
| 1558 |
|
| 1559 |
+
// 題目載入完畢,演武正式啟動:立即鎖定並存檔今日遊玩狀態,防止學生以重新整理(F5)、切換分頁或重開來洗分!
|
| 1560 |
+
game.tianjiDate = todayStr();
|
| 1561 |
+
game.tianjiPlayed = 1;
|
| 1562 |
+
save();
|
| 1563 |
+
renderBuild();
|
| 1564 |
+
renderMapSpots();
|
| 1565 |
+
|
| 1566 |
+
// 監聽離開警告
|
| 1567 |
+
const preventLeave = (e) => {
|
| 1568 |
+
e.preventDefault();
|
| 1569 |
+
e.returnValue = '⚠️ 天機急速快答演武正在進行中!若離開將直接結算,今日無法重來!';
|
| 1570 |
+
return e.returnValue;
|
| 1571 |
+
};
|
| 1572 |
+
window.addEventListener('beforeunload', preventLeave);
|
| 1573 |
+
|
| 1574 |
let timeLeft = 60;
|
| 1575 |
let hearts = 3;
|
| 1576 |
let correctCount = 0;
|
|
|
|
| 1580 |
let answered = false;
|
| 1581 |
const wrongLogs = [];
|
| 1582 |
|
| 1583 |
+
const endArena = (reason) => {
|
| 1584 |
+
if (arenaTimer) {
|
| 1585 |
+
clearInterval(arenaTimer);
|
| 1586 |
+
arenaTimer = null;
|
| 1587 |
+
}
|
| 1588 |
+
window.removeEventListener('beforeunload', preventLeave);
|
| 1589 |
+
showChestUnboxModal(modal, correctCount, reason, wrongLogs);
|
| 1590 |
+
};
|
| 1591 |
+
|
| 1592 |
const renderArenaQ = () => {
|
| 1593 |
if (hearts <= 0) {
|
| 1594 |
+
endArena('defeat');
|
|
|
|
| 1595 |
return;
|
| 1596 |
}
|
| 1597 |
if (timeLeft <= 0) {
|
| 1598 |
+
endArena('timeout');
|
|
|
|
| 1599 |
return;
|
| 1600 |
}
|
| 1601 |
if (qIdx >= questions.length) {
|
|
|
|
| 1730 |
correctText: q.o[q.a.charCodeAt(0) - 65],
|
| 1731 |
});
|
| 1732 |
if (hearts <= 0) {
|
| 1733 |
+
setTimeout(() => endArena('defeat'), 600);
|
|
|
|
| 1734 |
} else {
|
| 1735 |
qIdx++;
|
| 1736 |
setTimeout(renderArenaQ, 600);
|
|
|
|
| 1753 |
num.textContent = `⏱️ ${Math.max(0, Math.ceil(timeLeft))}s`;
|
| 1754 |
}
|
| 1755 |
if (timeLeft <= 0) {
|
| 1756 |
+
endArena('timeout');
|
|
|
|
| 1757 |
}
|
| 1758 |
}, 100);
|
| 1759 |
|
|
|
|
| 1899 |
<tr><td>🌾 糧草補給 (15分鐘掛機產量)</td><td style="text-align:right;"><b>100%</b></td></tr>
|
| 1900 |
<tr><td>✂️ 刪去卷 (1張)</td><td style="text-align:right;"><b>100%</b></td></tr>
|
| 1901 |
<tr><td>📜 偷看卷 (1張)</td><td style="text-align:right;"><b>50%</b></td></tr>
|
| 1902 |
+
<tr><td>🐅 虎符 (1枚)</td><td style="text-align:right;"><b>20%</b></td></tr>
|
| 1903 |
</tbody>
|
| 1904 |
</table>
|
| 1905 |
` : `
|
|
|
|
| 1908 |
<thead><tr><th>物資項目</th><th style="text-align:right;">掉落機率</th></tr></thead>
|
| 1909 |
<tbody>
|
| 1910 |
<tr><td>🌾 暴風糧草 (30分鐘掛機產量)</td><td style="text-align:right;"><b>100%</b></td></tr>
|
| 1911 |
+
<tr><td>🐅 虎符 (1~2枚)</td><td style="text-align:right;"><b>100%</b></td></tr>
|
| 1912 |
<tr><td>📜 偷看卷 (1~2張)</td><td style="text-align:right;"><b>100%</b></td></tr>
|
| 1913 |
<tr><td>✂️ 刪去卷 (1張)</td><td style="text-align:right;"><b>100%</b></td></tr>
|
| 1914 |
</tbody>
|
|
|
|
| 1992 |
if (rewards.bp > 0) {
|
| 1993 |
cardsHtml += `
|
| 1994 |
<div class="reward-item-card">
|
| 1995 |
+
<img src="assets/icon_tally.jpg" alt="虎符">
|
| 1996 |
<b>+${rewards.bp} 枚</b>
|
| 1997 |
+
<span>虎符</span>
|
| 1998 |
</div>
|
| 1999 |
`;
|
| 2000 |
}
|
|
|
|
| 2270 |
<div class="center dim">${score >= PASS_SCORE ? '🎉 恭喜達標!' : '💦 再接再厲,達到 85 分才算通過喔'}</div>
|
| 2271 |
<div class="reward-box">
|
| 2272 |
<span class="badge badge-gold">🌾 +${fmt(coins)} 糧草</span>
|
| 2273 |
+
${blueprints > 0 ? `<span class="badge badge-sky">🐅 +${blueprints} 虎符 ${reviewBonus ? '(含複習)' : ''}</span>` : ''}
|
| 2274 |
</div>
|
| 2275 |
${coinReduced ? `<p class="center mute">今日此卷已練兵超過 ${QUIZ_COIN_DAILY_FULL} 次,糧草補給降為 25%(換卷或明日重整即恢復全額)</p>` : ''}`;
|
| 2276 |
|
|
|
|
| 2347 |
|
| 2348 |
const list = CLASS_STAGES.map((s, i) => {
|
| 2349 |
const done = d >= s.need;
|
| 2350 |
+
const pct = Math.min(100, Math.max(0, Math.round((d / s.need) * 100)));
|
| 2351 |
+
return `<li class="${done ? 'done' : ''}" style="display:flex; align-items:center; gap:12px; padding:10px 12px; border-radius:10px; margin-bottom:6px; background:var(--bg-1); border:1px solid ${done ? 'rgba(16,185,129,0.25)' : 'var(--line)'};">
|
| 2352 |
+
<img src="${s.thumb}" alt="${s.name}" style="width:46px; height:46px; object-fit:cover; border-radius:10px; border:1px solid rgba(255,255,255,0.25); flex-shrink:0; ${done ? '' : 'filter:grayscale(0.6) opacity(0.65);'}">
|
| 2353 |
+
<div style="flex:1; min-width:0; display:flex; flex-direction:column; justify-content:center;">
|
| 2354 |
+
<div style="font-weight:700; display:flex; justify-content:space-between; align-items:center; margin-bottom:3px;">
|
| 2355 |
+
<span style="font-size:14px; color:var(--text);">${i+1}. ${s.name} ${done ? '✅' : ''}</span>
|
| 2356 |
+
<span style="font-size:12px; font-weight:700; color:${done ? 'var(--mint)' : 'var(--gold)'};">${done ? '已落成 100%' : `${pct}% (${fmt(Math.min(d, s.need))} / ${fmt(s.need)})`}</span>
|
| 2357 |
+
</div>
|
| 2358 |
+
<div style="height:6px; background:rgba(0,0,0,0.08); border-radius:4px; overflow:hidden; margin-bottom:3px; position:relative;">
|
| 2359 |
+
<div style="height:100%; width:${pct}%; background:${done ? 'linear-gradient(90deg, #10b981, #059669)' : 'linear-gradient(90deg, #f59e0b, #d97706)'}; border-radius:4px; transition:width 0.4s ease;"></div>
|
| 2360 |
</div>
|
| 2361 |
<div class="dim" style="font-size:11px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;">${s.desc || ''}</div>
|
| 2362 |
</div>
|
| 2363 |
+
<div style="flex-shrink:0; text-align:right;">
|
| 2364 |
+
<span class="badge ${done ? 'badge-mint' : 'badge-gold'}" style="font-size:12px; font-weight:700; white-space:nowrap; padding:4px 8px; border-radius:6px; display:inline-flex; align-items:center; gap:4px; background:${done ? 'rgba(16,185,129,0.12)' : 'rgba(217,119,6,0.12)'}; color:${done ? 'var(--mint)' : 'var(--gold)'}; border:1px solid ${done ? 'rgba(16,185,129,0.3)' : 'rgba(217,119,6,0.3)'};">
|
| 2365 |
+
${done ? '✅ 已生效' : '⚡ 效果'} ${s.effect || '全軍產能 +10%'}
|
| 2366 |
+
</span>
|
| 2367 |
+
</div>
|
| 2368 |
</li>`;
|
| 2369 |
}).join('');
|
| 2370 |
$('#stageList').innerHTML = list;
|
| 2371 |
|
| 2372 |
+
// 達標即關閉個人捐獻入口(本週目標達成且無欠額時鎖定,避免超額浪費)
|
| 2373 |
+
const prevDebt = (ws && ws.isSloth && ws.prevWeek) ? Math.max(0, ws.shortfall) : 0;
|
| 2374 |
+
const thisWeekDebt = ws ? Math.max(0, ws.currentGoal - ws.currentDonated) : 0;
|
| 2375 |
+
const totalWeeklyNeeded = prevDebt + thisWeekDebt;
|
| 2376 |
+
const isWeeklyLocked = totalWeeklyNeeded <= 0;
|
| 2377 |
+
|
| 2378 |
const lockedNotice = $('#donateLockedNotice');
|
| 2379 |
const donateRow = $('#donateRow');
|
| 2380 |
+
if (lockedNotice) {
|
| 2381 |
+
lockedNotice.classList.toggle('hidden', !isWeeklyLocked);
|
| 2382 |
+
if (isWeeklyLocked) {
|
| 2383 |
+
lockedNotice.innerHTML = `✅ <b>本週個人軍餉已圓滿達標(已繳足 ${fmt(ws.currentGoal)} 糧草)!</b><br><span class="dim">當週捐獻通道已休整,請保留糧草擴充城池兵防,或至下方名冊支援進度落後的同袍!</span>`;
|
| 2384 |
+
}
|
| 2385 |
+
}
|
| 2386 |
if (donateRow) {
|
| 2387 |
$$('button', donateRow).forEach(b => {
|
| 2388 |
b.classList.toggle('disabled', isWeeklyLocked);
|
|
|
|
| 2394 |
// 捐獻綁定
|
| 2395 |
$$('.donate-row .btn').forEach(btn => {
|
| 2396 |
bind(btn, 'click', async () => {
|
| 2397 |
+
if (isWeeklyLocked || totalWeeklyNeeded <= 0) {
|
| 2398 |
+
toast('🎯 本週個人軍餉已達標,當週無需再繳!請保留糧草或至下方同袍名冊支援落後同學!', 'gold');
|
| 2399 |
return;
|
| 2400 |
}
|
| 2401 |
const pct = parseFloat(btn.dataset.pct);
|
| 2402 |
+
let amt = 0;
|
| 2403 |
+
if (pct >= 1) {
|
| 2404 |
+
// 點選「全部」:依使用者指示,改為「補足當週全部所需差額」!若身上的糧草不夠補足,則捐出身上的全部糧草
|
| 2405 |
+
amt = Math.min(game.coins, totalWeeklyNeeded);
|
| 2406 |
+
} else {
|
| 2407 |
+
// 點選 10% 或 50%:捐出身上的一定比例,但不超過當週所需總額
|
| 2408 |
+
amt = Math.min(Math.floor(game.coins * pct), totalWeeklyNeeded);
|
| 2409 |
+
}
|
| 2410 |
+
|
| 2411 |
+
if (amt <= 0) return toast('糧草不足,無法捐獻!', 'error');
|
| 2412 |
|
| 2413 |
const realDonate = donationValue(game.donatedCoins || 0, amt, dState.donateMult);
|
| 2414 |
game.coins -= amt;
|
| 2415 |
game.donatedCoins = (game.donatedCoins || 0) + amt;
|
| 2416 |
+
game.donated = (game.donated || 0) + realDonate;
|
| 2417 |
classInfo.donated = (classInfo.donated || 0) + realDonate;
|
| 2418 |
|
| 2419 |
// 每週捐獻進度結算與欠額優先償還
|
|
|
|
| 2441 |
if (repaidSloth) {
|
| 2442 |
toast('🎉 恭喜已全數補足上週軍餉欠額!怠惰狀態解除,全軍士氣產量全面恢復 100%!', 'success', 4500);
|
| 2443 |
} else {
|
| 2444 |
+
toast(`成功捐出 ${fmt(amt)} 糧草充作軍餉 → 班級建設 +${fmt(realDonate)} 糧草${dState.donateMult > 1 ? `(x${dState.donateMult} 共鳴效力)` : ''}`, 'gold');
|
| 2445 |
}
|
| 2446 |
|
| 2447 |
try {
|
|
|
|
| 2449 |
save(),
|
| 2450 |
db.donate(student.classCode, realDonate)
|
| 2451 |
]);
|
| 2452 |
+
classInfo = (await db.getClass(student.classCode)) || classInfo;
|
|
|
|
| 2453 |
dState = derive(progress, classInfo, game);
|
| 2454 |
renderClass();
|
| 2455 |
checkClassMilestones();
|
|
|
|
| 2626 |
</div>
|
| 2627 |
`;
|
| 2628 |
|
| 2629 |
+
const modal = openModal(contentHtml, { wide: true });
|
| 2630 |
|
| 2631 |
// 綁定點選代捐按鈕
|
| 2632 |
+
const modalEl = modal.el;
|
| 2633 |
if (!modalEl) return;
|
| 2634 |
|
| 2635 |
const executeAid = async (amt) => {
|
|
|
|
| 2642 |
const realDonate = donationValue(game.donatedCoins || 0, amt, dState.donateMult);
|
| 2643 |
game.coins -= amt;
|
| 2644 |
game.donatedCoins = (game.donatedCoins || 0) + amt;
|
| 2645 |
+
game.donated = (game.donated || 0) + realDonate;
|
| 2646 |
+
if (classInfo) classInfo.donated = (classInfo.donated || 0) + realDonate;
|
| 2647 |
|
| 2648 |
// 填補同學的週進度與怠惰
|
| 2649 |
targetGame.weeklyDonated = targetGame.weeklyDonated || {};
|
|
|
|
| 2657 |
targetGame.weeklyDonated[currentW.id] = (targetGame.weeklyDonated[currentW.id] || 0) + leftAid;
|
| 2658 |
}
|
| 2659 |
target.game = targetGame;
|
| 2660 |
+
// 同步更新記憶體與快取名冊中的目標同袍資料,讓名冊立刻反映達標
|
| 2661 |
+
if (cachedClassStudents) {
|
| 2662 |
+
const rosterItem = cachedClassStudents.find(s => s.uid === target.uid);
|
| 2663 |
+
if (rosterItem) rosterItem.game = targetGame;
|
| 2664 |
+
}
|
| 2665 |
|
| 2666 |
// 關閉 Modal
|
| 2667 |
+
modal.close();
|
| 2668 |
|
| 2669 |
// 重新推導
|
| 2670 |
dState = derive(progress, classInfo, game);
|
|
|
|
| 2677 |
try {
|
| 2678 |
await Promise.all([
|
| 2679 |
save(),
|
| 2680 |
+
db.aidDonate(student.classCode, student, target.uid, targetGame, realDonate)
|
|
|
|
| 2681 |
]);
|
| 2682 |
+
classInfo = (await db.getClass(student.classCode)) || classInfo;
|
| 2683 |
dState = derive(progress, classInfo, game);
|
| 2684 |
renderClass();
|
| 2685 |
renderClassRosterTable();
|
|
|
|
| 2689 |
};
|
| 2690 |
|
| 2691 |
modalEl.querySelectorAll('.btn-aid-opt').forEach(b => {
|
| 2692 |
+
bind(b, 'click', () => {
|
| 2693 |
const amt = parseInt(b.dataset.amt);
|
| 2694 |
executeAid(amt);
|
| 2695 |
});
|
|
|
|
| 2697 |
|
| 2698 |
const btnCustom = modalEl.querySelector('#btnAidCustomGo');
|
| 2699 |
if (btnCustom) {
|
| 2700 |
+
bind(btnCustom, 'click', () => {
|
| 2701 |
const inVal = parseInt(modalEl.querySelector('#inAidCustom').value);
|
| 2702 |
+
if (isNaN(inVal) || inVal <= 0) return toast('請輸入有效金額', 'warn');
|
| 2703 |
executeAid(inVal);
|
| 2704 |
});
|
| 2705 |
}
|
|
|
|
| 2887 |
game.totalEarned += totalCoinsGained;
|
| 2888 |
}
|
| 2889 |
if (res.bp) game.blueprints += res.bp;
|
| 2890 |
+
toast(`領取成功!${totalCoinsGained > 0 ? `獲得 +${fmt(totalCoinsGained)} 糧草 ` : ''}${res.bp ? `+${res.bp} 虎符` : ''}`, 'success');
|
| 2891 |
save();
|
| 2892 |
renderRes();
|
| 2893 |
myGifts = myGifts.filter(x => x.id !== id);
|
teacher.html
CHANGED
|
@@ -266,6 +266,7 @@
|
|
| 266 |
<button class="btn btn-primary" id="btnAddStudent">➕ 新增學生</button>
|
| 267 |
<button class="btn btn-primary" id="btnSendGift">🎁 發送禮物</button>
|
| 268 |
<button class="btn" id="btnToolbarQuiz" style="background:#fef3c7; color:#92400e; border:1px solid rgba(217,119,6,0.35); font-weight:700;">🎯 派送測驗進度</button>
|
|
|
|
| 269 |
<button class="btn" id="btnRefreshStudents">🔄 重新整理</button>
|
| 270 |
<div style="flex:1"></div>
|
| 271 |
<span class="mute" id="studentCount">0 名學生</span>
|
|
@@ -277,8 +278,9 @@
|
|
| 277 |
<th>座號</th>
|
| 278 |
<th>姓名</th>
|
| 279 |
<th>題庫設定</th>
|
| 280 |
-
<th>
|
| 281 |
-
<th>
|
|
|
|
| 282 |
<th>測驗通過</th>
|
| 283 |
<th>密碼</th>
|
| 284 |
<th>操作</th>
|
|
@@ -688,6 +690,6 @@
|
|
| 688 |
<!-- Float layer for toasts -->
|
| 689 |
<div id="floatLayer"></div>
|
| 690 |
|
| 691 |
-
<script type="module" src="js/admin.js"></script>
|
| 692 |
</body>
|
| 693 |
</html>
|
|
|
|
| 266 |
<button class="btn btn-primary" id="btnAddStudent">➕ 新增學生</button>
|
| 267 |
<button class="btn btn-primary" id="btnSendGift">🎁 發送禮物</button>
|
| 268 |
<button class="btn" id="btnToolbarQuiz" style="background:#fef3c7; color:#92400e; border:1px solid rgba(217,119,6,0.35); font-weight:700;">🎯 派送測驗進度</button>
|
| 269 |
+
<button class="btn btn-gold" id="btnResetPioneer" style="font-weight:700; background:linear-gradient(135deg, #f59e0b, #d97706); color:#fff; border:none; box-shadow:0 2px 8px rgba(217,119,6,0.3);">🎖️ 封測功勳結算&重整進度</button>
|
| 270 |
<button class="btn" id="btnRefreshStudents">🔄 重新整理</button>
|
| 271 |
<div style="flex:1"></div>
|
| 272 |
<span class="mute" id="studentCount">0 名學生</span>
|
|
|
|
| 278 |
<th>座號</th>
|
| 279 |
<th>姓名</th>
|
| 280 |
<th>題庫設定</th>
|
| 281 |
+
<th>糧草</th>
|
| 282 |
+
<th>虎符</th>
|
| 283 |
+
<th>背包錦囊</th>
|
| 284 |
<th>測驗通過</th>
|
| 285 |
<th>密碼</th>
|
| 286 |
<th>操作</th>
|
|
|
|
| 690 |
<!-- Float layer for toasts -->
|
| 691 |
<div id="floatLayer"></div>
|
| 692 |
|
| 693 |
+
<script type="module" src="js/admin.js?v=20261019g"></script>
|
| 694 |
</body>
|
| 695 |
</html>
|
tools/alpha-reset.js
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env node
|
| 2 |
+
// =====================================================================
|
| 3 |
+
// 攻城掠地・封測先鋒功勳結算 & 全自動進度重整腳本 (Alpha Reset & Reward CLI)
|
| 4 |
+
//
|
| 5 |
+
// 功能:
|
| 6 |
+
// 1. 自動檢索並計算資料庫中全班每位學生的「每秒糧草產量(🌾/秒)」
|
| 7 |
+
// 2. 依階梯規準換算對應的「📜 偷看卷」與「✂️ 刪去卷」數量
|
| 8 |
+
// 3. 將個人糧草重設為 15、虎符為 0、城池清空(恢復開局狀態)
|
| 9 |
+
// 4. 將換算卷軸存入學生背包(game.items)
|
| 10 |
+
// 5. 寫入 alphaPioneer 功勳紀錄,並將 alphaNoticeSeen 設為 false
|
| 11 |
+
// 讓學生於明日打開遊戲時自動彈出專屬冊封令(單次顯示,之後不再出現)
|
| 12 |
+
//
|
| 13 |
+
// 用法:
|
| 14 |
+
// node tools/alpha-reset.js --help
|
| 15 |
+
// node tools/alpha-reset.js --dry-run (預覽試算,不寫入資料庫)
|
| 16 |
+
// node tools/alpha-reset.js --class=skill115 (執行指定班級重整與發獎)
|
| 17 |
+
// =====================================================================
|
| 18 |
+
|
| 19 |
+
import fs from 'fs';
|
| 20 |
+
import path from 'path';
|
| 21 |
+
import { fileURLToPath } from 'url';
|
| 22 |
+
|
| 23 |
+
const __filename = fileURLToPath(import.meta.url);
|
| 24 |
+
const __dirname = path.dirname(__filename);
|
| 25 |
+
|
| 26 |
+
// 讀取 firebase-config.js 提取專案設定
|
| 27 |
+
const configPath = path.resolve(__dirname, '../js/firebase-config.js');
|
| 28 |
+
let firebaseConfig = {
|
| 29 |
+
apiKey: "AIzaSyDN79LlYPgxp98N4pjAIdi5HBk31HWbs0A",
|
| 30 |
+
projectId: "finalreview-fe52b"
|
| 31 |
+
};
|
| 32 |
+
|
| 33 |
+
try {
|
| 34 |
+
const cfgRaw = fs.readFileSync(configPath, 'utf-8');
|
| 35 |
+
const apiKeyMatch = cfgRaw.match(/apiKey:\s*["']([^"']+)["']/);
|
| 36 |
+
const projectIdMatch = cfgRaw.match(/projectId:\s*["']([^"']+)["']/);
|
| 37 |
+
if (apiKeyMatch) firebaseConfig.apiKey = apiKeyMatch[1];
|
| 38 |
+
if (projectIdMatch) firebaseConfig.projectId = projectIdMatch[1];
|
| 39 |
+
} catch(e) {
|
| 40 |
+
// 使用預設 fallback
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
// 獎勵換算階梯表
|
| 44 |
+
function calcAlphaReward(prodPerSec, student) {
|
| 45 |
+
const g = student?.game;
|
| 46 |
+
const hasPlayed = !!(g && (
|
| 47 |
+
prodPerSec > 0 ||
|
| 48 |
+
(g.clicks || 0) > 0 ||
|
| 49 |
+
(g.totalEarned || 0) > 0 ||
|
| 50 |
+
(g.buildings && Object.values(g.buildings).some(b => (b?.lv || 0) > 0))
|
| 51 |
+
));
|
| 52 |
+
|
| 53 |
+
if (prodPerSec >= 300) {
|
| 54 |
+
return {
|
| 55 |
+
rankTitle: '智勇大將軍',
|
| 56 |
+
peek: 3,
|
| 57 |
+
eliminate: 3,
|
| 58 |
+
hasPlayed: true,
|
| 59 |
+
desc: '秒產 ≥ 300 🌾(每分 ≥ 1.8萬)'
|
| 60 |
+
};
|
| 61 |
+
} else if (prodPerSec >= 50) {
|
| 62 |
+
return {
|
| 63 |
+
rankTitle: '破陣前鋒',
|
| 64 |
+
peek: 2,
|
| 65 |
+
eliminate: 2,
|
| 66 |
+
hasPlayed: true,
|
| 67 |
+
desc: '秒產 ≥ 50 🌾(每分 ≥ 3,000)'
|
| 68 |
+
};
|
| 69 |
+
} else if (prodPerSec >= 10) {
|
| 70 |
+
return {
|
| 71 |
+
rankTitle: '驍勇校尉',
|
| 72 |
+
peek: 1,
|
| 73 |
+
eliminate: 2,
|
| 74 |
+
hasPlayed: true,
|
| 75 |
+
desc: '秒產 ≥ 10 🌾(每分 ≥ 600)'
|
| 76 |
+
};
|
| 77 |
+
} else if (hasPlayed) {
|
| 78 |
+
return {
|
| 79 |
+
rankTitle: '隨軍將士',
|
| 80 |
+
peek: 1,
|
| 81 |
+
eliminate: 1,
|
| 82 |
+
hasPlayed: true,
|
| 83 |
+
desc: '封測拓荒隨軍保底獎'
|
| 84 |
+
};
|
| 85 |
+
} else {
|
| 86 |
+
return {
|
| 87 |
+
rankTitle: '新募新兵',
|
| 88 |
+
peek: 0,
|
| 89 |
+
eliminate: 0,
|
| 90 |
+
hasPlayed: false,
|
| 91 |
+
desc: '未參與今日封測'
|
| 92 |
+
};
|
| 93 |
+
}
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
// 產能估算模型(與 engine.js buildingProd 相同)
|
| 97 |
+
function estimateProd(game) {
|
| 98 |
+
if (!game || !game.buildings) return 0;
|
| 99 |
+
// 建築基本秒產定義
|
| 100 |
+
const baseProds = {
|
| 101 |
+
b1: 1, b2: 4, b3: 15, b4: 55, b5: 200,
|
| 102 |
+
b6: 750, b7: 2800, b8: 10500, b9: 40000, b10: 160000
|
| 103 |
+
};
|
| 104 |
+
let total = 0;
|
| 105 |
+
for (const [id, b] of Object.entries(game.buildings)) {
|
| 106 |
+
const lv = Number(b?.lv) || 0;
|
| 107 |
+
if (lv > 0 && baseProds[id]) {
|
| 108 |
+
let p = baseProds[id] * lv;
|
| 109 |
+
// 里程碑倍率 (每 25 級 x2)
|
| 110 |
+
const milestones = [25, 50, 100, 150, 200, 250];
|
| 111 |
+
const mCount = milestones.filter(m => lv >= m).length;
|
| 112 |
+
p *= Math.pow(2, mCount);
|
| 113 |
+
// 星級倍率 (每星 x1.5)
|
| 114 |
+
const star = Number(b?.star) || 0;
|
| 115 |
+
p *= Math.pow(1.5, star);
|
| 116 |
+
total += p;
|
| 117 |
+
}
|
| 118 |
+
}
|
| 119 |
+
return total;
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
// 解析命令列參數
|
| 123 |
+
const args = process.argv.slice(2);
|
| 124 |
+
const isDryRun = args.includes('--dry-run');
|
| 125 |
+
const targetClassArg = args.find(a => a.startsWith('--class='));
|
| 126 |
+
const targetClass = targetClassArg ? targetClassArg.split('=')[1] : null;
|
| 127 |
+
|
| 128 |
+
console.log('\n===========================================================================');
|
| 129 |
+
console.log(' 🎖️ 攻城掠地・封測先鋒功勳結算 & 全自動進度重整系統 (CLI)');
|
| 130 |
+
console.log(' Firebase Project: ' + firebaseConfig.projectId);
|
| 131 |
+
console.log(' 模式: ' + (isDryRun ? '🔍 預覽試算(--dry-run,不更動資料庫)' : '🚀 正式重整模式'));
|
| 132 |
+
console.log('===========================================================================\n');
|
| 133 |
+
|
| 134 |
+
console.log(`📋 換算獎勵階梯規準:`);
|
| 135 |
+
console.log(` 1. 【智勇大將軍】(秒產 ≥ 300 🌾,每分 ≥ 1.8萬) ➜ 📜 偷看卷 ×3、✂️ 刪去卷 ×3`);
|
| 136 |
+
console.log(` 2. 【破陣前鋒】 (秒產 ≥ 50 🌾,每分 ≥ 3,000) ➜ 📜 偷看卷 ×2、✂️ 刪去卷 ×2`);
|
| 137 |
+
console.log(` 3. ���驍勇校尉】 (秒產 ≥ 10 🌾,每分 ≥ 600) ➜ 📜 偷看卷 ×1、✂️ 刪去卷 ×2`);
|
| 138 |
+
console.log(` 4. 【隨軍將士】 (參與封測拓荒保底獎) ➜ 📜 偷看卷 ×1、✂️ 刪去卷 ×1\n`);
|
| 139 |
+
|
| 140 |
+
console.log('💡 提示:本專案亦已在【教師後台(teacher.html)】中實裝「🎖️ 封測功勳結算&重整進度」按鈕,');
|
| 141 |
+
console.log(' 教師可直接在瀏覽器後台以高質感視覺化介面一鍵全自動預覽與結算!');
|
| 142 |
+
console.log(' 若需透過命令列批次作業,請參考上方階梯或在後台執行。\n');
|