Skip to content

Commit

Permalink
chore: Fix mods order
Browse files Browse the repository at this point in the history
  • Loading branch information
cyperdark committed Nov 20, 2024
1 parent 4032911 commit ed6cd11
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/tosu/src/memory/lazer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ export class LazerMemory extends AbstractMemory<LazerPatternData> {

const modAcronyms = JSON.parse(jsonString) as Mod[];

let mods = calculateMods(modAcronyms);
let mods = calculateMods(modAcronyms, true);
if (mods instanceof Error)
mods = Object.assign({}, defaultCalculatedMods);

Expand Down Expand Up @@ -1774,7 +1774,7 @@ export class LazerMemory extends AbstractMemory<LazerPatternData> {
}
}

let mods = calculateMods(modList);
let mods = calculateMods(modList, true);
if (mods instanceof Error)
mods = Object.assign({}, defaultCalculatedMods);

Expand Down
8 changes: 4 additions & 4 deletions packages/tosu/src/memory/stable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ export class StableMemory extends AbstractMemory<OsuPatternData> {
this.process.readInt(resultScreenBase + 0xa0)
).toISOString();

let mods = calculateMods(modsInt);
let mods = calculateMods(modsInt, true);
if (mods instanceof Error)
mods = Object.assign({}, defaultCalculatedMods);

Expand Down Expand Up @@ -529,7 +529,7 @@ export class StableMemory extends AbstractMemory<OsuPatternData> {
maxCombo = this.process.readShort(scoreBase + 0x68);
}

let mods = calculateMods(modsInt);
let mods = calculateMods(modsInt, true);
if (mods instanceof Error)
mods = Object.assign({}, defaultCalculatedMods);

Expand Down Expand Up @@ -738,7 +738,7 @@ export class StableMemory extends AbstractMemory<OsuPatternData> {
);
}

let mods = calculateMods(menuMods);
let mods = calculateMods(menuMods, true);
if (mods instanceof Error)
mods = Object.assign({}, defaultCalculatedMods);

Expand Down Expand Up @@ -1140,7 +1140,7 @@ export class StableMemory extends AbstractMemory<OsuPatternData> {

const modsInt = modsXor1 ^ modsXor2;

let mods = calculateMods(modsInt);
let mods = calculateMods(modsInt, true);
if (mods instanceof Error)
mods = Object.assign({}, defaultCalculatedMods);

Expand Down
4 changes: 3 additions & 1 deletion packages/tosu/src/utils/osuMods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ export const modsName = (modsNumber: number, order?: boolean): string => {
}

convertedParts.sort(
(a, b) => ModsOrder[a.toLowerCase()] - ModsOrder[b.toLowerCase()]
(a, b) =>
(ModsOrder[a.toLowerCase()] || 99) -
(ModsOrder[b.toLowerCase()] || 99)
);

const converted = convertedParts
Expand Down

0 comments on commit ed6cd11

Please sign in to comment.