@rian8337/osu-base 2.0.0 → 2.1.0-beta.1

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.0.0",
3
+ "version": "2.1.0-beta.1",
4
4
  "description": "Base module for all osu! related modules.",
5
5
  "keywords": [
6
6
  "osu",
@@ -41,5 +41,5 @@
41
41
  "publishConfig": {
42
42
  "access": "public"
43
43
  },
44
- "gitHead": "589b9b5c17d9e777e389f089ae37dd2f6951d8e2"
44
+ "gitHead": "a77da594bc83bb980cafe23e24a18791fcd13f99"
45
45
  }
@@ -87,9 +87,9 @@ interface RequestResponse {
87
87
  */
88
88
  readonly statusCode: number;
89
89
  }
90
- declare type DroidAPIEndpoint = "banscore.php" | "getuserinfo.php" | "scoresearch.php" | "scoresearchv2.php" | "rename.php" | "upload" | "user_list.php" | "usergeneral.php" | "top.php" | "time.php";
90
+ declare type DroidAPIEndpoint = "banscore.php" | "getuserinfo.php" | "scoresearch.php" | "scoresearchv2.php" | "rename.php" | "upload" | "user_list.php" | "usergeneral.php" | "top.php" | "time.php" | "account_ban_get.php" | "account_ban_set.php" | "account_restricted_get.php" | "account_restricted_set.php" | "single_score_wipe.php" | "user_wipe.php" | "user_rename.php";
91
91
  declare type OsuAPIEndpoint = "get_beatmaps" | "get_user" | "get_scores" | "get_user_best" | "get_user_recent" | "get_match" | "get_replay";
