@rian8337/osu-droid-replay-analyzer 4.0.0-beta.95 → 4.0.0-beta.97

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1327,7 +1327,7 @@ class TwoHandChecker {
1327
1327
  // this.csvString = `Mods,${
1328
1328
  // data.convertedMods.reduce((a, m) => a + m.acronym, "") || "NM"
1329
1329
  // }\nCombo,${data.maxCombo}\nAccuracy,"${(
1330
- // data.accuracy.value() * 100
1330
+ // data.accuracy.value * 100
1331
1331
  // ).toFixed(2)}% [${data.accuracy.n300}/${data.accuracy.n100}/${
1332
1332
  // data.accuracy.n50
1333
1333
  // }/${
@@ -2195,15 +2195,22 @@ class ReplayData {
2195
2195
  */
2196
2196
  class ReplayV3Data extends ReplayData {
2197
2197
  /**
2198
- * The total score achieved in the play, after applying score multiplier from mods.
2198
+ * Obtains the total score achieved in the play, after applying score multiplier from mods.
2199
+ *
2200
+ * @param difficulty The `BeatmapDifficulty` of the beatmap that was played. Required to correctly compute
2201
+ * the score multiplier of difficulty-dependent mods. If not provided, those mods fall back to their
2202
+ * difficulty-independent multiplier.
2199
2203
  */
2200
- get totalScore() {
2201
- var _a;
2204
+ getTotalScore(difficulty = null) {
2205
+ let baseScore = this.score;
2202
2206
  if (this.replayVersion < 8) {
2203
- return this.score;
2207
+ // Replay versions 3 to 7 store the score after applying score multiplier
2208
+ // from mods, so we need to reverse it to get the base score.
2209
+ const legacyScoreMultiplier = new osuBase.DroidLegacyScoreMultiplierCalculator(difficulty).calculateFor(this.convertedMods.values());
2210
+ baseScore = Math.round(this.score / legacyScoreMultiplier);
2204
2211
  }
2205
- (_a = this.scoreMultiplier) !== null && _a !== void 0 ? _a : (this.scoreMultiplier = osuBase.ModUtil.calculateScoreMultiplier(this.convertedMods.values(), osuBase.Modes.Droid));
2206
- return Math.round(Math.fround(this.score * this.scoreMultiplier));
2212
+ const scoreMultiplier = new osuBase.DroidScoreMultiplierCalculator(difficulty).calculateFor(this.convertedMods.values());
2213
+ return Math.round(baseScore * scoreMultiplier);
2207
2214
  }
2208
2215
  constructor(values) {
2209
2216
  super(values);
@@ -2646,9 +2653,16 @@ class ReplayAnalyzer {
2646
2653
  resultObject.accuracy.n100 = buf.readInt32BE(20);
2647
2654
  resultObject.accuracy.n50 = buf.readInt32BE(24);
2648
2655
  resultObject.accuracy.nmiss = buf.readInt32BE(28);
2649
- resultObject.score = buf.readInt32BE(32);
2650
- resultObject.maxCombo = buf.readInt32BE(36);
2651
- resultObject.isFullCombo = resultObject.accuracy.value() === 1;
2656
+ if (resultObject.replayVersion >= 9) {
2657
+ // From replay version 9 onwards, the score is stored as a long (8 bytes) instead of an int (4 bytes).
2658
+ resultObject.score = Number(buf.readBigInt64BE(32));
2659
+ resultObject.maxCombo = buf.readInt32BE(40);
2660
+ }
2661
+ else {
2662
+ resultObject.score = buf.readInt32BE(32);
2663
+ resultObject.maxCombo = buf.readInt32BE(36);
2664
+ }
2665
+ resultObject.isFullCombo = resultObject.accuracy.value === 1;
2652
2666
  resultObject.playerName = rawObject[5];
2653
2667
  if (resultObject.replayVersion >= 7) {
2654
2668
  resultObject.convertedMods = osuBase.ModUtil.deserializeMods(JSON.parse(rawObject[6]));
@@ -2674,6 +2688,7 @@ class ReplayAnalyzer {
2674
2688
  case 3:
2675
2689
  case 7:
2676
2690
  case 8:
2691
+ case 9:
2677
2692
  bufferIndex = 7;
2678
2693
  break;
2679
2694
  case 4:
@@ -2867,7 +2882,7 @@ class ReplayAnalyzer {
2867
2882
  resultObject.convertedMods.has(osuBase.ModFlashlight);
2868
2883
  const hit300Ratio = resultObject.accuracy.n300 / totalHits;
2869
2884
  switch (true) {
2870
- case resultObject.accuracy.value() === 1:
2885
+ case resultObject.accuracy.value === 1:
2871
2886
  return isHidden ? "XH" : "X";
2872
2887
  case hit300Ratio > 0.9 &&
2873
2888
  resultObject.accuracy.n50 / totalHits < 0.01 &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rian8337/osu-droid-replay-analyzer",
3
- "version": "4.0.0-beta.95",
3
+ "version": "4.0.0-beta.97",
4
4
  "description": "A replay analyzer for analyzing osu!droid replay files.",
5
5
  "keywords": [
6
6
  "osu",
@@ -34,9 +34,9 @@
34
34
  "url": "https://github.com/Rian8337/osu-droid-module/issues"
35
35
  },
36
36
  "dependencies": {
37
- "@rian8337/osu-base": "4.0.0-beta.95",
38
- "@rian8337/osu-difficulty-calculator": "4.0.0-beta.95",
39
- "@rian8337/osu-rebalance-difficulty-calculator": "4.0.0-beta.95",
37
+ "@rian8337/osu-base": "4.0.0-beta.97",
38
+ "@rian8337/osu-difficulty-calculator": "4.0.0-beta.97",
39
+ "@rian8337/osu-rebalance-difficulty-calculator": "4.0.0-beta.97",
40
40
  "java-deserialization": "^0.1.0",
41
41
  "unzipper": "^0.10.11"
42
42
  },
@@ -46,5 +46,5 @@
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "b07790be9c9dd737170d2d576bf02298ec607ab9"
49
+ "gitHead": "0d77ee41c1b0eca8e46c118e942417483c4a9452"
50
50
  }
@@ -1,4 +1,4 @@
1
- import { Vector2, HitResult, Accuracy, ScoreRank, ModMap, DroidPlayableBeatmap, Beatmap, HitWindow } from '@rian8337/osu-base';
1
+ import { Vector2, HitResult, Accuracy, ScoreRank, ModMap, BeatmapDifficulty, DroidPlayableBeatmap, Beatmap, HitWindow } from '@rian8337/osu-base';
2
2
  import { IExtendedDroidDifficultyAttributes } from '@rian8337/osu-rebalance-difficulty-calculator';
3
3
  import { IExtendedDroidDifficultyAttributes as IExtendedDroidDifficultyAttributes$1 } from '@rian8337/osu-difficulty-calculator';
4
4
 
@@ -340,7 +340,7 @@ declare class ReplayV3Data extends ReplayData {
340
340
  * Between replay version 3 and 7, this is the final score after applying score multiplier from mods.
341
341
  * From replay version 8 onwards, this is the score before applying score multiplier from mods.
342
342
  *
343
- * The {@link totalScore} getter can be used to get the total score across all replay versions.
343
+ * The {@link getTotalScore} method can be used to get the total score across all replay versions.
344
344
  */
345
345
  readonly score: number;
346
346
  /**
@@ -360,10 +360,13 @@ declare class ReplayV3Data extends ReplayData {
360
360
  */
361
361
  readonly convertedMods: ModMap;
362
362
  /**
363
- * The total score achieved in the play, after applying score multiplier from mods.
363
+ * Obtains the total score achieved in the play, after applying score multiplier from mods.
364
+ *
365
+ * @param difficulty The `BeatmapDifficulty` of the beatmap that was played. Required to correctly compute
366
+ * the score multiplier of difficulty-dependent mods. If not provided, those mods fall back to their
367
+ * difficulty-independent multiplier.
364
368
  */
365
- get totalScore(): number;
366
- private scoreMultiplier?;
369
+ getTotalScore(difficulty?: BeatmapDifficulty | null): number;
367
370
  constructor(values: ReplayInformation);
368
371
  }
369
372
 
@@ -962,6 +965,14 @@ interface ExportedReplayJSONDataV3 extends Omit<ExportedReplayJSONDataV2, "mod">
962
965
  * The structure of the exported replay JSON data for version 4.
963
966
  */
964
967
  interface ExportedReplayJSONDataV4 extends ExportedReplayJSONDataV3 {
968
+ /**
969
+ * The amount of slider head hits in the replay.
970
+ */
971
+ sliderHeadHits: number | null;
972
+ /**
973
+ * The amount of slider repeat hits in the replay.
974
+ */
975
+ sliderRepeatHits: number | null;
965
976
  /**
966
977
  * Whether {@link score} includes mod multipliers.
967
978
  */