diff --git a/packages/tosu/src/entities/BeatmapPpData/index.ts b/packages/tosu/src/entities/BeatmapPpData/index.ts index 24e5bbe1..c5b0d2c5 100644 --- a/packages/tosu/src/entities/BeatmapPpData/index.ts +++ b/packages/tosu/src/entities/BeatmapPpData/index.ts @@ -184,15 +184,23 @@ export class BeatmapPPData extends AbstractEntity { type: 'curr' | 'fc', attributes: rosu.PerformanceAttributes ) { - if (type !== 'curr' && type !== 'fc') return; - - this[`${type}PPAttributes`] = { - ppAccuracy: attributes.ppAccuracy || 0.0, - ppAim: attributes.ppAim || 0.0, - ppDifficulty: attributes.ppDifficulty || 0.0, - ppFlashlight: attributes.ppFlashlight || 0.0, - ppSpeed: attributes.ppSpeed || 0.0 - }; + try { + if (type !== 'curr' && type !== 'fc') return; + + this[`${type}PPAttributes`] = { + ppAccuracy: attributes.ppAccuracy || 0.0, + ppAim: attributes.ppAim || 0.0, + ppDifficulty: attributes.ppDifficulty || 0.0, + ppFlashlight: attributes.ppFlashlight || 0.0, + ppSpeed: attributes.ppSpeed || 0.0 + }; + } catch (exc) { + wLogger.error( + `BPPD(updatePPAttributes)-${type}`, + (exc as any).message + ); + wLogger.debug(`BPPD(updatePPAttributes)-${type}`, exc); + } } updateCurrentAttributes(stars: number, pp: number) { @@ -292,7 +300,7 @@ export class BeatmapPPData extends AbstractEntity { const attributes = new rosu.BeatmapAttributesBuilder({ map: this.beatmap, mods: currentMods, - mode: menuData.MenuGameMode + mode: currentMode }).build(); const fcPerformance = new rosu.Performance({ diff --git a/packages/tosu/src/entities/GamePlayData/index.ts b/packages/tosu/src/entities/GamePlayData/index.ts index 4f4c8799..0defeaf6 100644 --- a/packages/tosu/src/entities/GamePlayData/index.ts +++ b/packages/tosu/src/entities/GamePlayData/index.ts @@ -677,7 +677,7 @@ export class GamePlayData extends AbstractEntity { if (fcPerformance) { beatmapPpData.currAttributes.fcPP = fcPerformance.pp; - beatmapPpData.updatePPAttributes('fc', currPerformance); + beatmapPpData.updatePPAttributes('fc', fcPerformance); } this.previousPassedObjects = passedObjects;