@rian8337/osu-base 1.0.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.
Files changed (57) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -0
  3. package/dist/beatmap/Beatmap.js +223 -0
  4. package/dist/beatmap/Parser.js +620 -0
  5. package/dist/beatmap/hitobjects/Circle.js +20 -0
  6. package/dist/beatmap/hitobjects/HitObject.js +74 -0
  7. package/dist/beatmap/hitobjects/Slider.js +143 -0
  8. package/dist/beatmap/hitobjects/Spinner.js +26 -0
  9. package/dist/beatmap/hitobjects/sliderObjects/HeadCircle.js +10 -0
  10. package/dist/beatmap/hitobjects/sliderObjects/RepeatPoint.js +21 -0
  11. package/dist/beatmap/hitobjects/sliderObjects/SliderTick.js +21 -0
  12. package/dist/beatmap/hitobjects/sliderObjects/TailCircle.js +10 -0
  13. package/dist/beatmap/timings/BreakPoint.js +34 -0
  14. package/dist/beatmap/timings/DifficultyControlPoint.js +22 -0
  15. package/dist/beatmap/timings/TimingControlPoint.js +22 -0
  16. package/dist/beatmap/timings/TimingPoint.js +12 -0
  17. package/dist/constants/ParserConstants.js +19 -0
  18. package/dist/constants/PathType.js +13 -0
  19. package/dist/constants/modes.js +11 -0
  20. package/dist/constants/objectTypes.js +12 -0
  21. package/dist/constants/rankedStatus.js +16 -0
  22. package/dist/index.js +64 -0
  23. package/dist/mathutil/Interpolation.js +9 -0
  24. package/dist/mathutil/MathUtils.js +41 -0
  25. package/dist/mathutil/Vector2.js +79 -0
  26. package/dist/mods/Mod.js +9 -0
  27. package/dist/mods/ModAuto.js +21 -0
  28. package/dist/mods/ModAutopilot.js +21 -0
  29. package/dist/mods/ModDoubleTime.js +21 -0
  30. package/dist/mods/ModEasy.js +21 -0
  31. package/dist/mods/ModFlashlight.js +21 -0
  32. package/dist/mods/ModHalfTime.js +21 -0
  33. package/dist/mods/ModHardRock.js +21 -0
  34. package/dist/mods/ModHidden.js +21 -0
  35. package/dist/mods/ModNightCore.js +21 -0
  36. package/dist/mods/ModNoFail.js +21 -0
  37. package/dist/mods/ModPerfect.js +21 -0
  38. package/dist/mods/ModPrecise.js +21 -0
  39. package/dist/mods/ModReallyEasy.js +21 -0
  40. package/dist/mods/ModRelax.js +21 -0
  41. package/dist/mods/ModScoreV2.js +21 -0
  42. package/dist/mods/ModSmallCircle.js +21 -0
  43. package/dist/mods/ModSpunOut.js +21 -0
  44. package/dist/mods/ModSuddenDeath.js +21 -0
  45. package/dist/mods/ModTouchDevice.js +21 -0
  46. package/dist/tools/MapInfo.js +559 -0
  47. package/dist/utils/APIRequestBuilder.js +144 -0
  48. package/dist/utils/Accuracy.js +96 -0
  49. package/dist/utils/HitWindow.js +56 -0
  50. package/dist/utils/MapStats.js +212 -0
  51. package/dist/utils/ModUtil.js +137 -0
  52. package/dist/utils/PathApproximator.js +269 -0
  53. package/dist/utils/Precision.js +31 -0
  54. package/dist/utils/SliderPath.js +187 -0
  55. package/dist/utils/Utils.js +53 -0
  56. package/package.json +43 -0
  57. package/typings/index.d.ts +1951 -0
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HitObject = void 0;
4
+ const objectTypes_1 = require("../../constants/objectTypes");
5
+ const Vector2_1 = require("../../mathutil/Vector2");
6
+ /**
7
+ * Represents a hitobject in a beatmap.
8
+ */
9
+ class HitObject {
10
+ constructor(values) {
11
+ /**
12
+ * The stack height of the hitobject.
13
+ */
14
+ this.stackHeight = 0;
15
+ /**
16
+ * The scale used to calculate stacked position and radius.
17
+ */
18
+ this.scale = 1;
19
+ this.startTime = values.startTime;
20
+ this.endTime = values.endTime ?? values.startTime;
21
+ this.type = values.type ?? objectTypes_1.objectTypes.circle;
22
+ this.position = values.position;
23
+ this.endPosition = values.endPosition ?? this.position;
24
+ this.isNewCombo = !!(this.type & (1 << 2));
25
+ }
26
+ /**
27
+ * The stacked position of the hitobject.
28
+ */
29
+ get stackedPosition() {
30
+ if (this.type & objectTypes_1.objectTypes.spinner) {
31
+ return this.position;
32
+ }
33
+ return this.position.add(this.stackOffset);
34
+ }
35
+ /**
36
+ * The stacked end position of the hitobject.
37
+ */
38
+ get stackedEndPosition() {
39
+ if (this.type & objectTypes_1.objectTypes.spinner) {
40
+ return this.position;
41
+ }
42
+ return this.endPosition.add(this.stackOffset);
43
+ }
44
+ /**
45
+ * The stack vector to calculate offset for stacked positions.
46
+ */
47
+ get stackOffset() {
48
+ const coordinate = this.stackHeight * this.scale * -6.4;
49
+ return new Vector2_1.Vector2(coordinate, coordinate);
50
+ }
51
+ /**
52
+ * The radius of the hitobject.
53
+ */
54
+ get radius() {
55
+ return 64 * this.scale;
56
+ }
57
+ /**
58
+ * Returns the hitobject type.
59
+ */
60
+ typeStr() {
61
+ let res = "";
62
+ if (this.type & objectTypes_1.objectTypes.circle) {
63
+ res += "circle | ";
64
+ }
65
+ if (this.type & objectTypes_1.objectTypes.slider) {
66
+ res += "slider | ";
67
+ }
68
+ if (this.type & objectTypes_1.objectTypes.spinner) {
69
+ res += "spinner | ";
70
+ }
71
+ return res.substring(0, Math.max(0, res.length - 3));
72
+ }
73
+ }
74
+ exports.HitObject = HitObject;
@@ -0,0 +1,143 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Slider = void 0;
4
+ const HitObject_1 = require("./HitObject");
5
+ const HeadCircle_1 = require("./sliderObjects/HeadCircle");
6
+ const RepeatPoint_1 = require("./sliderObjects/RepeatPoint");
7
+ const SliderTick_1 = require("./sliderObjects/SliderTick");
8
+ const TailCircle_1 = require("./sliderObjects/TailCircle");
9
+ /**
10
+ * Represents a slider in a beatmap.
11
+ */
12
+ class Slider extends HitObject_1.HitObject {
13
+ constructor(values) {
14
+ super({
15
+ endPosition: values.position.add(values.path.positionAt(values.repetitions % 2)),
16
+ ...values,
17
+ });
18
+ /**
19
+ * The nested hitobjects of the slider. Consists of headcircle (sliderhead), slider ticks, repeat points, and tailcircle (sliderend).
20
+ */
21
+ this.nestedHitObjects = [];
22
+ /**
23
+ * The distance travelled by the cursor upon completion of this slider if it was hit
24
+ * with as few movements as possible. This is set and used by difficulty calculation.
25
+ */
26
+ this.lazyTravelDistance = 0;
27
+ /**
28
+ * The time taken by the cursor upon completion of this slider if it was hit with
29
+ * as few movements as possible. This is set and used by difficulty calculation.
30
+ */
31
+ this.lazyTravelTime = 0;
32
+ // Basically equal to span count
33
+ this.repetitions = values.repetitions;
34
+ this.path = values.path;
35
+ const scoringDistance = 100 * values.mapSliderVelocity * values.speedMultiplier;
36
+ this.velocity = scoringDistance / values.msPerBeat;
37
+ this.tickDistance =
38
+ (scoringDistance / values.mapTickRate) *
39
+ values.tickDistanceMultiplier;
40
+ this.endTime =
41
+ this.startTime +
42
+ (this.repetitions * this.path.expectedDistance) / this.velocity;
43
+ this.spanDuration = this.duration / this.repetitions;
44
+ // Creating nested hit objects
45
+ // Slider start
46
+ this.headCircle = new HeadCircle_1.HeadCircle({
47
+ position: this.position,
48
+ startTime: this.startTime,
49
+ type: 0,
50
+ });
51
+ this.nestedHitObjects.push(this.headCircle);
52
+ // Slider ticks and repeat points
53
+ // A very lenient maximum length of a slider for ticks to be generated.
54
+ // This exists for edge cases such as /b/1573664 where the beatmap has been edited by the user, and should never be reached in normal usage.
55
+ const maxLength = 100000;
56
+ const length = Math.min(maxLength, this.path.expectedDistance);
57
+ const tickDistance = Math.min(Math.max(this.tickDistance, 0), length);
58
+ if (tickDistance !== 0) {
59
+ const minDistanceFromEnd = this.velocity * 10;
60
+ for (let span = 0; span < this.repetitions; ++span) {
61
+ const spanStartTime = this.startTime + span * this.spanDuration;
62
+ const reversed = span % 2 === 1;
63
+ const sliderTicks = [];
64
+ for (let d = tickDistance; d <= length; d += tickDistance) {
65
+ if (d >= length - minDistanceFromEnd) {
66
+ break;
67
+ }
68
+ // Always generate ticks from the start of the path rather than the span to ensure that ticks in repeat spans are positioned identically to those in non-repeat spans
69
+ const distanceProgress = d / length;
70
+ const timeProgress = reversed
71
+ ? 1 - distanceProgress
72
+ : distanceProgress;
73
+ const sliderTickPosition = this.position.add(this.path.positionAt(distanceProgress));
74
+ const sliderTick = new SliderTick_1.SliderTick({
75
+ startTime: spanStartTime + timeProgress * this.spanDuration,
76
+ position: sliderTickPosition,
77
+ spanIndex: span,
78
+ spanStartTime: spanStartTime,
79
+ });
80
+ sliderTicks.push(sliderTick);
81
+ }
82
+ // For repeat spans, ticks are returned in reverse-StartTime order.
83
+ if (reversed) {
84
+ sliderTicks.reverse();
85
+ }
86
+ this.nestedHitObjects.push(...sliderTicks);
87
+ if (span < this.repetitions - 1) {
88
+ const repeatPosition = this.position.add(this.path.positionAt((span + 1) % 2));
89
+ const repeatPoint = new RepeatPoint_1.RepeatPoint({
90
+ position: repeatPosition,
91
+ startTime: spanStartTime + this.spanDuration,
92
+ repeatIndex: span,
93
+ spanDuration: this.spanDuration,
94
+ });
95
+ this.nestedHitObjects.push(repeatPoint);
96
+ }
97
+ }
98
+ }
99
+ // Okay, I'll level with you. I made a mistake. It was 2007.
100
+ // Times were simpler. osu! was but in its infancy and sliders were a new concept.
101
+ // A hack was made, which has unfortunately lived through until this day.
102
+ //
103
+ // This legacy tick is used for some calculations and judgements where audio output is not required.
104
+ // Generally we are keeping this around just for difficulty compatibility.
105
+ // Optimistically we do not want to ever use this for anything user-facing going forwards.
106
+ const finalSpanIndex = this.repeatPoints;
107
+ const finalSpanStartTime = this.startTime + finalSpanIndex * this.spanDuration;
108
+ const finalSpanEndTime = Math.max(this.startTime + this.duration / 2, finalSpanStartTime + this.spanDuration - Slider.legacyLastTickOffset);
109
+ // Slider end
110
+ this.tailCircle = new TailCircle_1.TailCircle({
111
+ position: this.endPosition,
112
+ startTime: finalSpanEndTime,
113
+ });
114
+ this.nestedHitObjects.push(this.tailCircle);
115
+ this.nestedHitObjects.sort((a, b) => {
116
+ return a.startTime - b.startTime;
117
+ });
118
+ }
119
+ /**
120
+ * The duration of this slider.
121
+ */
122
+ get duration() {
123
+ return this.endTime - this.startTime;
124
+ }
125
+ /**
126
+ * The amount of slider ticks in this slider.
127
+ */
128
+ get ticks() {
129
+ return this.nestedHitObjects.filter((v) => v instanceof SliderTick_1.SliderTick)
130
+ .length;
131
+ }
132
+ /**
133
+ * The amount of repeat points in this slider.
134
+ */
135
+ get repeatPoints() {
136
+ return this.repetitions - 1;
137
+ }
138
+ toString() {
139
+ return `Position: [${this.position.x}, ${this.position.y}], distance: ${this.path.expectedDistance}, repetitions: ${this.repetitions}, slider ticks: ${this.nestedHitObjects.filter((v) => v instanceof SliderTick_1.SliderTick).length}`;
140
+ }
141
+ }
142
+ exports.Slider = Slider;
143
+ Slider.legacyLastTickOffset = 36;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Spinner = void 0;
4
+ const Vector2_1 = require("../../mathutil/Vector2");
5
+ const HitObject_1 = require("./HitObject");
6
+ /**
7
+ * Represents a spinner in a beatmap.
8
+ *
9
+ * All we need from spinners is their duration. The
10
+ * position of a spinner is always at 256x192.
11
+ */
12
+ class Spinner extends HitObject_1.HitObject {
13
+ constructor(values) {
14
+ super({
15
+ startTime: values.startTime,
16
+ endTime: values.startTime + values.duration,
17
+ type: values.type | (1 << 2),
18
+ position: new Vector2_1.Vector2(256, 192),
19
+ });
20
+ this.duration = values.duration;
21
+ }
22
+ toString() {
23
+ return `Position: [${this.position.x}, ${this.position.y}], duration: ${this.duration}`;
24
+ }
25
+ }
26
+ exports.Spinner = Spinner;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HeadCircle = void 0;
4
+ const Circle_1 = require("../Circle");
5
+ /**
6
+ * Represents the headcircle of a slider (sliderhead).
7
+ */
8
+ class HeadCircle extends Circle_1.Circle {
9
+ }
10
+ exports.HeadCircle = HeadCircle;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RepeatPoint = void 0;
4
+ const HitObject_1 = require("../HitObject");
5
+ /**
6
+ * Represents a repeat point in a slider.
7
+ */
8
+ class RepeatPoint extends HitObject_1.HitObject {
9
+ constructor(values) {
10
+ super({
11
+ startTime: values.startTime,
12
+ position: values.position,
13
+ });
14
+ this.repeatIndex = values.repeatIndex;
15
+ this.spanDuration = values.spanDuration;
16
+ }
17
+ toString() {
18
+ return `Position: [${this.position.x}, ${this.position.y}], repeat index: ${this.repeatIndex}, span duration: ${this.spanDuration}`;
19
+ }
20
+ }
21
+ exports.RepeatPoint = RepeatPoint;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SliderTick = void 0;
4
+ const HitObject_1 = require("../HitObject");
5
+ /**
6
+ * Represents a slider tick in a slider.
7
+ */
8
+ class SliderTick extends HitObject_1.HitObject {
9
+ constructor(values) {
10
+ super({
11
+ startTime: values.startTime,
12
+ position: values.position,
13
+ });
14
+ this.spanIndex = values.spanIndex;
15
+ this.spanStartTime = values.spanStartTime;
16
+ }
17
+ toString() {
18
+ return `Position: [${this.position.x}, ${this.position.y}], span index: ${this.spanIndex}, span start time: ${this.spanStartTime}`;
19
+ }
20
+ }
21
+ exports.SliderTick = SliderTick;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TailCircle = void 0;
4
+ const Circle_1 = require("../Circle");
5
+ /**
6
+ * Represents the tailcircle of a slider (sliderend).
7
+ */
8
+ class TailCircle extends Circle_1.Circle {
9
+ }
10
+ exports.TailCircle = TailCircle;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BreakPoint = void 0;
4
+ /**
5
+ * Represents a break period in a beatmap.
6
+ */
7
+ class BreakPoint {
8
+ constructor(values) {
9
+ this.startTime = values.startTime;
10
+ this.endTime = values.endTime;
11
+ this.duration = this.endTime - this.startTime;
12
+ }
13
+ /**
14
+ * Returns a string representation of the class.
15
+ */
16
+ toString() {
17
+ return `Start time: ${this.startTime}, end time: ${this.endTime}, duration: ${this.duration}`;
18
+ }
19
+ /**
20
+ * Whether this break period contains a specified time.
21
+ *
22
+ * @param time The time to check in milliseconds.
23
+ * @returns Whether the time falls within this break period.
24
+ */
25
+ contains(time) {
26
+ return (time >= this.startTime &&
27
+ time <= this.endTime - BreakPoint.MIN_BREAK_DURATION / 2);
28
+ }
29
+ }
30
+ exports.BreakPoint = BreakPoint;
31
+ /**
32
+ * The minimum duration required for a break to have any effect.
33
+ */
34
+ BreakPoint.MIN_BREAK_DURATION = 650;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DifficultyControlPoint = void 0;
4
+ const TimingPoint_1 = require("./TimingPoint");
5
+ /**
6
+ * Represents a timing point that changes speed multiplier.
7
+ */
8
+ class DifficultyControlPoint extends TimingPoint_1.TimingPoint {
9
+ constructor(values) {
10
+ super(values);
11
+ this.speedMultiplier = values.speedMultiplier;
12
+ }
13
+ toString() {
14
+ return ("{ time: " +
15
+ this.time.toFixed(2) +
16
+ ", " +
17
+ "speed multiplier: " +
18
+ this.speedMultiplier.toFixed(2) +
19
+ " }");
20
+ }
21
+ }
22
+ exports.DifficultyControlPoint = DifficultyControlPoint;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TimingControlPoint = void 0;
4
+ const TimingPoint_1 = require("./TimingPoint");
5
+ /**
6
+ * Represents a timing point that changes the beatmap's BPM.
7
+ */
8
+ class TimingControlPoint extends TimingPoint_1.TimingPoint {
9
+ constructor(values) {
10
+ super(values);
11
+ this.msPerBeat = values.msPerBeat;
12
+ }
13
+ toString() {
14
+ return ("{ time: " +
15
+ this.time.toFixed(2) +
16
+ ", " +
17
+ "ms_per_beat: " +
18
+ this.msPerBeat.toFixed(2) +
19
+ " }");
20
+ }
21
+ }
22
+ exports.TimingControlPoint = TimingControlPoint;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TimingPoint = void 0;
4
+ /**
5
+ * Represents a timing point in a beatmap.
6
+ */
7
+ class TimingPoint {
8
+ constructor(values) {
9
+ this.time = values.time;
10
+ }
11
+ }
12
+ exports.TimingPoint = TimingPoint;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ParserConstants = void 0;
4
+ /**
5
+ * Constants for beatmap parser.
6
+ */
7
+ var ParserConstants;
8
+ (function (ParserConstants) {
9
+ ParserConstants[ParserConstants["MAX_PARSE_VALUE"] = 2147483647] = "MAX_PARSE_VALUE";
10
+ ParserConstants[ParserConstants["MAX_COORDINATE_VALUE"] = 131072] = "MAX_COORDINATE_VALUE";
11
+ ParserConstants[ParserConstants["MIN_REPETITIONS_VALUE"] = 0] = "MIN_REPETITIONS_VALUE";
12
+ ParserConstants[ParserConstants["MAX_REPETITIONS_VALUE"] = 9000] = "MAX_REPETITIONS_VALUE";
13
+ ParserConstants[ParserConstants["MIN_DISTANCE_VALUE"] = 0] = "MIN_DISTANCE_VALUE";
14
+ ParserConstants[ParserConstants["MAX_DISTANCE_VALUE"] = 131072] = "MAX_DISTANCE_VALUE";
15
+ ParserConstants[ParserConstants["MIN_SPEEDMULTIPLIER_VALUE"] = 0.1] = "MIN_SPEEDMULTIPLIER_VALUE";
16
+ ParserConstants[ParserConstants["MAX_SPEEDMULTIPLIER_VALUE"] = 10] = "MAX_SPEEDMULTIPLIER_VALUE";
17
+ ParserConstants[ParserConstants["MIN_MSPERBEAT_VALUE"] = 6] = "MIN_MSPERBEAT_VALUE";
18
+ ParserConstants[ParserConstants["MAX_MSPERBEAT_VALUE"] = 60000] = "MAX_MSPERBEAT_VALUE";
19
+ })(ParserConstants = exports.ParserConstants || (exports.ParserConstants = {}));
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PathType = void 0;
4
+ /**
5
+ * Types of slider paths.
6
+ */
7
+ var PathType;
8
+ (function (PathType) {
9
+ PathType[PathType["Catmull"] = 0] = "Catmull";
10
+ PathType[PathType["Bezier"] = 1] = "Bezier";
11
+ PathType[PathType["Linear"] = 2] = "Linear";
12
+ PathType[PathType["PerfectCurve"] = 3] = "PerfectCurve";
13
+ })(PathType = exports.PathType || (exports.PathType = {}));
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.modes = void 0;
4
+ /**
5
+ * Mode enum to switch things between osu!droid and osu!standard.
6
+ */
7
+ var modes;
8
+ (function (modes) {
9
+ modes["droid"] = "droid";
10
+ modes["osu"] = "osu";
11
+ })(modes = exports.modes || (exports.modes = {}));
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.objectTypes = void 0;
4
+ /**
5
+ * Bitmask constant of object types. This is needed as osu! uses bits to determine object types.
6
+ */
7
+ var objectTypes;
8
+ (function (objectTypes) {
9
+ objectTypes[objectTypes["circle"] = 1] = "circle";
10
+ objectTypes[objectTypes["slider"] = 2] = "slider";
11
+ objectTypes[objectTypes["spinner"] = 8] = "spinner";
12
+ })(objectTypes = exports.objectTypes || (exports.objectTypes = {}));
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.rankedStatus = void 0;
4
+ /**
5
+ * Ranking status of a beatmap.
6
+ */
7
+ var rankedStatus;
8
+ (function (rankedStatus) {
9
+ rankedStatus[rankedStatus["GRAVEYARD"] = -2] = "GRAVEYARD";
10
+ rankedStatus[rankedStatus["WIP"] = -1] = "WIP";
11
+ rankedStatus[rankedStatus["PENDING"] = 0] = "PENDING";
12
+ rankedStatus[rankedStatus["RANKED"] = 1] = "RANKED";
13
+ rankedStatus[rankedStatus["APPROVED"] = 2] = "APPROVED";
14
+ rankedStatus[rankedStatus["QUALIFIED"] = 3] = "QUALIFIED";
15
+ rankedStatus[rankedStatus["LOVED"] = 4] = "LOVED";
16
+ })(rankedStatus = exports.rankedStatus || (exports.rankedStatus = {}));
package/dist/index.js ADDED
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./utils/Accuracy"), exports);
14
+ __exportStar(require("./beatmap/Beatmap"), exports);
15
+ __exportStar(require("./beatmap/timings/BreakPoint"), exports);
16
+ __exportStar(require("./beatmap/hitobjects/Circle"), exports);
17
+ __exportStar(require("./beatmap/timings/DifficultyControlPoint"), exports);
18
+ __exportStar(require("./utils/APIRequestBuilder"), exports);
19
+ __exportStar(require("./utils/HitWindow"), exports);
20
+ __exportStar(require("./beatmap/hitobjects/sliderObjects/HeadCircle"), exports);
21
+ __exportStar(require("./beatmap/hitobjects/HitObject"), exports);
22
+ __exportStar(require("./mathutil/Interpolation"), exports);
23
+ __exportStar(require("./tools/MapInfo"), exports);
24
+ __exportStar(require("./utils/MapStats"), exports);
25
+ __exportStar(require("./mathutil/MathUtils"), exports);
26
+ __exportStar(require("./mods/Mod"), exports);
27
+ __exportStar(require("./mods/ModAuto"), exports);
28
+ __exportStar(require("./mods/ModAutopilot"), exports);
29
+ __exportStar(require("./mods/ModDoubleTime"), exports);
30
+ __exportStar(require("./mods/ModEasy"), exports);
31
+ __exportStar(require("./mods/ModFlashlight"), exports);
32
+ __exportStar(require("./mods/ModHalfTime"), exports);
33
+ __exportStar(require("./mods/ModHardRock"), exports);
34
+ __exportStar(require("./mods/ModHidden"), exports);
35
+ __exportStar(require("./mods/ModNightCore"), exports);
36
+ __exportStar(require("./mods/ModNoFail"), exports);
37
+ __exportStar(require("./mods/ModPerfect"), exports);
38
+ __exportStar(require("./mods/ModPrecise"), exports);
39
+ __exportStar(require("./mods/ModReallyEasy"), exports);
40
+ __exportStar(require("./mods/ModRelax"), exports);
41
+ __exportStar(require("./mods/ModScoreV2"), exports);
42
+ __exportStar(require("./mods/ModSmallCircle"), exports);
43
+ __exportStar(require("./mods/ModSpunOut"), exports);
44
+ __exportStar(require("./mods/ModSuddenDeath"), exports);
45
+ __exportStar(require("./mods/ModTouchDevice"), exports);
46
+ __exportStar(require("./utils/ModUtil"), exports);
47
+ __exportStar(require("./constants/modes"), exports);
48
+ __exportStar(require("./constants/objectTypes"), exports);
49
+ __exportStar(require("./beatmap/Parser"), exports);
50
+ __exportStar(require("./utils/PathApproximator"), exports);
51
+ __exportStar(require("./constants/PathType"), exports);
52
+ __exportStar(require("./utils/Precision"), exports);
53
+ __exportStar(require("./beatmap/hitobjects/sliderObjects/RepeatPoint"), exports);
54
+ __exportStar(require("./constants/rankedStatus"), exports);
55
+ __exportStar(require("./beatmap/hitobjects/Slider"), exports);
56
+ __exportStar(require("./utils/SliderPath"), exports);
57
+ __exportStar(require("./beatmap/hitobjects/sliderObjects/SliderTick"), exports);
58
+ __exportStar(require("./beatmap/hitobjects/Spinner"), exports);
59
+ __exportStar(require("./beatmap/hitobjects/sliderObjects/TailCircle"), exports);
60
+ __exportStar(require("./beatmap/timings/TimingControlPoint"), exports);
61
+ __exportStar(require("./utils/Utils"), exports);
62
+ __exportStar(require("./mathutil/Vector2"), exports);
63
+ const dotenv_1 = require("dotenv");
64
+ (0, dotenv_1.config)();
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Interpolation = void 0;
4
+ class Interpolation {
5
+ static lerp(start, final, amount) {
6
+ return start + (final - start) * amount;
7
+ }
8
+ }
9
+ exports.Interpolation = Interpolation;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MathUtils = void 0;
4
+ /**
5
+ * Some math utility functions.
6
+ */
7
+ class MathUtils {
8
+ /**
9
+ * Rounds a specified number with specified amount of fractional digits.
10
+ *
11
+ * @param num The number to round.
12
+ * @param fractionalDigits The amount of fractional digits.
13
+ */
14
+ static round(num, fractionalDigits) {
15
+ return parseFloat(num.toFixed(fractionalDigits));
16
+ }
17
+ /**
18
+ * Limits the specified number on range `[min, max]`.
19
+ *
20
+ * @param num The number to limit.
21
+ * @param min The minimum range.
22
+ * @param max The maximum range.
23
+ */
24
+ static clamp(num, min, max) {
25
+ return Math.max(min, Math.min(num, max));
26
+ }
27
+ /**
28
+ * Calculates the standard deviation of given data.
29
+ *
30
+ * @param data The data to calculate.
31
+ */
32
+ static calculateStandardDeviation(data) {
33
+ if (data.length === 0) {
34
+ return 0;
35
+ }
36
+ const mean = data.reduce((acc, value) => acc + value) / data.length;
37
+ return Math.sqrt(data.reduce((acc, value) => acc + Math.pow(value - mean, 2), 0) /
38
+ data.length);
39
+ }
40
+ }
41
+ exports.MathUtils = MathUtils;