更新离线关卡编辑器,加入单关导入和抓猪关卡转换工具
This commit is contained in:
+30
-17
@@ -2113,14 +2113,12 @@ exports.remapContentUnlocks = remapContentUnlocks;
|
||||
// 启动前的兼容初值;正式启动和工具读取均由 LevelSequence.json 覆盖。
|
||||
exports.MAINLINE_TEMPLATE_SOURCES = {};
|
||||
exports.PREVIOUS_REMOVED_MAINLINE_LEVELS = new Set([
|
||||
90, 103, 120, 144, 152, 160, 175, 185, 202, 210, 225, 240, 253, 272,
|
||||
291, 310, 329, 348, 360, 374, 388, 413, 427, 445, 462, 472, 477, 490,
|
||||
506, 521, 534, 547, 558, 570, 599, 605, 635, 649, 662, 676, 687, 705,
|
||||
727, 739, 753, 767, 778, 794, 808, 819, 832, 849, 866, 881, 894, 917,
|
||||
930, 944, 958, 973, 981, 995, 1010, 1018, 1034, 1041, 1052,
|
||||
90, 103, 120, 144, 152, 160, 175, 185, 202, 210, 225, 240, 253, 272, 291, 310, 329, 348, 360, 374, 388, 413, 427, 445, 462, 472, 477,
|
||||
490, 506, 521, 534, 547, 558, 570, 599, 605, 635, 649, 662, 676, 687, 705, 727, 739, 753, 767, 778, 794, 808, 819, 832, 849, 866, 881,
|
||||
894, 917, 930, 944, 958, 973, 981, 995, 1010, 1018, 1034, 1041, 1052,
|
||||
]);
|
||||
exports.MAINLINE_SOURCE_LEVELS = Object.freeze(Array.from({ length: 1070 }, (_, index) => index + 1));
|
||||
exports.PREVIOUS_MAINLINE_SOURCE_LEVELS = Object.freeze(Array.from({ length: 1070 }, (_, index) => index + 1).filter(level => !exports.PREVIOUS_REMOVED_MAINLINE_LEVELS.has(level)));
|
||||
exports.PREVIOUS_MAINLINE_SOURCE_LEVELS = Object.freeze(Array.from({ length: 1070 }, (_, index) => index + 1).filter((level) => !exports.PREVIOUS_REMOVED_MAINLINE_LEVELS.has(level)));
|
||||
exports.MAINLINE_LEVEL_COUNT = exports.MAINLINE_SOURCE_LEVELS.length;
|
||||
// 主线之外的来源追加在内部读取序列末尾,供逐鹿继续读取;不计入主线关数。
|
||||
exports.CONTENT_SOURCE_LEVELS = exports.MAINLINE_SOURCE_LEVELS;
|
||||
@@ -2129,18 +2127,21 @@ function configureMainlineSequence(order, templates, sourceCount = order.length)
|
||||
exports.MAINLINE_TEMPLATE_SOURCES = Object.freeze({ ...templates });
|
||||
exports.MAINLINE_LEVEL_COUNT = order.length;
|
||||
const active = new Set(order);
|
||||
exports.CONTENT_SOURCE_LEVELS = Object.freeze([...order, ...Array.from({ length: sourceCount }, (_, i) => i + 1).filter(id => !active.has(id))]);
|
||||
exports.CONTENT_SOURCE_LEVELS = Object.freeze([
|
||||
...order,
|
||||
...Array.from({ length: sourceCount }, (_, i) => i + 1).filter((id) => !active.has(id)),
|
||||
]);
|
||||
}
|
||||
function contentDisplayLevel(source) {
|
||||
const index = exports.CONTENT_SOURCE_LEVELS.indexOf(source);
|
||||
if (index < 0)
|
||||
throw new Error('关卡来源不存在:' + source);
|
||||
throw new Error("关卡来源不存在:" + source);
|
||||
return index + 1;
|
||||
}
|
||||
function mainlineDisplayLevel(source) {
|
||||
const index = exports.MAINLINE_SOURCE_LEVELS.indexOf(source);
|
||||
if (index < 0)
|
||||
throw new Error('主线来源关卡不存在:' + source);
|
||||
throw new Error("主线来源关卡不存在:" + source);
|
||||
return index + 1;
|
||||
}
|
||||
function mainlineUnlockLevel(sourceLevel) {
|
||||
@@ -2149,25 +2150,37 @@ function mainlineUnlockLevel(sourceLevel) {
|
||||
function mapMainlineUnlockLevel(sourceLevel, levels, templates) {
|
||||
// 调序可能把高阶敌人提前;解锁必须不晚于最早达到来源门槛的模板关卡。
|
||||
// 新增来源 ID 很大,但难度来自模板,不能因此提前解锁全部内容。
|
||||
const index = levels.findIndex(level => (templates[level] ?? level) >= sourceLevel);
|
||||
const index = levels.findIndex((level) => (templates[level] ?? level) >= sourceLevel);
|
||||
return index < 0 ? levels.length : index + 1;
|
||||
}
|
||||
function remapMainlineRecords(records, sources = exports.MAINLINE_SOURCE_LEVELS) {
|
||||
return Object.fromEntries(sources.map((sourceLevel, index) => [String(index + 1), records[String(sourceLevel)]]));
|
||||
const result = {};
|
||||
sources.forEach((sourceLevel, index) => {
|
||||
result[String(index + 1)] = records[String(sourceLevel)];
|
||||
});
|
||||
return result;
|
||||
}
|
||||
function remapMainlineIndex(index) {
|
||||
const firstAppearances = {};
|
||||
for (const [group, entries] of Object.entries(index.firstAppearances || {})) {
|
||||
firstAppearances[group] = Object.fromEntries(Object.entries(entries).map(([id, appearance]) => [id, {
|
||||
...appearance, displayLevel: mainlineUnlockLevel(appearance.displayLevel),
|
||||
}]));
|
||||
const mappedEntries = {};
|
||||
for (const [id, appearance] of Object.entries(entries)) {
|
||||
mappedEntries[id] = {
|
||||
...appearance,
|
||||
displayLevel: mainlineUnlockLevel(appearance.displayLevel),
|
||||
};
|
||||
}
|
||||
firstAppearances[group] = mappedEntries;
|
||||
}
|
||||
return { ...index, levelCount: exports.MAINLINE_LEVEL_COUNT, firstAppearances };
|
||||
}
|
||||
function remapContentUnlocks(entries) {
|
||||
return entries.map(entry => entry.unlockLevel == null ? { ...entry } : {
|
||||
...entry, unlockLevel: mainlineUnlockLevel(entry.unlockLevel),
|
||||
});
|
||||
return entries.map((entry) => entry.unlockLevel == null
|
||||
? { ...entry }
|
||||
: {
|
||||
...entry,
|
||||
unlockLevel: mainlineUnlockLevel(entry.unlockLevel),
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user