diff --git a/public/main.js b/public/main.js index ba3f53a..f3e4941 100644 --- a/public/main.js +++ b/public/main.js @@ -216,6 +216,8 @@ function main() { this.__VERSION__ = '2.10.0'; this.__VERSION_CODE__ = 510; + + this.timestamp = 0; } // >>>> body end @@ -468,6 +470,7 @@ main.prototype.importFonts = function (fonts) { font + '"; src: url("project/fonts/' + font + + (main.pluginUseCompress ? '-' + main.timestamp : '') + '.ttf") format("truetype"); }'; }); style.innerHTML = html; diff --git a/public/project/floors/MT16.js b/public/project/floors/MT16.js index bb29a57..85e4707 100644 --- a/public/project/floors/MT16.js +++ b/public/project/floors/MT16.js @@ -70,7 +70,7 @@ main.floors.MT16= }, { "type": "function", - "function": "function(){\ncore.status.maps.MT14.canFlyFrom = false;\ncore.chaseInit1();\n}" + "function": "function(){\ncore.status.maps.MT14.canFlyFrom = false;\ncore.plugin.chase.chaseInit1();\n}" }, { "type": "show", diff --git a/public/project/plugin/chase.js b/public/project/plugin/chase.js new file mode 100644 index 0000000..5f81107 --- /dev/null +++ b/public/project/plugin/chase.js @@ -0,0 +1,23 @@ +export function chaseInit1() { + const ids = ['MT13', 'MT14', 'MT15']; + const toRemove = []; + ids.forEach(v => { + core.status.maps[v].cannotMoveDirectly = true; + core.extractBlocks(v); + core.status.maps[v].blocks.forEach(vv => { + if ( + ['animates', 'items'].includes(vv.event.cls) && + !vv.event.id.endsWith('Portal') + ) { + toRemove.push([vv.x, vv.y, v]); + } + }); + }); + toRemove.forEach(v => { + core.removeBlock(...v); + }); +} + +core.plugin.chase = { + chaseInit1 +}; diff --git a/public/project/plugin/index.js b/public/project/plugin/index.js index 076069e..a71f457 100644 --- a/public/project/plugin/index.js +++ b/public/project/plugin/index.js @@ -16,6 +16,7 @@ import * as skillTree from './skillTree.js'; import * as study from './study.js'; import * as towerBoss from './towerBoss.js'; import * as utils from './utils.js'; +import * as chase from './chase.js'; export { halo, @@ -28,5 +29,6 @@ export { skillTree, study, towerBoss, - utils + utils, + chase }; diff --git a/script/build.ts b/script/build.ts index b4b4459..e5bd6f5 100644 --- a/script/build.ts +++ b/script/build.ts @@ -6,6 +6,7 @@ import * as babel from '@babel/core'; import * as rollup from 'rollup'; (async function () { + const timestamp = Date.now(); // 1. 去除未使用的文件 const data = (() => { const data = fss.readFileSync('./public/project/data.js', 'utf-8'); @@ -98,6 +99,14 @@ import * as rollup from 'rollup'; })() ) ]); + await Promise.all([ + ...fonts.map(v => { + return fse.rename( + `./dist/project/fonts/${v}.ttf`, + `./dist/project/fonts/${v}-${timestamp}.ttf` + ); + }) + ]); } catch (e) { await fse.copy('./public/project/fonts', './dist/project/fonts'); } @@ -122,10 +131,12 @@ import * as rollup from 'rollup'; // 4. 压缩main.js try { // 先获取不能压缩的部分 - const main = (await fs.readFile('./public/main.js', 'utf-8')).replace( - /this.pluginUseCompress\s*=\s*false\;/, - 'this.pluginUseCompress = true;' - ); + const main = (await fs.readFile('./public/main.js', 'utf-8')) + .replace( + /this.pluginUseCompress\s*=\s*false\;/, + 'this.pluginUseCompress = true;' + ) + .replace('this.timestamp = 0', `this.timestamp = ${timestamp};`); const endIndex = main.indexOf('// >>>> body end'); const nonCompress = main.slice(0, endIndex); diff --git a/src/plugin/chase/chase1.ts b/src/plugin/chase/chase1.ts index 72f541e..7b2c3e7 100644 --- a/src/plugin/chase/chase1.ts +++ b/src/plugin/chase/chase1.ts @@ -123,23 +123,7 @@ export const camera1: ChaseCameraData[] = [ * 追逐战开始前的初始化函数,移除所有血瓶和门等 */ export function init1() { - const ids: FloorIds[] = ['MT13', 'MT14', 'MT15']; - const toRemove: [number, number, FloorIds][] = []; - ids.forEach(v => { - core.status.maps[v].cannotMoveDirectly = true; - core.extractBlocks(v); - core.status.maps[v].blocks.forEach(vv => { - if ( - ['animates', 'items'].includes(vv.event.cls) && - !vv.event.id.endsWith('Portal') - ) { - toRemove.push([vv.x, vv.y, v]); - } - }); - }); - toRemove.forEach(v => { - core.removeBlock(...v); - }); + return core.plugin.chase.chaseInit1(); } export function chaseShake(chase: Chase) { diff --git a/src/types/plugin.d.ts b/src/types/plugin.d.ts index 7422e05..5229d3b 100644 --- a/src/types/plugin.d.ts +++ b/src/types/plugin.d.ts @@ -29,6 +29,7 @@ interface PluginDeclaration study: GamePluginStudy; hero: GamePluginHeroRealStatus; replay: PluginReplay; + chase: PluginChase; skills: Record; skillEffects: SkillEffects; @@ -434,6 +435,10 @@ interface PluginReplay { clip(...replace: string[]): void; } +interface PluginChase { + chaseInit1(): void; +} + interface SkillEffects { jumpIgnoreFloor: FloorIds[]; }