fix(scene): 优化 Live 模式请求非预设关卡时的诊断报错信息

当用户在 ?live=1 下请求旷野或迷宫关卡(如冰冷之原 Level 3)时,明确提示该关卡无单体 LvlPrest 预设,引导切换至资源包 (Pack) 模式浏览。

TAG=agy
CONV=2a1934de-30ef-464e-b3f3-fcbcdbbc49f1
This commit is contained in:
troytt 2026-09-18 12:16:34 +00:00
parent 637854e415
commit 27049a4dac
1 changed files with 18 additions and 4 deletions

View File

@ -60,7 +60,7 @@ import { RoofFadeController } from '../render/roofs.ts'
import { loadCharacterSheet, facingToDirection } from '../game/character.ts'
import { loadMonsterAtlas, type LoadedMonsterArt } from '../game/monster-art.ts'
import { resolveMonsterArtSpec } from '../game/monster-mapping.ts'
import { ACT_NAMES_ZH, sceneNameZh, variantLabelZh } from '../game/level-names-zh.ts'
import { ACT_NAMES_ZH, LEVEL_NAMES_ZH, sceneNameZh, variantLabelZh } from '../game/level-names-zh.ts'
import { GameLoop } from '../sim/loop.ts'
import { KeyboardInput } from '../sim/input.ts'
import type { SceneEntrance, SceneWarp, SceneWaypoint } from '../game/level-links.ts'
@ -910,9 +910,23 @@ async function loadLiveRuntime(
const tables = await loadActTables(archives)
const wantedLevel = param('level', '')
const town: LevelInfo = wantedLevel === ''
? resolveActTown(tables, act)
: resolveLevel(tables, Number(wantedLevel), act)
let town: LevelInfo
try {
town = wantedLevel === ''
? resolveActTown(tables, act)
: resolveLevel(tables, Number(wantedLevel), act)
} catch (err) {
if (wantedLevel !== '') {
const id = Number(wantedLevel)
const nameZh = LEVEL_NAMES_ZH[id] ?? `关卡 ${wantedLevel}`
throw new Error(
`直读归档 (Live) 模式仅支持预设单体地图(如城镇、大教堂、崔斯特瑞姆等);` +
`${nameZh}(Level ${wantedLevel})属于由 DRLG 动态拼装生成的旷野/迷宫关卡,在 MPQ 中没有单一 DS1 预设(无 LvlPrest 记录)。` +
`请去掉 URL 中的 ?live=1 参数,使用资源包 (Pack) 模式加载完整生成的地图。`
)
}
throw err
}
const wantedVariant = wantedQuadrant || param('variant', '')
const variants = town.ds1Names.map(name => name.split('\\').pop() ?? name)
let index = 0