Skip to content

Commit

Permalink
v0.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
lchzh3473 committed Mar 14, 2024
1 parent f7631fe commit 00a6602
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sim-phi/extends",
"version": "0.3.3",
"version": "0.3.4",
"description": "Third-party chart format conversion functions for sim-phi.",
"type": "module",
"main": "dist/index.js",
Expand Down Expand Up @@ -30,13 +30,13 @@
"@babel/plugin-transform-nullish-coalescing-operator": "^7.23.4",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-terser": "^0.4.4",
"@stylistic/eslint-plugin": "^1.5.4",
"@typescript-eslint/eslint-plugin": "^6.19.0",
"eslint": "^8.56.0",
"@stylistic/eslint-plugin": "^1.7.0",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"eslint": "^8.57.0",
"eslint-plugin-rulesdir": "^0.2.2",
"typescript": "^5.3.3",
"vite": "^5.0.12",
"vite-plugin-dts": "^3.7.1"
"typescript": "^5.4.2",
"vite": "^5.1.6",
"vite-plugin-dts": "^3.7.3"
},
"files": [
"dist"
Expand Down
4 changes: 2 additions & 2 deletions src/pec/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ namespace PEC {
}
return result;
}
export function parseRPE(pec: string, filename: string): ReturnType<typeof parseRPE$> {
const result = parseRPE$(pec, filename);
export function parseRPE(pec: string, pathname: string, filename: string): ReturnType<typeof parseRPE$> {
const result = parseRPE$(pec, pathname, filename);
for (const line of result.data.judgeLineList) {
normalizeSpeedEvents(line.speedEvents);
normalizeLineEvents(line.judgeLineDisappearEvents);
Expand Down
4 changes: 2 additions & 2 deletions src/pec/pec2json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ export function parse(pec: string, filename: string): PecParseResult {
linesPec[i.lineId] ??= new LinePec(bpmList.baseBpm);
linesPec[i.lineId].pushNote(type, time, i.offsetX / 115.2, holdTime, speed, i.isAbove === 1, i.isFake !== 0); // 102.4
// if (i.isAbove !== 1 && i.isAbove !== 2) warnings.push(`检测到非法方向:${i.isAbove}(将被视为2)\n位于:"${i.text}"\n来自${filename}`);
if (i.isFake !== 0) warnings.push(`检测到FakeNote(可能无法正常显示)\n位于:"${i.text}"\n来自${filename}`);
if (i.size !== 1) warnings.push(`检测到异常Note(可能无法正常显示)\n位于:"${i.text}"\n来自${filename}`);
if (i.isFake !== 0) warnings.push(`检测到Fake音符(可能无法正常显示)\n位于:"${i.text}"\n来自${filename}`);
if (i.size !== 1) warnings.push(`检测到异常音符(可能无法正常显示)\n位于:"${i.text}"\n来自${filename}`);
}
const isMotion = (i: number) => !isLinear(i) || i === 1;
for (const i of data2.lines) {
Expand Down
8 changes: 4 additions & 4 deletions src/pec/rpe2json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ interface JudgeLineRPEExtends extends JudgeLineRPE {
LineId: number;
judgeLineRPE: LineRPE1;
}
export function parse(pec: string, filename: string): {
export function parse(pec: string, pathname: string, filename: string): {
data: ChartPGS;
messages: BetterMessage[];
info: Record<string, string>;
Expand All @@ -529,7 +529,7 @@ export function parse(pec: string, filename: string): {
if (!meta?.RPEVersion) throw new Error('Invalid rpe file');
const result = { formatVersion: 3, offset: 0, numOfNotes: 0, judgeLineList: [] } as ChartPGS;
const warnings = [] as BetterMessage[];
const warn = (code: number, name: string, message: string) => warnings.push({ host: 'RPE2JSON', code, name, message, target: filename });
const warn = (code: number, name: string, message: string) => warnings.push({ host: 'RPE2JSON', code, name, message, target: pathname });
warn(0, 'RPEVersionNotice', `RPE谱面兼容建设中...\n检测到RPE版本:${meta.RPEVersion}`);
const format = `RPE(${meta.RPEVersion})`;
// 谱面信息
Expand Down Expand Up @@ -582,7 +582,7 @@ export function parse(pec: string, filename: string): {
for (const note of i.notes) {
if (note.alpha === undefined) note.alpha = 255;
if (note.above !== 1 && note.above !== 2) warn(1, 'NoteSideWarning', `检测到非法方向:${note.above}(将被视为2)\n位于:"${JSON.stringify(note)}"`);
if (note.isFake !== 0) warn(1, 'NoteFakeWarning', `检测到FakeNote(可能无法正常显示)\n位于:"${JSON.stringify(note)}"`);
if (note.isFake !== 0) warn(1, 'NoteFakeWarning', `检测到Fake音符(可能无法正常显示)\n位于:"${JSON.stringify(note)}"`);
if (note.size !== 1) warn(1, 'ImplementionWarning', `未兼容size=${note.size}(可能无法正常显示)\n位于:"${JSON.stringify(note)}"`);
if (note.yOffset !== 0) warn(1, 'ImplementionWarning', `未兼容yOffset=${note.yOffset}(可能无法正常显示)\n位于:"${JSON.stringify(note)}"`);
if (note.visibleTime !== 999999) warn(1, 'ImplementionWarning', `未兼容visibleTime=${note.visibleTime}(可能无法正常显示)\n位于:"${JSON.stringify(note)}"`);
Expand Down Expand Up @@ -643,7 +643,7 @@ export function parse(pec: string, filename: string): {
}
for (const i of data.judgeLineList) {
const lineRPE = i.judgeLineRPE; // TODO: 待优化
const judgeLine = lineRPE.format({ onwarning: (msg: string) => warn(1, 'OtherWarning', `${msg}`) });
const judgeLine = lineRPE.format({ onwarning: (msg: string) => warn(1, 'OtherWarning', msg) });
result.judgeLineList.push(judgeLine);
result.numOfNotes! += judgeLine.numOfNotes;
}
Expand Down

0 comments on commit 00a6602

Please sign in to comment.