92
- declare abstract class APIRequestBuilder {
92
+ declare abstract class APIRequestBuilder<APIParams extends DroidAPIEndpoint | OsuAPIEndpoint> {
93
93
  /**
94
94
  * The main point of API host.
95
95
  */
@@ -120,7 +120,7 @@ declare abstract class APIRequestBuilder {
120
120
  *
121
121
  * @param endpoint The endpoint to set.
122
122
  */
123
- abstract setEndpoint(endpoint: DroidAPIEndpoint | OsuAPIEndpoint): this;
123
+ setEndpoint(endpoint: APIParams): this;
124
124
  /**
125
125
  * Sets if this builder includes the API key in the request URL.
126
126
  *
@@ -154,7 +154,7 @@ declare abstract class APIRequestBuilder {
154
154
  /**
155
155
  * API request builder for osu!droid.
156
156
  */
157
- declare class DroidAPIRequestBuilder extends APIRequestBuilder {
157
+ declare class DroidAPIRequestBuilder extends APIRequestBuilder<DroidAPIEndpoint> {
158
158
  protected readonly host: string;
159
159
  protected readonly APIkey: string;
160
160
  protected readonly APIkeyParam: string;
@@ -163,11 +163,10 @@ declare class DroidAPIRequestBuilder extends APIRequestBuilder {
163
163
  /**
164
164
  * API request builder for osu!standard.
165
165
  */
166
- declare class OsuAPIRequestBuilder extends APIRequestBuilder {
166
+ declare class OsuAPIRequestBuilder extends APIRequestBuilder<OsuAPIEndpoint> {
167
167
  protected readonly host: string;
168
168
  protected readonly APIkey: string;
169
169
  protected readonly APIkeyParam: string;
170
- setEndpoint(endpoint: OsuAPIEndpoint): this;
171
170
  }
172
171
 
173
172
  /**
@@ -781,7 +780,14 @@ declare class Storyboard {
781
780
  * @returns The storyboard layer.
782
781
  */
783
782
  getLayer(type: StoryboardLayerType, createIfNotAvailable?: boolean): StoryboardLayer;
784
- getLayer(type: StoryboardLayerType, createIfNotAvailable: false): StoryboardLayer | undefined;
783
+ /**
784
+ * Gets a layer of the storyboard.
785
+ *
786
+ * @param type The layer type.
787
+ * @param createIfNotAvailable Whether to create the storyboard layer if it's not available. Defaults to `true`.
788
+ * @returns The storyboard layer.
789
+ */
790
+ getLayer(type: StoryboardLayerType, createIfNotAvailable: false): StoryboardLayer | null;
785
791
  }
786
792
 
787
793
  /**
@@ -2116,6 +2122,259 @@ declare class CommandTrigger extends CommandTimelineGroup {
2116
2122
  toString(): string;
2117
2123
  }
2118
2124
 
2125
+ /**
2126
+ * A Math utility class containing all methods related to the error function.
2127
+ *
2128
+ * This class shares the same implementation as {@link https://numerics.mathdotnet.com/ Math.NET Numerics}.
2129
+ */
2130
+ declare abstract class ErrorFunction {
2131
+ /**
2132
+ * Polynomial coefficients for a numerator of erfImp
2133
+ * calculation for erf(x) in the interval [1e-10, 0.5].
2134
+ */
2135
+ private static readonly erfImpAn;
2136
+ /**
2137
+ * Polynomial coefficients for a denominator of erfImp
2138
+ * calculation for erf(x) in the interval [1e-10, 0.5].
2139
+ */
2140
+ private static readonly erfImpAd;
2141
+ /**
2142
+ * Polynomial coefficients for a numerator in erfImp
2143
+ * calculationfor erfc(x) in the interval [0.5, 0.75].
2144
+ */
2145
+ private static readonly erfImpBn;
2146
+ /**
2147
+ * Polynomial coefficients for a denominator in erfImp
2148
+ * calculation for Erfc(x) in the interval [0.5, 0.75].
2149
+ */
2150
+ private static readonly erfImpBd;
2151
+ /**
2152
+ * Polynomial coefficients for a numerator in erfImp
2153
+ * calculation for erfc(x) in the interval [0.75, 1.25].
2154
+ */
2155
+ private static readonly erfImpCn;
2156
+ /**
2157
+ * Polynomial coefficients for a denominator in erfImp
2158
+ * calculation for erfc(x) in the interval [0.75, 1.25].
2159
+ */
2160
+ private static readonly erfImpCd;
2161
+ /**
2162
+ * Polynomial coefficients for a numerator in erfImp
2163
+ * calculation for erfc(x) in the interval [1.25, 2.25].
2164
+ */
2165
+ private static readonly erfImpDn;
2166
+ /**
2167
+ * Polynomial coefficients for a denominator in erfImp
2168
+ * calculation for erfc(x) in the interval [1.25, 2.25].
2169
+ */
2170
+ private static readonly erfImpDd;
2171
+ /**
2172
+ * Polynomial coefficients for a numerator in erfImp
2173
+ * calculation for erfc(x) in the interval [2.25, 3.5].
2174
+ */
2175
+ private static readonly erfImpEn;
2176
+ /**
2177
+ * Polynomial coefficients for a denominator in erfImp
2178
+ * calculation for erfc(x) in the interval [2.25, 3.5].
2179
+ */
2180
+ private static readonly erfImpEd;
2181
+ /**
2182
+ * Polynomial coefficients for a numerator in erfImp
2183
+ * calculation for erfc(x) in the interval [3.5, 5.25].
2184
+ */
2185
+ private static readonly erfImpFn;
2186
+ /**
2187
+ * Polynomial coefficients for a denominator in erfImp
2188
+ * calculation for erfc(x) in the interval [3.5, 5.25].
2189
+ */
2190
+ private static readonly erfImpFd;
2191
+ /**
2192
+ * Polynomial coefficients for a numerator in erfImp
2193
+ * calculation for erfc(x) in the interval [5.25, 8].
2194
+ */
2195
+ private static readonly erfImpGn;
2196
+ /**
2197
+ * Polynomial coefficients for a denominator in erfImp
2198
+ * calculation for erfc(x) in the interval [5.25, 8].
2199
+ */
2200
+ private static readonly erfImpGd;
2201
+ /**
2202
+ * Polynomial coefficients for a numerator in erfImp
2203
+ * calculation for erfc(x) in the interval [8, 11.5].
2204
+ */
2205
+ private static readonly erfImpHn;
2206
+ /**
2207
+ * Polynomial coefficients for a denominator in erfImp
2208
+ * calculation for erfc(x) in the interval [8, 11.5].
2209
+ */
2210
+ private static readonly erfImpHd;
2211
+ /**
2212
+ * Polynomial coefficients for a numerator in erfImp
2213
+ * calculation for erfc(x) in the interval [11.5, 17].
2214
+ */
2215
+ private static readonly erfImpIn;
2216
+ /**
2217
+ * Polynomial coefficients for a denominator in erfImp
2218
+ * calculation for erfc(x) in the interval [11.5, 17].
2219
+ */
2220
+ private static readonly erfImpId;
2221
+ /**
2222
+ * Polynomial coefficients for a numerator in erfImp
2223
+ * calculation for erfc(x) in the interval [17, 24].
2224
+ */
2225
+ private static readonly erfImpJn;
2226
+ /**
2227
+ * Polynomial coefficients for a denominator in erfImp
2228
+ * calculation for erfc(x) in the interval [17, 24].
2229
+ */
2230
+ private static readonly erfImpJd;
2231
+ /**
2232
+ * Polynomial coefficients for a numerator in erfImp
2233
+ * calculation for erfc(x) in the interval [24, 38].
2234
+ */
2235
+ private static readonly erfImpKn;
2236
+ /**
2237
+ * Polynomial coefficients for a denominator in erfImp
2238
+ * calculation for erfc(x) in the interval [24, 38].
2239
+ */
2240
+ private static readonly erfImpKd;
2241
+ /**
2242
+ * Polynomial coefficients for a numerator in erfImp
2243
+ * calculation for erfc(x) in the interval [38, 60].
2244
+ */
2245
+ private static readonly erfImpLn;
2246
+ /**
2247
+ * Polynomial coefficients for a denominator in erfImp
2248
+ * calculation for erfc(x) in the interval [38, 60].
2249
+ */
2250
+ private static readonly erfImpLd;
2251
+ /**
2252
+ * Polynomial coefficients for a numerator in erfImp
2253
+ * calculation for erfc(x) in the interval [60, 85].
2254
+ */
2255
+ private static readonly erfImpMn;
2256
+ /**
2257
+ * Polynomial coefficients for a denominator in erfImp
2258
+ * calculation for erfc(x) in the interval [60, 85].
2259
+ */
2260
+ private static readonly erfImpMd;
2261
+ /**
2262
+ * Polynomial coefficients for a numerator in erfImp
2263
+ * calculation for erfc(x) in the interval [85, 110].
2264
+ */
2265
+ private static readonly erfImpNn;
2266
+ /**
2267
+ * Polynomial coefficients for a denominator in erfImp
2268
+ * calculation for erfc(x) in the interval [85, 110].
2269
+ */
2270
+ private static readonly erfImpNd;
2271
+ /**
2272
+ * Polynomial coefficients for a numerator of erfInvImp
2273
+ * calculation for erf^-1(z) in the interval [0, 0.5].
2274
+ */
2275
+ private static readonly ervInvImpAn;
2276
+ /**
2277
+ * Polynomial coefficients for a denominator of erfInvImp
2278
+ * calculation for erf^-1(z) in the interval [0, 0.5].
2279
+ */
2280
+ private static readonly ervInvImpAd;
2281
+ /**
2282
+ * Polynomial coefficients for a numerator of erfInvImp
2283
+ * calculation for erf^-1(z) in the interval [0.5, 0.75].
2284
+ */
2285
+ private static readonly ervInvImpBn;
2286
+ /**
2287
+ * Polynomial coefficients for a denominator of erfInvImp
2288
+ * calculation for erf^-1(z) in the interval [0.5, 0.75].
2289
+ */
2290
+ private static readonly ervInvImpBd;
2291
+ /**
2292
+ * Polynomial coefficients for a numerator of erfInvImp
2293
+ * calculation for erf^-1(z) in the interval [0.75, 1] with x less than 3.
2294
+ */
2295
+ private static readonly ervInvImpCn;
2296
+ /**
2297
+ * Polynomial coefficients for a denominator of erfInvImp
2298
+ * calculation for erf^-1(z) in the interval [0.75, 1] with x less than 3.
2299
+ */
2300
+ private static readonly ervInvImpCd;
2301
+ /**
2302
+ * Polynomial coefficients for a numerator of erfInvImp
2303
+ * calculation for erf^-1(z) in the interval [0.75, 1] with x between 3 and 6.
2304
+ */
2305
+ private static readonly ervInvImpDn;
2306
+ /**
2307
+ * Polynomial coefficients for a denominator of erfInvImp
2308
+ * calculation for erf^-1(z) in the interval [0.75, 1] with x between 3 and 6.
2309
+ */
2310
+ private static readonly ervInvImpDd;
2311
+ /**
2312
+ * Polynomial coefficients for a numerator of erfInvImp
2313
+ * calculation for erf^-1(z) in the interval [0.75, 1] with x between 6 and 18.
2314
+ */
2315
+ private static readonly ervInvImpEn;
2316
+ /**
2317
+ * Polynomial coefficients for a denominator of erfInvImp
2318
+ * calculation for erf^-1(z) in the interval [0.75, 1] with x between 6 and 18.
2319
+ */
2320
+ private static readonly ervInvImpEd;
2321
+ /**
2322
+ * Polynomial coefficients for a numerator of erfInvImp
2323
+ * calculation for erf^-1(z) in the interval [0.75, 1] with x between 18 and 44.
2324
+ */
2325
+ private static readonly ervInvImpFn;
2326
+ /**
2327
+ * Polynomial coefficients for a denominator of erfInvImp
2328
+ * calculation for erf^-1(z) in the interval [0.75, 1] with x between 18 and 44.
2329
+ */
2330
+ private static readonly ervInvImpFd;
2331
+ /**
2332
+ * Polynomial coefficients for a numerator of erfInvImp
2333
+ * calculation for erf^-1(z) in the interval [0.75, 1] with x greater than 44.
2334
+ */
2335
+ private static readonly ervInvImpGn;
2336
+ /**
2337
+ * Polynomial coefficients for a denominator of erfInvImp
2338
+ * calculation for erf^-1(z) in the interval [0.75, 1] with x greater than 44.
2339
+ */
2340
+ private static readonly ervInvImpGd;
2341
+ /**
2342
+ * Calculates the error function.
2343
+ *
2344
+ * @param x The value to evaluate.
2345
+ * @returns The error function evaluated at x, or:
2346
+ * - 1 if `x == Number.POSITIVE_INFINITY`;
2347
+ * - -1 if `x == Number.NEGATIVE_INFINITY`.
2348
+ */
2349
+ static erf(x: number): number;
2350
+ /**
2351
+ * Calculates the inverse error function evaluated at z.
2352
+ *
2353
+ * @param z The value to evaluate.
2354
+ * @returns The inverse error function evaluated at z, or:
2355
+ * - `Number.POSITIVE_INFINITY` if `z >= 1`;
2356
+ * - `Number.NEGATIVE_INFINITY` if `z <= -1`.
2357
+ */
2358
+ static erfInv(z: number): number;
2359
+ /**
2360
+ * The implementation of the error function.
2361
+ *
2362
+ * @param z Where to evaluate the error function.
2363
+ * @param invert Whether to compute 1 - the error function.
2364
+ * @returns The error function.
2365
+ */
2366
+ private static erfImp;
2367
+ /**
2368
+ * The implementation of the inverse error function.
2369
+ *
2370
+ * @param p The first intermediate parameter.
2371
+ * @param q The second intermediate parameter.
2372
+ * @param s The third intermediate parameter.
2373
+ * @returns The inverse error function.
2374
+ */
2375
+ private static erfInvImp;
2376
+ }
2377
+
2119
2378
  declare abstract class HitWindow {
2120
2379
  /**
2121
2380
  * The overall difficulty of this hit window.
@@ -2888,11 +3147,10 @@ declare abstract class ModUtil {
2888
3147
  /**
2889
3148
  * Checks for mods that are incompatible with each other.
2890
3149
  *
2891
- * This will modify the original array.
2892
- *
2893
3150
  * @param mods The mods to check for.
3151
+ * @returns Mods that have been filtered.
2894
3152
  */
2895
- static checkIncompatibleMods(mods: Mod[]): void;
3153
+ static checkIncompatibleMods(mods: Mod[]): Mod[];
2896
3154
  /**
2897
3155
  * Processes parsing options.
2898
3156
  *
@@ -3006,6 +3264,25 @@ declare enum PathType {
3006
3264
  PerfectCurve = "P"
3007
3265
  }
3008
3266
 
3267
+ /**
3268
+ * A single-variable polynomial with real-valued coefficients and non-negative exponents.
3269
+ *
3270
+ * This class shares the same implementation as {@link https://numerics.mathdotnet.com/ Math.NET Numerics}.
3271
+ */
3272
+ declare abstract class Polynomial {
3273
+ /**
3274
+ * Evaluates a polynomial at point z.
3275
+ *
3276
+ * Coefficients are ordered ascending by power with power k at index k.
3277
+ * For example, coefficients `[3, -1, 2]` represent `y = 2x^2 - x + 3`.
3278
+ *
3279
+ * @param z The location where to evaluate the polynomial at.
3280
+ * @param coefficients The coefficients of the polynomial, coefficient for power k at index k.
3281
+ * @returns The polynomial at z.
3282
+ */
3283
+ static evaluate(z: number, coefficients: number[]): number;
3284
+ }
3285
+
3009
3286
  /**
3010
3287
  * Precision utilities.
3011
3288
  */
@@ -3454,4 +3731,4 @@ declare abstract class Utils {
3454
3731
  static sleep(duration: number): Promise<void>;
3455
3732
  }
3456
3733
 
3457
- export { Accuracy, Anchor, AnimationLoopType, Beatmap, BeatmapBackground, BeatmapColor, BeatmapControlPoints, BeatmapCountdown, BeatmapDecoder, BeatmapDifficulty, BeatmapEditor, BeatmapEncoder, BeatmapEvents, BeatmapGeneral, BeatmapHitObjects, BeatmapMetadata, BeatmapOverlayPosition, BeatmapVideo, BlendingEquation, BlendingParameters, BlendingType, BreakPoint, Circle, Command, CommandLoop, CommandTimeline, CommandTimelineGroup, CommandTimelineSelector, CommandTrigger, ControlPointManager, DifficultyControlPoint, DroidAPIRequestBuilder, DroidHitWindow, Easing, EditorGridSize, EffectControlPoint, GameMode, HitObject, HitSampleInfo, HitSoundType, ICommandTimeline, If, Interpolation, MapInfo, MapStats, MathUtils, Mod, ModAuto, ModAutopilot, ModDoubleTime, ModEasy, ModFlashlight, ModHalfTime, ModHardRock, ModHidden, ModNightCore, ModNoFail, ModParseOptions, ModPerfect, ModPrecise, ModReallyEasy, ModRelax, ModScoreV2, ModSmallCircle, ModSpunOut, ModSuddenDeath, ModTouchDevice, ModUtil, OsuAPIRequestBuilder, OsuAPIResponse, OsuHitWindow, PathApproximator, PathType, Precision, RGBColor, RequestResponse, SampleBank, SampleBankInfo, SampleControlPoint, Slider, SliderHead, SliderPath, SliderRepeat, SliderTail, SliderTick, Spinner, Storyboard, StoryboardAnimation, StoryboardCommandType, StoryboardDecoder, StoryboardElement, StoryboardEncoder, StoryboardEventType, StoryboardLayer, StoryboardLayerType, StoryboardParameterCommandType, StoryboardSample, StoryboardSprite, TimingControlPoint, Utils, Vector2, modes, objectTypes, rankedStatus };
3734
+ export { Accuracy, Anchor, AnimationLoopType, Beatmap, BeatmapBackground, BeatmapColor, BeatmapControlPoints, BeatmapCountdown, BeatmapDecoder, BeatmapDifficulty, BeatmapEditor, BeatmapEncoder, BeatmapEvents, BeatmapGeneral, BeatmapHitObjects, BeatmapMetadata, BeatmapOverlayPosition, BeatmapVideo, BlendingEquation, BlendingParameters, BlendingType, BreakPoint, Circle, Command, CommandLoop, CommandTimeline, CommandTimelineGroup, CommandTimelineSelector, CommandTrigger, ControlPointManager, DifficultyControlPoint, DifficultyControlPointManager, DroidAPIRequestBuilder, DroidHitWindow, Easing, EditorGridSize, EffectControlPoint, EffectControlPointManager, ErrorFunction, GameMode, HitObject, HitSampleInfo, HitSoundType, ICommandTimeline, If, Interpolation, MapInfo, MapStats, MathUtils, Mod, ModAuto, ModAutopilot, ModDoubleTime, ModEasy, ModFlashlight, ModHalfTime, ModHardRock, ModHidden, ModNightCore, ModNoFail, ModParseOptions, ModPerfect, ModPrecise, ModReallyEasy, ModRelax, ModScoreV2, ModSmallCircle, ModSpunOut, ModSuddenDeath, ModTouchDevice, ModUtil, OsuAPIRequestBuilder, OsuAPIResponse, OsuHitWindow, PathApproximator, PathType, Polynomial, Precision, RGBColor, RequestResponse, SampleBank, SampleBankInfo, SampleControlPoint, SampleControlPointManager, Slider, SliderHead, SliderPath, SliderRepeat, SliderTail, SliderTick, Spinner, Storyboard, StoryboardAnimation, StoryboardCommandType, StoryboardDecoder, StoryboardElement, StoryboardEncoder, StoryboardEventType, StoryboardLayer, StoryboardLayerType, StoryboardParameterCommandType, StoryboardSample, StoryboardSprite, TimingControlPoint, TimingControlPointManager, Utils, Vector2, modes, objectTypes, rankedStatus };