allow fo rboth cols directions
This commit is contained in:
@@ -305,15 +305,26 @@ export const actions: Actions = {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const modCode = parts[0];
|
// Detect column order: mod+id or id+mod
|
||||||
const modMatch = modCode.match(/^(NM|HD|HR|DT|FM|TB)\d*$/i);
|
const modRegex = /^(NM|HD|HR|DT|FM|TB)\d*$/i;
|
||||||
if (!modMatch) {
|
let modCode: string;
|
||||||
errors.push(`Line ${lineNum}: unknown mod "${modCode}"`);
|
let beatmapRaw: string;
|
||||||
|
|
||||||
|
if (modRegex.test(parts[0])) {
|
||||||
|
modCode = parts[0];
|
||||||
|
beatmapRaw = parts[1];
|
||||||
|
} else if (modRegex.test(parts[parts.length - 1])) {
|
||||||
|
modCode = parts[parts.length - 1];
|
||||||
|
beatmapRaw = parts[0];
|
||||||
|
} else {
|
||||||
|
errors.push(`Line ${lineNum}: no valid mod code found`);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const modMatch = modCode.match(modRegex)!;
|
||||||
const category = modMatch[1].toUpperCase();
|
const category = modMatch[1].toUpperCase();
|
||||||
|
|
||||||
let beatmapId = parts[1];
|
let beatmapId = beatmapRaw;
|
||||||
const urlMatch = beatmapId.match(/beatmaps\/(\d+)/);
|
const urlMatch = beatmapId.match(/beatmaps\/(\d+)/);
|
||||||
const setMatch = beatmapId.match(/beatmapsets\/\d+#\w+\/(\d+)/);
|
const setMatch = beatmapId.match(/beatmapsets\/\d+#\w+\/(\d+)/);
|
||||||
const shortMatch = beatmapId.match(/\/b\/(\d+)/);
|
const shortMatch = beatmapId.match(/\/b\/(\d+)/);
|
||||||
|
|||||||
Reference in New Issue
Block a user