@rian8337/osu-base 2.1.0 → 2.2.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rian8337/osu-base",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "Base module for all osu! related modules.",
5
5
  "keywords": [
6
6
  "osu",
@@ -20,7 +20,7 @@
20
20
  "build": "rollup -c ../../rollup.config.js",
21
21
  "lint": "eslint --ext ts",
22
22
  "prepare": "npm run build",
23
- "test": "jest -i"
23
+ "test": "jest"
24
24
  },
25
25
  "repository": {
26
26
  "type": "git",
@@ -41,5 +41,5 @@
41
41
  "publishConfig": {
42
42
  "access": "public"
43
43
  },
44
- "gitHead": "aa91d8c7ca9a687f63d920f402cf4f5771e04499"
44
+ "gitHead": "e8ab54978ffed744317da3dd0073bd4df4d97319"
45
45
  }
@@ -183,6 +183,9 @@ declare enum modes {
183
183
  declare abstract class Mod {
184
184
  /**
185
185
  * The score multiplier of this mod.
186
+ *
187
+ * @deprecated Score multipliers in droid and PC differ. Use `droidScoreMultiplier`
188
+ * for droid score multiplier and `pcScoreMultiplier` for PC multiplier instead.
186
189
  */
187
190
  abstract readonly scoreMultiplier: number;
188
191
  /**
@@ -201,8 +204,20 @@ declare abstract class Mod {
201
204
  * Whether the mod is ranked in osu!standard.
202
205
  */
203
206
  abstract readonly pcRanked: boolean;
207
+ /**
208
+ * The droid score multiplier of this mod.
209
+ */
210
+ abstract readonly droidScoreMultiplier: number;
211
+ /**
212
+ * The PC score multiplier of this mod.
213
+ */
214
+ abstract readonly pcScoreMultiplier: number;
204
215
  /**
205
216
  * The bitwise enum of the mod.
217
+ *
218
+ * This is NaN if the bitwise doesn't exist.
219
+ *
220
+ * In 3.0, this will be nullable.
206
221
  */
207
222
  abstract readonly bitwise: number;
208
223
  /**
@@ -982,9 +997,16 @@ declare class DifficultyControlPoint extends ControlPoint {
982
997
  * The slider speed multiplier of the control point.
983
998
  */
984
999
  readonly speedMultiplier: number;
1000
+ /**
1001
+ * Whether or not slider ticks should be generated at this control point.
1002
+ *
1003
+ * This exists for backwards compatibility with maps that abuse NaN slider velocity behavior on osu!stable (e.g. /b/2628991).
1004
+ */
1005
+ readonly generateTicks: boolean;
985
1006
  constructor(values: {
986
1007
  time: number;
987
1008
  speedMultiplier: number;
1009
+ generateTicks?: boolean;
988
1010
  });
989
1011
  isRedundant(existing: DifficultyControlPoint): boolean;
990
1012
  toString(): string;
@@ -1408,13 +1430,6 @@ declare class Beatmap {
1408
1430
  * @param mods The modifications to calculate for. Defaults to No Mod.
1409
1431
  */
1410
1432
  maxOsuScore(mods?: Mod[]): number;
1411
- /**
1412
- * Calculates the maximum score with a given difficulty and score multiplier.
1413
- *
1414
- * @param difficultyMultiplier The difficulty multiplier.
1415
- * @param scoreMultiplier The score multiplier.
1416
- */
1417
- private maxScore;
1418
1433
  /**
1419
1434
  * Returns a string representative of the class.
1420
1435
  */
@@ -1487,20 +1502,22 @@ declare abstract class SectionDecoder<T> {
1487
1502
  * @param str The string to parse.
1488
1503
  * @param min The minimum threshold. Defaults to `-ParserConstants.MAX_PARSE_VALUE`.
1489
1504
  * @param max The maximum threshold. Defaults to `ParserConstants.MAX_PARSE_VALUE`.
1505
+ * @param allowNaN Whether to allow NaN.
1490
1506
  * @returns The parsed integer.
1491
1507
  */
1492
- protected tryParseInt(str: string, min?: number, max?: number): number;
1508
+ protected tryParseInt(str: string, min?: number, max?: number, allowNaN?: boolean): number;
1493
1509
  /**
1494
1510
  * Attempts to parse a string into a float.
1495
1511
  *
1496
- * Throws an exception when the resulting value is invalid (such as NaN), too low, or too high.
1512
+ * Throws an exception when the resulting value is too low or too high.
1497
1513
  *
1498
1514
  * @param str The string to parse.
1499
1515
  * @param min The minimum threshold. Defaults to `-ParserConstants.MAX_PARSE_VALUE`.
1500
1516
  * @param max The maximum threshold. Defaults to `ParserConstants.MAX_PARSE_VALUE`.
1517
+ * @param allowNaN Whether to allow NaN.
1501
1518
  * @returns The parsed float.
1502
1519
  */
1503
- protected tryParseFloat(str: string, min?: number, max?: number): number;
1520
+ protected tryParseFloat(str: string, min?: number, max?: number, allowNaN?: boolean): number;
1504
1521
  /**
1505
1522
  * Checks if a number is within a given threshold.
1506
1523
  *
@@ -1551,6 +1568,13 @@ declare abstract class Decoder<R, D extends SectionDecoder<R>> {
1551
1568
  * @returns The current decoder instance.
1552
1569
  */
1553
1570
  decode(str: string): this;
1571
+ /**
1572
+ * Determines whether a line should be skipped.
1573
+ *
1574
+ * @param line The line to determine.
1575
+ * @returns Whether the line should be skipped.
1576
+ */
1577
+ protected shouldSkipLine(line: string): boolean;
1554
1578
  /**
1555
1579
  * Internal decoder function for decoding a line.
1556
1580
  *
@@ -2824,6 +2848,8 @@ declare class ModAuto extends Mod {
2824
2848
  readonly name: string;
2825
2849
  readonly droidRanked: boolean;
2826
2850
  readonly pcRanked: boolean;
2851
+ readonly droidScoreMultiplier: number;
2852
+ readonly pcScoreMultiplier: number;
2827
2853
  readonly bitwise: number;
2828
2854
  readonly droidString: string;
2829
2855
  readonly droidOnly: boolean;
@@ -2838,6 +2864,8 @@ declare class ModAutopilot extends Mod {
2838
2864
  readonly name: string;
2839
2865
  readonly droidRanked: boolean;
2840
2866
  readonly pcRanked: boolean;
2867
+ readonly droidScoreMultiplier: number;
2868
+ readonly pcScoreMultiplier: number;
2841
2869
  readonly bitwise: number;
2842
2870
  readonly droidString: string;
2843
2871
  readonly droidOnly: boolean;
@@ -2852,6 +2880,8 @@ declare class ModDoubleTime extends Mod {
2852
2880
  readonly name: string;
2853
2881
  readonly droidRanked: boolean;
2854
2882
  readonly pcRanked: boolean;
2883
+ readonly droidScoreMultiplier: number;
2884
+ readonly pcScoreMultiplier: number;
2855
2885
  readonly bitwise: number;
2856
2886
  readonly droidString: string;
2857
2887
  readonly droidOnly: boolean;
@@ -2866,6 +2896,8 @@ declare class ModEasy extends Mod {
2866
2896
  readonly name: string;
2867
2897
  readonly droidRanked: boolean;
2868
2898
  readonly pcRanked: boolean;
2899
+ readonly droidScoreMultiplier: number;
2900
+ readonly pcScoreMultiplier: number;
2869
2901
  readonly bitwise: number;
2870
2902
  readonly droidString: string;
2871
2903
  readonly droidOnly: boolean;
@@ -2880,6 +2912,8 @@ declare class ModFlashlight extends Mod {
2880
2912
  readonly name: string;
2881
2913
  readonly droidRanked: boolean;
2882
2914
  readonly pcRanked: boolean;
2915
+ readonly droidScoreMultiplier: number;
2916
+ readonly pcScoreMultiplier: number;
2883
2917
  readonly bitwise: number;
2884
2918
  readonly droidString: string;
2885
2919
  readonly droidOnly: boolean;
@@ -2894,6 +2928,8 @@ declare class ModHalfTime extends Mod {
2894
2928
  readonly name: string;
2895
2929
  readonly droidRanked: boolean;
2896
2930
  readonly pcRanked: boolean;
2931
+ readonly droidScoreMultiplier: number;
2932
+ readonly pcScoreMultiplier: number;
2897
2933
  readonly bitwise: number;
2898
2934
  readonly droidString: string;
2899
2935
  readonly droidOnly: boolean;
@@ -2909,6 +2945,8 @@ declare class ModHardRock extends Mod {
2909
2945
  readonly bitwise: number;
2910
2946
  readonly droidRanked: boolean;
2911
2947
  readonly pcRanked: boolean;
2948
+ readonly droidScoreMultiplier: number;
2949
+ readonly pcScoreMultiplier: number;
2912
2950
  readonly droidString: string;
2913
2951
  readonly droidOnly: boolean;
2914
2952
  }
@@ -2925,6 +2963,8 @@ declare class ModHidden extends Mod {
2925
2963
  readonly bitwise: number;
2926
2964
  readonly droidRanked: boolean;
2927
2965
  readonly pcRanked: boolean;
2966
+ readonly droidScoreMultiplier: number;
2967
+ readonly pcScoreMultiplier: number;
2928
2968
  readonly droidString: string;
2929
2969
  readonly droidOnly: boolean;
2930
2970
  }
@@ -2938,6 +2978,8 @@ declare class ModNightCore extends Mod {
2938
2978
  readonly name: string;
2939
2979
  readonly droidRanked: boolean;
2940
2980
  readonly pcRanked: boolean;
2981
+ readonly droidScoreMultiplier: number;
2982
+ readonly pcScoreMultiplier: number;
2941
2983
  readonly bitwise: number;
2942
2984
  readonly droidString: string;
2943
2985
  readonly droidOnly: boolean;
@@ -2952,6 +2994,8 @@ declare class ModNoFail extends Mod {
2952
2994
  readonly name: string;
2953
2995
  readonly droidRanked: boolean;
2954
2996
  readonly pcRanked: boolean;
2997
+ readonly droidScoreMultiplier: number;
2998
+ readonly pcScoreMultiplier: number;
2955
2999
  readonly bitwise: number;
2956
3000
  readonly droidString: string;
2957
3001
  readonly droidOnly: boolean;
@@ -2966,6 +3010,8 @@ declare class ModPerfect extends Mod {
2966
3010
  readonly name: string;
2967
3011
  readonly droidRanked: boolean;
2968
3012
  readonly pcRanked: boolean;
3013
+ readonly droidScoreMultiplier: number;
3014
+ readonly pcScoreMultiplier: number;
2969
3015
  readonly bitwise: number;
2970
3016
  readonly droidString: string;
2971
3017
  readonly droidOnly: boolean;
@@ -2980,6 +3026,8 @@ declare class ModPrecise extends Mod {
2980
3026
  readonly name: string;
2981
3027
  readonly droidRanked: boolean;
2982
3028
  readonly pcRanked: boolean;
3029
+ readonly droidScoreMultiplier: number;
3030
+ readonly pcScoreMultiplier: number;
2983
3031
  readonly bitwise: number;
2984
3032
  readonly droidString: string;
2985
3033
  readonly droidOnly: boolean;
@@ -2994,6 +3042,8 @@ declare class ModReallyEasy extends Mod {
2994
3042
  readonly name: string;
2995
3043
  readonly droidRanked: boolean;
2996
3044
  readonly pcRanked: boolean;
3045
+ readonly droidScoreMultiplier: number;
3046
+ readonly pcScoreMultiplier: number;
2997
3047
  readonly bitwise: number;
2998
3048
  readonly droidString: string;
2999
3049
  readonly droidOnly: boolean;
@@ -3008,6 +3058,8 @@ declare class ModRelax extends Mod {
3008
3058
  readonly name: string;
3009
3059
  readonly droidRanked: boolean;
3010
3060
  readonly pcRanked: boolean;
3061
+ readonly droidScoreMultiplier: number;
3062
+ readonly pcScoreMultiplier: number;
3011
3063
  readonly bitwise: number;
3012
3064
  readonly droidString: string;
3013
3065
  readonly droidOnly: boolean;
@@ -3022,6 +3074,8 @@ declare class ModScoreV2 extends Mod {
3022
3074
  readonly name: string;
3023
3075
  readonly droidRanked: boolean;
3024
3076
  readonly pcRanked: boolean;
3077
+ readonly droidScoreMultiplier: number;
3078
+ readonly pcScoreMultiplier: number;
3025
3079
  readonly bitwise: number;
3026
3080
  readonly droidString: string;
3027
3081
  readonly droidOnly: boolean;
@@ -3036,6 +3090,8 @@ declare class ModSmallCircle extends Mod {
3036
3090
  readonly name: string;
3037
3091
  readonly droidRanked: boolean;
3038
3092
  readonly pcRanked: boolean;
3093
+ readonly droidScoreMultiplier: number;
3094
+ readonly pcScoreMultiplier: number;
3039
3095
  readonly bitwise: number;
3040
3096
  readonly droidString: string;
3041
3097
  readonly droidOnly: boolean;
@@ -3050,6 +3106,8 @@ declare class ModSpunOut extends Mod {
3050
3106
  readonly name: string;
3051
3107
  readonly droidRanked: boolean;
3052
3108
  readonly pcRanked: boolean;
3109
+ readonly droidScoreMultiplier: number;
3110
+ readonly pcScoreMultiplier: number;
3053
3111
  readonly bitwise: number;
3054
3112
  readonly droidString: string;
3055
3113
  readonly droidOnly: boolean;
@@ -3064,6 +3122,8 @@ declare class ModSuddenDeath extends Mod {
3064
3122
  readonly name: string;
3065
3123
  readonly droidRanked: boolean;
3066
3124
  readonly pcRanked: boolean;
3125
+ readonly droidScoreMultiplier: number;
3126
+ readonly pcScoreMultiplier: number;
3067
3127
  readonly bitwise: number;
3068
3128
  readonly droidString: string;
3069
3129
  readonly droidOnly: boolean;
@@ -3078,6 +3138,8 @@ declare class ModTouchDevice extends Mod {
3078
3138
  readonly name: string;
3079
3139
  readonly droidRanked: boolean;
3080
3140
  readonly pcRanked: boolean;
3141
+ readonly droidScoreMultiplier: number;
3142
+ readonly pcScoreMultiplier: number;
3081
3143
  readonly bitwise: number;
3082
3144
  readonly droidString: string;
3083
3145
  readonly droidOnly: boolean;