@rian8337/osu-base 4.0.0-beta.17 → 4.0.0-beta.18
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 +1568 -1878
- package/package.json +4 -4
- package/typings/index.d.ts +0 -2904
- package/dist/index.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -64,10 +64,6 @@ class MathUtils {
|
|
|
64
64
|
* An accuracy calculator that calculates accuracy based on given parameters.
|
|
65
65
|
*/
|
|
66
66
|
class Accuracy {
|
|
67
|
-
n300;
|
|
68
|
-
n100;
|
|
69
|
-
n50;
|
|
70
|
-
nmiss;
|
|
71
67
|
/**
|
|
72
68
|
* Calculates accuracy based on given parameters.
|
|
73
69
|
*
|
|
@@ -78,10 +74,11 @@ class Accuracy {
|
|
|
78
74
|
* @param values Function parameters.
|
|
79
75
|
*/
|
|
80
76
|
constructor(values) {
|
|
81
|
-
|
|
82
|
-
this.
|
|
83
|
-
this.
|
|
84
|
-
this.
|
|
77
|
+
var _a, _b, _c, _d;
|
|
78
|
+
this.nmiss = (_a = values.nmiss) !== null && _a !== void 0 ? _a : 0;
|
|
79
|
+
this.n300 = (_b = values.n300) !== null && _b !== void 0 ? _b : -1;
|
|
80
|
+
this.n100 = (_c = values.n100) !== null && _c !== void 0 ? _c : 0;
|
|
81
|
+
this.n50 = (_d = values.n50) !== null && _d !== void 0 ? _d : 0;
|
|
85
82
|
let nobjects;
|
|
86
83
|
if (values.nobjects) {
|
|
87
84
|
let n300 = this.n300;
|
|
@@ -149,7 +146,7 @@ class Accuracy {
|
|
|
149
146
|
n300 = nobjects - this.n100 - this.n50 - this.nmiss;
|
|
150
147
|
}
|
|
151
148
|
else {
|
|
152
|
-
nobjects
|
|
149
|
+
nobjects !== null && nobjects !== void 0 ? nobjects : (nobjects = n300 + this.n100 + this.n50 + this.nmiss);
|
|
153
150
|
}
|
|
154
151
|
const res = (n300 * 6 + this.n100 * 2 + this.n50) / (nobjects * 6);
|
|
155
152
|
return MathUtils.clamp(res, 0, 1);
|
|
@@ -201,12 +198,6 @@ exports.AnimationLoopType = void 0;
|
|
|
201
198
|
* Represents a gameplay hit sample.
|
|
202
199
|
*/
|
|
203
200
|
class HitSampleInfo {
|
|
204
|
-
/**
|
|
205
|
-
* The sample volume.
|
|
206
|
-
*
|
|
207
|
-
* If this is 0, the control point's volume should be used instead.
|
|
208
|
-
*/
|
|
209
|
-
volume;
|
|
210
201
|
constructor(volume = 0) {
|
|
211
202
|
this.volume = volume;
|
|
212
203
|
}
|
|
@@ -216,31 +207,6 @@ class HitSampleInfo {
|
|
|
216
207
|
* Represents a pre-determined gameplay hit sample that can be loaded from banks.
|
|
217
208
|
*/
|
|
218
209
|
class BankHitSampleInfo extends HitSampleInfo {
|
|
219
|
-
static HIT_WHISTLE = "hitwhistle";
|
|
220
|
-
static HIT_FINISH = "hitfinish";
|
|
221
|
-
static HIT_NORMAL = "hitnormal";
|
|
222
|
-
static HIT_CLAP = "hitclap";
|
|
223
|
-
/**
|
|
224
|
-
* The name of the sample.
|
|
225
|
-
*/
|
|
226
|
-
name;
|
|
227
|
-
/**
|
|
228
|
-
* The bank to load the sample from.
|
|
229
|
-
*/
|
|
230
|
-
bank;
|
|
231
|
-
/**
|
|
232
|
-
* The index of the sample bank, if this sample bank uses custom samples.
|
|
233
|
-
*
|
|
234
|
-
* If this is 0, the control point's sample index should be used instead.
|
|
235
|
-
*/
|
|
236
|
-
customSampleBank;
|
|
237
|
-
/**
|
|
238
|
-
* Whether this hit sample is layered.
|
|
239
|
-
*
|
|
240
|
-
* Layered hit sample are automatically added in all modes (except osu!mania),
|
|
241
|
-
* but can be disabled using the layered skin config option.
|
|
242
|
-
*/
|
|
243
|
-
isLayered;
|
|
244
210
|
constructor(name, bank, customSampleBank = 0, volume = 0, isLayered = false) {
|
|
245
211
|
super(volume);
|
|
246
212
|
this.name = name;
|
|
@@ -249,6 +215,10 @@ class BankHitSampleInfo extends HitSampleInfo {
|
|
|
249
215
|
this.isLayered = isLayered;
|
|
250
216
|
}
|
|
251
217
|
}
|
|
218
|
+
BankHitSampleInfo.HIT_WHISTLE = "hitwhistle";
|
|
219
|
+
BankHitSampleInfo.HIT_FINISH = "hitfinish";
|
|
220
|
+
BankHitSampleInfo.HIT_NORMAL = "hitnormal";
|
|
221
|
+
BankHitSampleInfo.HIT_CLAP = "hitclap";
|
|
252
222
|
|
|
253
223
|
/**
|
|
254
224
|
* Mode enum to switch things between osu!droid and osu!standard.
|
|
@@ -286,14 +256,6 @@ exports.SampleBank = void 0;
|
|
|
286
256
|
* Represents a two-dimensional vector.
|
|
287
257
|
*/
|
|
288
258
|
class Vector2 {
|
|
289
|
-
/**
|
|
290
|
-
* The x position of this vector.
|
|
291
|
-
*/
|
|
292
|
-
x;
|
|
293
|
-
/**
|
|
294
|
-
* The y position of this vector.
|
|
295
|
-
*/
|
|
296
|
-
y;
|
|
297
259
|
constructor(valueOrX, y) {
|
|
298
260
|
if (y === undefined) {
|
|
299
261
|
this.x = valueOrX;
|
|
@@ -415,31 +377,27 @@ class Vector2 {
|
|
|
415
377
|
* Contains difficulty settings of a beatmap.
|
|
416
378
|
*/
|
|
417
379
|
class BeatmapDifficulty {
|
|
418
|
-
/**
|
|
419
|
-
* The approach rate of the beatmap.
|
|
420
|
-
*/
|
|
421
|
-
ar;
|
|
422
|
-
/**
|
|
423
|
-
* The circle size of the beatmap.
|
|
424
|
-
*/
|
|
425
|
-
cs = 5;
|
|
426
|
-
/**
|
|
427
|
-
* The overall difficulty of the beatmap.
|
|
428
|
-
*/
|
|
429
|
-
od = 5;
|
|
430
|
-
/**
|
|
431
|
-
* The health drain rate of the beatmap.
|
|
432
|
-
*/
|
|
433
|
-
hp = 5;
|
|
434
|
-
/**
|
|
435
|
-
* The base slider velocity in hundreds of osu! pixels per beat.
|
|
436
|
-
*/
|
|
437
|
-
sliderMultiplier = 1;
|
|
438
|
-
/**
|
|
439
|
-
* The amount of slider ticks per beat.
|
|
440
|
-
*/
|
|
441
|
-
sliderTickRate = 1;
|
|
442
380
|
constructor(shallowCopy) {
|
|
381
|
+
/**
|
|
382
|
+
* The circle size of the beatmap.
|
|
383
|
+
*/
|
|
384
|
+
this.cs = 5;
|
|
385
|
+
/**
|
|
386
|
+
* The overall difficulty of the beatmap.
|
|
387
|
+
*/
|
|
388
|
+
this.od = 5;
|
|
389
|
+
/**
|
|
390
|
+
* The health drain rate of the beatmap.
|
|
391
|
+
*/
|
|
392
|
+
this.hp = 5;
|
|
393
|
+
/**
|
|
394
|
+
* The base slider velocity in hundreds of osu! pixels per beat.
|
|
395
|
+
*/
|
|
396
|
+
this.sliderMultiplier = 1;
|
|
397
|
+
/**
|
|
398
|
+
* The amount of slider ticks per beat.
|
|
399
|
+
*/
|
|
400
|
+
this.sliderTickRate = 1;
|
|
443
401
|
if (!shallowCopy) {
|
|
444
402
|
return;
|
|
445
403
|
}
|
|
@@ -456,22 +414,6 @@ class BeatmapDifficulty {
|
|
|
456
414
|
* A utility class for calculating circle sizes across all modes (rimu! and osu!standard).
|
|
457
415
|
*/
|
|
458
416
|
class CircleSizeCalculator {
|
|
459
|
-
/**
|
|
460
|
-
* The following comment is copied verbatim from osu!lazer and osu!stable:
|
|
461
|
-
*
|
|
462
|
-
* > Builds of osu! up to 2013-05-04 had the gamefield being rounded down, which caused incorrect radius calculations
|
|
463
|
-
* > in widescreen cases. This ratio adjusts to allow for old replays to work post-fix, which in turn increases the lenience
|
|
464
|
-
* > for all plays, but by an amount so small it should only be effective in replays.
|
|
465
|
-
*
|
|
466
|
-
* To match expectations of gameplay we need to apply this multiplier to circle scale. It's weird but is what it is.
|
|
467
|
-
* It works out to under 1 game pixel and is generally not meaningful to gameplay, but is to replay playback accuracy.
|
|
468
|
-
*/
|
|
469
|
-
static brokenGamefieldRoundingAllowance = 1.00041;
|
|
470
|
-
/**
|
|
471
|
-
* NOTE: This is not the real height that is used in the game, but rather an
|
|
472
|
-
* assumption so that we can treat circle sizes similarly across all devices.
|
|
473
|
-
*/
|
|
474
|
-
static assumedDroidHeight = 681;
|
|
475
417
|
/**
|
|
476
418
|
* Converts osu!droid CS to osu!droid scale.
|
|
477
419
|
*
|
|
@@ -596,6 +538,22 @@ class CircleSizeCalculator {
|
|
|
596
538
|
return this.standardScaleToDroidScale(this.standardCSToStandardScale(cs, applyFudge));
|
|
597
539
|
}
|
|
598
540
|
}
|
|
541
|
+
/**
|
|
542
|
+
* The following comment is copied verbatim from osu!lazer and osu!stable:
|
|
543
|
+
*
|
|
544
|
+
* > Builds of osu! up to 2013-05-04 had the gamefield being rounded down, which caused incorrect radius calculations
|
|
545
|
+
* > in widescreen cases. This ratio adjusts to allow for old replays to work post-fix, which in turn increases the lenience
|
|
546
|
+
* > for all plays, but by an amount so small it should only be effective in replays.
|
|
547
|
+
*
|
|
548
|
+
* To match expectations of gameplay we need to apply this multiplier to circle scale. It's weird but is what it is.
|
|
549
|
+
* It works out to under 1 game pixel and is generally not meaningful to gameplay, but is to replay playback accuracy.
|
|
550
|
+
*/
|
|
551
|
+
CircleSizeCalculator.brokenGamefieldRoundingAllowance = 1.00041;
|
|
552
|
+
/**
|
|
553
|
+
* NOTE: This is not the real height that is used in the game, but rather an
|
|
554
|
+
* assumption so that we can treat circle sizes similarly across all devices.
|
|
555
|
+
*/
|
|
556
|
+
CircleSizeCalculator.assumedDroidHeight = 681;
|
|
599
557
|
|
|
600
558
|
/**
|
|
601
559
|
* Represents a mod.
|
|
@@ -645,37 +603,21 @@ class Mod {
|
|
|
645
603
|
* This is not a real mod in osu! but is used to force difficulty values in the game.
|
|
646
604
|
*/
|
|
647
605
|
class ModDifficultyAdjust extends Mod {
|
|
648
|
-
acronym = "DA";
|
|
649
|
-
name = "Difficulty Adjust";
|
|
650
|
-
droidRanked = false;
|
|
651
|
-
droidScoreMultiplier = 1;
|
|
652
|
-
droidString = "";
|
|
653
|
-
isDroidLegacyMod = false;
|
|
654
|
-
pcRanked = false;
|
|
655
|
-
pcScoreMultiplier = 1;
|
|
656
|
-
bitwise = 0;
|
|
657
|
-
/**
|
|
658
|
-
* The circle size to enforce.
|
|
659
|
-
*/
|
|
660
|
-
cs;
|
|
661
|
-
/**
|
|
662
|
-
* The approach rate to enforce.
|
|
663
|
-
*/
|
|
664
|
-
ar;
|
|
665
|
-
/**
|
|
666
|
-
* The overall difficulty to enforce.
|
|
667
|
-
*/
|
|
668
|
-
od;
|
|
669
|
-
/**
|
|
670
|
-
* The health drain to enforce.
|
|
671
|
-
*/
|
|
672
|
-
hp;
|
|
673
606
|
constructor(values) {
|
|
674
607
|
super();
|
|
675
|
-
this.
|
|
676
|
-
this.
|
|
677
|
-
this.
|
|
678
|
-
this.
|
|
608
|
+
this.acronym = "DA";
|
|
609
|
+
this.name = "Difficulty Adjust";
|
|
610
|
+
this.droidRanked = false;
|
|
611
|
+
this.droidScoreMultiplier = 1;
|
|
612
|
+
this.droidString = "";
|
|
613
|
+
this.isDroidLegacyMod = false;
|
|
614
|
+
this.pcRanked = false;
|
|
615
|
+
this.pcScoreMultiplier = 1;
|
|
616
|
+
this.bitwise = 0;
|
|
617
|
+
this.cs = values === null || values === void 0 ? void 0 : values.cs;
|
|
618
|
+
this.ar = values === null || values === void 0 ? void 0 : values.ar;
|
|
619
|
+
this.od = values === null || values === void 0 ? void 0 : values.od;
|
|
620
|
+
this.hp = values === null || values === void 0 ? void 0 : values.hp;
|
|
679
621
|
}
|
|
680
622
|
applyToDifficulty(mode, difficulty) {
|
|
681
623
|
if (this.cs !== undefined) {
|
|
@@ -697,76 +639,87 @@ class ModDifficultyAdjust extends Mod {
|
|
|
697
639
|
* Represents the DoubleTime mod.
|
|
698
640
|
*/
|
|
699
641
|
class ModDoubleTime extends Mod {
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
642
|
+
constructor() {
|
|
643
|
+
super(...arguments);
|
|
644
|
+
this.acronym = "DT";
|
|
645
|
+
this.name = "DoubleTime";
|
|
646
|
+
this.droidRanked = true;
|
|
647
|
+
this.droidScoreMultiplier = 1.12;
|
|
648
|
+
this.droidString = "d";
|
|
649
|
+
this.isDroidLegacyMod = false;
|
|
650
|
+
this.pcRanked = true;
|
|
651
|
+
this.pcScoreMultiplier = 1.12;
|
|
652
|
+
this.bitwise = 1 << 6;
|
|
653
|
+
}
|
|
709
654
|
}
|
|
710
655
|
|
|
711
656
|
/**
|
|
712
657
|
* Represents the HalfTime mod.
|
|
713
658
|
*/
|
|
714
659
|
class ModHalfTime extends Mod {
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
660
|
+
constructor() {
|
|
661
|
+
super(...arguments);
|
|
662
|
+
this.acronym = "HT";
|
|
663
|
+
this.name = "HalfTime";
|
|
664
|
+
this.droidRanked = true;
|
|
665
|
+
this.droidScoreMultiplier = 0.3;
|
|
666
|
+
this.droidString = "t";
|
|
667
|
+
this.isDroidLegacyMod = false;
|
|
668
|
+
this.pcRanked = true;
|
|
669
|
+
this.pcScoreMultiplier = 0.3;
|
|
670
|
+
this.bitwise = 1 << 8;
|
|
671
|
+
}
|
|
724
672
|
}
|
|
725
673
|
|
|
726
674
|
/**
|
|
727
675
|
* Represents the NightCore mod.
|
|
728
676
|
*/
|
|
729
677
|
class ModNightCore extends Mod {
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
678
|
+
constructor() {
|
|
679
|
+
super(...arguments);
|
|
680
|
+
this.acronym = "NC";
|
|
681
|
+
this.name = "NightCore";
|
|
682
|
+
this.droidRanked = true;
|
|
683
|
+
this.droidString = "c";
|
|
684
|
+
this.isDroidLegacyMod = false;
|
|
685
|
+
this.droidScoreMultiplier = 1.12;
|
|
686
|
+
this.pcRanked = true;
|
|
687
|
+
this.pcScoreMultiplier = 1.12;
|
|
688
|
+
this.bitwise = 1 << 9;
|
|
689
|
+
}
|
|
739
690
|
}
|
|
740
691
|
|
|
741
692
|
/**
|
|
742
693
|
* Represents the Precise mod.
|
|
743
694
|
*/
|
|
744
695
|
class ModPrecise extends Mod {
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
696
|
+
constructor() {
|
|
697
|
+
super(...arguments);
|
|
698
|
+
this.acronym = "PR";
|
|
699
|
+
this.name = "Precise";
|
|
700
|
+
this.droidRanked = true;
|
|
701
|
+
this.droidScoreMultiplier = 1.06;
|
|
702
|
+
this.droidString = "s";
|
|
703
|
+
this.isDroidLegacyMod = false;
|
|
704
|
+
}
|
|
751
705
|
}
|
|
752
706
|
|
|
753
707
|
/**
|
|
754
708
|
* Represents the SpeedUp mod.
|
|
755
709
|
*/
|
|
756
710
|
class ModSpeedUp extends Mod {
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
711
|
+
constructor() {
|
|
712
|
+
super(...arguments);
|
|
713
|
+
this.acronym = "SU";
|
|
714
|
+
this.name = "Speed Up";
|
|
715
|
+
this.droidRanked = false;
|
|
716
|
+
this.droidScoreMultiplier = 1.06;
|
|
717
|
+
this.droidString = "b";
|
|
718
|
+
this.isDroidLegacyMod = true;
|
|
719
|
+
}
|
|
763
720
|
}
|
|
764
721
|
|
|
765
722
|
class HitWindow {
|
|
766
|
-
/**
|
|
767
|
-
* The overall difficulty of this hit window.
|
|
768
|
-
*/
|
|
769
|
-
overallDifficulty;
|
|
770
723
|
/**
|
|
771
724
|
* @param overallDifficulty The overall difficulty of this hit window.
|
|
772
725
|
*/
|
|
@@ -899,23 +852,25 @@ class OsuHitWindow extends HitWindow {
|
|
|
899
852
|
* @returns The difficulty statistics of the beatmap.
|
|
900
853
|
*/
|
|
901
854
|
function calculateDroidDifficultyStatistics(options) {
|
|
902
|
-
|
|
855
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
856
|
+
const overallSpeedMultiplier = calculateSpeedMultiplierFromMods((_a = options.mods) !== null && _a !== void 0 ? _a : [], options.oldStatistics) * ((_b = options.customSpeedMultiplier) !== null && _b !== void 0 ? _b : 1);
|
|
903
857
|
const difficulty = new BeatmapDifficulty();
|
|
904
|
-
difficulty.cs = options.circleSize
|
|
905
|
-
difficulty.ar = options.approachRate
|
|
906
|
-
difficulty.od = options.overallDifficulty
|
|
907
|
-
difficulty.hp = options.healthDrain
|
|
908
|
-
const difficultyAdjustMod = options.mods
|
|
909
|
-
options.mods
|
|
858
|
+
difficulty.cs = (_c = options.circleSize) !== null && _c !== void 0 ? _c : difficulty.cs;
|
|
859
|
+
difficulty.ar = (_e = (_d = options.approachRate) !== null && _d !== void 0 ? _d : difficulty.ar) !== null && _e !== void 0 ? _e : difficulty.od;
|
|
860
|
+
difficulty.od = (_f = options.overallDifficulty) !== null && _f !== void 0 ? _f : difficulty.od;
|
|
861
|
+
difficulty.hp = (_g = options.healthDrain) !== null && _g !== void 0 ? _g : difficulty.hp;
|
|
862
|
+
const difficultyAdjustMod = (_h = options.mods) === null || _h === void 0 ? void 0 : _h.find((mod) => mod instanceof ModDifficultyAdjust);
|
|
863
|
+
(_j = options.mods) === null || _j === void 0 ? void 0 : _j.forEach((mod) => {
|
|
910
864
|
if (mod.isApplicableToDifficulty()) {
|
|
911
865
|
mod.applyToDifficulty(exports.Modes.droid, difficulty);
|
|
912
866
|
}
|
|
913
867
|
});
|
|
914
868
|
// Special handling for difficulty adjust mod where difficulty statistics are forced.
|
|
915
|
-
difficultyAdjustMod
|
|
916
|
-
options.mods
|
|
869
|
+
difficultyAdjustMod === null || difficultyAdjustMod === void 0 ? void 0 : difficultyAdjustMod.applyToDifficulty(exports.Modes.droid, difficulty);
|
|
870
|
+
(_k = options.mods) === null || _k === void 0 ? void 0 : _k.forEach((mod, _, arr) => {
|
|
871
|
+
var _a;
|
|
917
872
|
if (mod.isApplicableToDifficultyWithSettings()) {
|
|
918
|
-
mod.applyToDifficultyWithSettings(exports.Modes.droid, difficulty, arr, options.customSpeedMultiplier
|
|
873
|
+
mod.applyToDifficultyWithSettings(exports.Modes.droid, difficulty, arr, (_a = options.customSpeedMultiplier) !== null && _a !== void 0 ? _a : 1);
|
|
919
874
|
}
|
|
920
875
|
});
|
|
921
876
|
if (options.circleSize !== undefined &&
|
|
@@ -926,15 +881,15 @@ function calculateDroidDifficultyStatistics(options) {
|
|
|
926
881
|
}
|
|
927
882
|
// Apply speed-changing mods
|
|
928
883
|
if (options.approachRate !== undefined &&
|
|
929
|
-
difficultyAdjustMod
|
|
884
|
+
(difficultyAdjustMod === null || difficultyAdjustMod === void 0 ? void 0 : difficultyAdjustMod.ar) === undefined) {
|
|
930
885
|
const approachRateMilliseconds = convertApproachRateToMilliseconds(difficulty.ar) /
|
|
931
886
|
overallSpeedMultiplier;
|
|
932
887
|
difficulty.ar = convertApproachRateMilliseconds(approachRateMilliseconds);
|
|
933
888
|
}
|
|
934
889
|
if (options.overallDifficulty !== undefined) {
|
|
935
|
-
const isPrecise = options.mods
|
|
890
|
+
const isPrecise = (_m = (_l = options.mods) === null || _l === void 0 ? void 0 : _l.some((mod) => mod instanceof ModPrecise)) !== null && _m !== void 0 ? _m : false;
|
|
936
891
|
let hitWindowGreat = new DroidHitWindow(difficulty.od).hitWindowFor300(isPrecise);
|
|
937
|
-
if (difficultyAdjustMod
|
|
892
|
+
if ((difficultyAdjustMod === null || difficultyAdjustMod === void 0 ? void 0 : difficultyAdjustMod.od) === undefined) {
|
|
938
893
|
hitWindowGreat /= overallSpeedMultiplier;
|
|
939
894
|
}
|
|
940
895
|
difficulty.od =
|
|
@@ -967,35 +922,37 @@ function calculateDroidDifficultyStatistics(options) {
|
|
|
967
922
|
* @returns The difficulty statistics of the beatmap.
|
|
968
923
|
*/
|
|
969
924
|
function calculateOsuDifficultyStatistics(options) {
|
|
970
|
-
|
|
971
|
-
|
|
925
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
926
|
+
const overallSpeedMultiplier = calculateSpeedMultiplierFromMods((_a = options.mods) !== null && _a !== void 0 ? _a : []) *
|
|
927
|
+
((_b = options.customSpeedMultiplier) !== null && _b !== void 0 ? _b : 1);
|
|
972
928
|
const difficulty = new BeatmapDifficulty();
|
|
973
|
-
difficulty.cs = options.circleSize
|
|
974
|
-
difficulty.ar = options.approachRate
|
|
975
|
-
difficulty.od = options.overallDifficulty
|
|
976
|
-
difficulty.hp = options.healthDrain
|
|
977
|
-
const difficultyAdjustMod = options.mods
|
|
978
|
-
options.mods
|
|
929
|
+
difficulty.cs = (_c = options.circleSize) !== null && _c !== void 0 ? _c : difficulty.cs;
|
|
930
|
+
difficulty.ar = (_e = (_d = options.approachRate) !== null && _d !== void 0 ? _d : difficulty.ar) !== null && _e !== void 0 ? _e : difficulty.od;
|
|
931
|
+
difficulty.od = (_f = options.overallDifficulty) !== null && _f !== void 0 ? _f : difficulty.od;
|
|
932
|
+
difficulty.hp = (_g = options.healthDrain) !== null && _g !== void 0 ? _g : difficulty.hp;
|
|
933
|
+
const difficultyAdjustMod = (_h = options.mods) === null || _h === void 0 ? void 0 : _h.find((mod) => mod instanceof ModDifficultyAdjust);
|
|
934
|
+
(_j = options.mods) === null || _j === void 0 ? void 0 : _j.forEach((mod) => {
|
|
979
935
|
if (mod.isApplicableToDifficulty()) {
|
|
980
936
|
mod.applyToDifficulty(exports.Modes.osu, difficulty);
|
|
981
937
|
}
|
|
982
938
|
});
|
|
983
939
|
// Special handling for difficulty adjust mod where difficulty statistics are forced.
|
|
984
|
-
difficultyAdjustMod
|
|
985
|
-
options.mods
|
|
940
|
+
difficultyAdjustMod === null || difficultyAdjustMod === void 0 ? void 0 : difficultyAdjustMod.applyToDifficulty(exports.Modes.osu, difficulty);
|
|
941
|
+
(_k = options.mods) === null || _k === void 0 ? void 0 : _k.forEach((mod, _, arr) => {
|
|
942
|
+
var _a;
|
|
986
943
|
if (mod.isApplicableToDifficultyWithSettings()) {
|
|
987
|
-
mod.applyToDifficultyWithSettings(exports.Modes.osu, difficulty, arr, options.customSpeedMultiplier
|
|
944
|
+
mod.applyToDifficultyWithSettings(exports.Modes.osu, difficulty, arr, (_a = options.customSpeedMultiplier) !== null && _a !== void 0 ? _a : 1);
|
|
988
945
|
}
|
|
989
946
|
});
|
|
990
947
|
// Apply speed-changing mods
|
|
991
948
|
if (options.approachRate !== undefined &&
|
|
992
|
-
difficultyAdjustMod
|
|
949
|
+
(difficultyAdjustMod === null || difficultyAdjustMod === void 0 ? void 0 : difficultyAdjustMod.ar) === undefined) {
|
|
993
950
|
const approachRateMilliseconds = convertApproachRateToMilliseconds(difficulty.ar) /
|
|
994
951
|
overallSpeedMultiplier;
|
|
995
952
|
difficulty.ar = convertApproachRateMilliseconds(approachRateMilliseconds);
|
|
996
953
|
}
|
|
997
954
|
if (options.overallDifficulty !== undefined &&
|
|
998
|
-
difficultyAdjustMod
|
|
955
|
+
(difficultyAdjustMod === null || difficultyAdjustMod === void 0 ? void 0 : difficultyAdjustMod.od) === undefined) {
|
|
999
956
|
const hitWindowGreat = new OsuHitWindow(difficulty.od).hitWindowFor300() /
|
|
1000
957
|
overallSpeedMultiplier;
|
|
1001
958
|
difficulty.od = OsuHitWindow.hitWindow300ToOD(hitWindowGreat);
|
|
@@ -1073,63 +1030,12 @@ function convertApproachRateMilliseconds(ms) {
|
|
|
1073
1030
|
* Represents a hitobject in a beatmap.
|
|
1074
1031
|
*/
|
|
1075
1032
|
class HitObject {
|
|
1076
|
-
/**
|
|
1077
|
-
* The base radius of all hitobjects.
|
|
1078
|
-
*/
|
|
1079
|
-
static baseRadius = 64;
|
|
1080
|
-
/**
|
|
1081
|
-
* A small adjustment to the start time of control points to account for rounding/precision errors.
|
|
1082
|
-
*/
|
|
1083
|
-
static controlPointLeniency = 1;
|
|
1084
|
-
/**
|
|
1085
|
-
* The start time of the hitobject in milliseconds.
|
|
1086
|
-
*/
|
|
1087
|
-
startTime;
|
|
1088
|
-
/**
|
|
1089
|
-
* The bitwise type of the hitobject (circle/slider/spinner).
|
|
1090
|
-
*/
|
|
1091
|
-
type;
|
|
1092
|
-
/**
|
|
1093
|
-
* The position of the hitobject in osu!pixels.
|
|
1094
|
-
*/
|
|
1095
|
-
position;
|
|
1096
|
-
/**
|
|
1097
|
-
* The end position of the hitobject in osu!pixels.
|
|
1098
|
-
*/
|
|
1099
|
-
endPosition;
|
|
1100
|
-
/**
|
|
1101
|
-
* The end time of the hitobject.
|
|
1102
|
-
*/
|
|
1103
|
-
endTime;
|
|
1104
1033
|
/**
|
|
1105
1034
|
* The duration of the hitobject.
|
|
1106
1035
|
*/
|
|
1107
1036
|
get duration() {
|
|
1108
1037
|
return this.endTime - this.startTime;
|
|
1109
1038
|
}
|
|
1110
|
-
/**
|
|
1111
|
-
* Whether this hitobject represents a new combo.
|
|
1112
|
-
*/
|
|
1113
|
-
isNewCombo;
|
|
1114
|
-
/**
|
|
1115
|
-
* How many combo colors to skip, if this hitobject starts a new combo.
|
|
1116
|
-
*/
|
|
1117
|
-
comboOffset;
|
|
1118
|
-
/**
|
|
1119
|
-
* The samples to be played when this hitobject is hit.
|
|
1120
|
-
*
|
|
1121
|
-
* In the case of sliders, this is the sample of the curve body
|
|
1122
|
-
* and can be treated as the default samples for the hitobject.
|
|
1123
|
-
*/
|
|
1124
|
-
samples = [];
|
|
1125
|
-
/**
|
|
1126
|
-
* Any samples which may be used by this hitobject that are non-standard.
|
|
1127
|
-
*/
|
|
1128
|
-
auxiliarySamples = [];
|
|
1129
|
-
/**
|
|
1130
|
-
* The stack height of this hitobject.
|
|
1131
|
-
*/
|
|
1132
|
-
_stackHeight = 0;
|
|
1133
1039
|
/**
|
|
1134
1040
|
* The stack height of this hitobject.
|
|
1135
1041
|
*/
|
|
@@ -1142,10 +1048,6 @@ class HitObject {
|
|
|
1142
1048
|
set stackHeight(value) {
|
|
1143
1049
|
this._stackHeight = value;
|
|
1144
1050
|
}
|
|
1145
|
-
/**
|
|
1146
|
-
* The osu!standard scale of this hitobject.
|
|
1147
|
-
*/
|
|
1148
|
-
_scale = 1;
|
|
1149
1051
|
/**
|
|
1150
1052
|
* The osu!standard scale of this hitobject.
|
|
1151
1053
|
*/
|
|
@@ -1158,14 +1060,6 @@ class HitObject {
|
|
|
1158
1060
|
set scale(value) {
|
|
1159
1061
|
this._scale = value;
|
|
1160
1062
|
}
|
|
1161
|
-
/**
|
|
1162
|
-
* The time at which the approach circle of this hitobject should appear before this hitobject starts.
|
|
1163
|
-
*/
|
|
1164
|
-
timePreempt = 600;
|
|
1165
|
-
/**
|
|
1166
|
-
* The time at which this hitobject should fade after this hitobject appears with respect to its time preempt.
|
|
1167
|
-
*/
|
|
1168
|
-
timeFadeIn = 400;
|
|
1169
1063
|
/**
|
|
1170
1064
|
* The hitobject type (circle, slider, or spinner).
|
|
1171
1065
|
*/
|
|
@@ -1189,13 +1083,41 @@ class HitObject {
|
|
|
1189
1083
|
return HitObject.baseRadius * this._scale;
|
|
1190
1084
|
}
|
|
1191
1085
|
constructor(values) {
|
|
1086
|
+
var _a, _b, _c, _d, _e;
|
|
1087
|
+
/**
|
|
1088
|
+
* The samples to be played when this hitobject is hit.
|
|
1089
|
+
*
|
|
1090
|
+
* In the case of sliders, this is the sample of the curve body
|
|
1091
|
+
* and can be treated as the default samples for the hitobject.
|
|
1092
|
+
*/
|
|
1093
|
+
this.samples = [];
|
|
1094
|
+
/**
|
|
1095
|
+
* Any samples which may be used by this hitobject that are non-standard.
|
|
1096
|
+
*/
|
|
1097
|
+
this.auxiliarySamples = [];
|
|
1098
|
+
/**
|
|
1099
|
+
* The stack height of this hitobject.
|
|
1100
|
+
*/
|
|
1101
|
+
this._stackHeight = 0;
|
|
1102
|
+
/**
|
|
1103
|
+
* The osu!standard scale of this hitobject.
|
|
1104
|
+
*/
|
|
1105
|
+
this._scale = 1;
|
|
1106
|
+
/**
|
|
1107
|
+
* The time at which the approach circle of this hitobject should appear before this hitobject starts.
|
|
1108
|
+
*/
|
|
1109
|
+
this.timePreempt = 600;
|
|
1110
|
+
/**
|
|
1111
|
+
* The time at which this hitobject should fade after this hitobject appears with respect to its time preempt.
|
|
1112
|
+
*/
|
|
1113
|
+
this.timeFadeIn = 400;
|
|
1192
1114
|
this.startTime = values.startTime;
|
|
1193
|
-
this.endTime = values.endTime
|
|
1194
|
-
this.type = values.type
|
|
1115
|
+
this.endTime = (_a = values.endTime) !== null && _a !== void 0 ? _a : values.startTime;
|
|
1116
|
+
this.type = (_b = values.type) !== null && _b !== void 0 ? _b : exports.ObjectTypes.circle;
|
|
1195
1117
|
this.position = values.position;
|
|
1196
|
-
this.endPosition = values.endPosition
|
|
1197
|
-
this.isNewCombo = values.newCombo
|
|
1198
|
-
this.comboOffset = values.comboOffset
|
|
1118
|
+
this.endPosition = (_c = values.endPosition) !== null && _c !== void 0 ? _c : this.position;
|
|
1119
|
+
this.isNewCombo = (_d = values.newCombo) !== null && _d !== void 0 ? _d : false;
|
|
1120
|
+
this.comboOffset = (_e = values.comboOffset) !== null && _e !== void 0 ? _e : 0;
|
|
1199
1121
|
}
|
|
1200
1122
|
/**
|
|
1201
1123
|
* Applies default values to this hitobject.
|
|
@@ -1205,7 +1127,8 @@ class HitObject {
|
|
|
1205
1127
|
* @param mode The gamemode to apply defaults for.
|
|
1206
1128
|
*/
|
|
1207
1129
|
applyDefaults(controlPoints, difficulty, mode) {
|
|
1208
|
-
|
|
1130
|
+
var _a;
|
|
1131
|
+
this.timePreempt = convertApproachRateToMilliseconds((_a = difficulty.ar) !== null && _a !== void 0 ? _a : difficulty.od);
|
|
1209
1132
|
// Preempt time can go below 450ms. Normally, this is achieved via the DT mod which uniformly speeds up all animations game wide regardless of AR.
|
|
1210
1133
|
// This uniform speedup is hard to match 1:1, however we can at least make AR>10 (via mods) feel good by extending the upper linear function above.
|
|
1211
1134
|
// Note that this doesn't exactly match the AR>10 visuals as they're classically known, but it feels good.
|
|
@@ -1299,19 +1222,19 @@ class HitObject {
|
|
|
1299
1222
|
return position.add(this.getStackOffset(mode));
|
|
1300
1223
|
}
|
|
1301
1224
|
}
|
|
1225
|
+
/**
|
|
1226
|
+
* The base radius of all hitobjects.
|
|
1227
|
+
*/
|
|
1228
|
+
HitObject.baseRadius = 64;
|
|
1229
|
+
/**
|
|
1230
|
+
* A small adjustment to the start time of control points to account for rounding/precision errors.
|
|
1231
|
+
*/
|
|
1232
|
+
HitObject.controlPointLeniency = 1;
|
|
1302
1233
|
|
|
1303
1234
|
/**
|
|
1304
1235
|
* Represents a hitobject that can be nested within a slider.
|
|
1305
1236
|
*/
|
|
1306
1237
|
class SliderNestedHitObject extends HitObject {
|
|
1307
|
-
/**
|
|
1308
|
-
* The index of the span at which this nested hitobject lies.
|
|
1309
|
-
*/
|
|
1310
|
-
spanIndex;
|
|
1311
|
-
/**
|
|
1312
|
-
* The start time of the span at which this nested hitobject lies, in milliseconds.
|
|
1313
|
-
*/
|
|
1314
|
-
spanStartTime;
|
|
1315
1238
|
constructor(values) {
|
|
1316
1239
|
super(values);
|
|
1317
1240
|
this.spanIndex = values.spanIndex;
|
|
@@ -1327,7 +1250,7 @@ class SliderNestedHitObject extends HitObject {
|
|
|
1327
1250
|
*/
|
|
1328
1251
|
class SliderHead extends SliderNestedHitObject {
|
|
1329
1252
|
constructor(values) {
|
|
1330
|
-
super({
|
|
1253
|
+
super(Object.assign(Object.assign({}, values), { spanIndex: 0, spanStartTime: values.startTime }));
|
|
1331
1254
|
}
|
|
1332
1255
|
}
|
|
1333
1256
|
|
|
@@ -1353,18 +1276,6 @@ class SliderTail extends SliderNestedHitObject {
|
|
|
1353
1276
|
* Represents a slider in a beatmap.
|
|
1354
1277
|
*/
|
|
1355
1278
|
class Slider extends HitObject {
|
|
1356
|
-
/**
|
|
1357
|
-
* The nested hitobjects of the slider. Consists of headcircle (sliderhead), slider ticks, repeat points, and tailcircle (sliderend).
|
|
1358
|
-
*/
|
|
1359
|
-
nestedHitObjects = [];
|
|
1360
|
-
/**
|
|
1361
|
-
* The slider's path.
|
|
1362
|
-
*/
|
|
1363
|
-
path;
|
|
1364
|
-
/**
|
|
1365
|
-
* The slider's velocity.
|
|
1366
|
-
*/
|
|
1367
|
-
_velocity = 0;
|
|
1368
1279
|
/**
|
|
1369
1280
|
* The slider's velocity.
|
|
1370
1281
|
*/
|
|
@@ -1377,10 +1288,6 @@ class Slider extends HitObject {
|
|
|
1377
1288
|
get distance() {
|
|
1378
1289
|
return this.path.expectedDistance;
|
|
1379
1290
|
}
|
|
1380
|
-
/**
|
|
1381
|
-
* The amount of times this slider repeats.
|
|
1382
|
-
*/
|
|
1383
|
-
_repeatCount;
|
|
1384
1291
|
/**
|
|
1385
1292
|
* The amount of times this slider repeats.
|
|
1386
1293
|
*/
|
|
@@ -1400,67 +1307,18 @@ class Slider extends HitObject {
|
|
|
1400
1307
|
get spanCount() {
|
|
1401
1308
|
return this._repeatCount + 1;
|
|
1402
1309
|
}
|
|
1403
|
-
/**
|
|
1404
|
-
* The spacing between slider ticks of this slider.
|
|
1405
|
-
*/
|
|
1406
|
-
_tickDistance = 0;
|
|
1407
1310
|
/**
|
|
1408
1311
|
* The spacing between slider ticks of this slider.
|
|
1409
1312
|
*/
|
|
1410
1313
|
get tickDistance() {
|
|
1411
1314
|
return this._tickDistance;
|
|
1412
1315
|
}
|
|
1413
|
-
/**
|
|
1414
|
-
* An extra multiplier that affects the number of slider ticks generated by this slider.
|
|
1415
|
-
* An increase in this value increases `tickDistance`, which reduces the number of ticks generated.
|
|
1416
|
-
*/
|
|
1417
|
-
tickDistanceMultiplier;
|
|
1418
|
-
/**
|
|
1419
|
-
* Whether slider ticks should be generated by this object.
|
|
1420
|
-
*
|
|
1421
|
-
* This exists for backwards compatibility with maps that abuse NaN slider velocity behavior on osu!stable (e.g. /b/2628991).
|
|
1422
|
-
*/
|
|
1423
|
-
generateTicks = true;
|
|
1424
|
-
/**
|
|
1425
|
-
* The position of the cursor at the point of completion of this slider if it was hit
|
|
1426
|
-
* with as few movements as possible. This is set and used by difficulty calculation.
|
|
1427
|
-
*/
|
|
1428
|
-
lazyEndPosition;
|
|
1429
|
-
/**
|
|
1430
|
-
* The distance travelled by the cursor upon completion of this slider if it was hit
|
|
1431
|
-
* with as few movements as possible. This is set and used by difficulty calculation.
|
|
1432
|
-
*/
|
|
1433
|
-
lazyTravelDistance = 0;
|
|
1434
|
-
/**
|
|
1435
|
-
* The time taken by the cursor upon completion of this slider if it was hit with
|
|
1436
|
-
* as few movements as possible. This is set and used by difficulty calculation.
|
|
1437
|
-
*/
|
|
1438
|
-
lazyTravelTime = 0;
|
|
1439
1316
|
/**
|
|
1440
1317
|
* The length of one span of this slider.
|
|
1441
1318
|
*/
|
|
1442
1319
|
get spanDuration() {
|
|
1443
1320
|
return this.duration / this.spanCount;
|
|
1444
1321
|
}
|
|
1445
|
-
/**
|
|
1446
|
-
* The slider's head.
|
|
1447
|
-
*/
|
|
1448
|
-
head;
|
|
1449
|
-
/**
|
|
1450
|
-
* The slider's tail.
|
|
1451
|
-
*/
|
|
1452
|
-
tail;
|
|
1453
|
-
/**
|
|
1454
|
-
* The samples to be played when each node of this slider is hit.
|
|
1455
|
-
*
|
|
1456
|
-
* - 0: The first node.
|
|
1457
|
-
* - 1: The first repeat.
|
|
1458
|
-
* - 2: The second repeat.
|
|
1459
|
-
* - ...
|
|
1460
|
-
* - `n - 1`: The last repeat.
|
|
1461
|
-
* - `n`: The last node.
|
|
1462
|
-
*/
|
|
1463
|
-
nodeSamples;
|
|
1464
1322
|
/**
|
|
1465
1323
|
* The amount of slider ticks in this slider.
|
|
1466
1324
|
*
|
|
@@ -1488,9 +1346,36 @@ class Slider extends HitObject {
|
|
|
1488
1346
|
nestedObject.scale = value;
|
|
1489
1347
|
}
|
|
1490
1348
|
}
|
|
1491
|
-
static legacyLastTickOffset = 36;
|
|
1492
1349
|
constructor(values) {
|
|
1493
1350
|
super(values);
|
|
1351
|
+
/**
|
|
1352
|
+
* The nested hitobjects of the slider. Consists of headcircle (sliderhead), slider ticks, repeat points, and tailcircle (sliderend).
|
|
1353
|
+
*/
|
|
1354
|
+
this.nestedHitObjects = [];
|
|
1355
|
+
/**
|
|
1356
|
+
* The slider's velocity.
|
|
1357
|
+
*/
|
|
1358
|
+
this._velocity = 0;
|
|
1359
|
+
/**
|
|
1360
|
+
* The spacing between slider ticks of this slider.
|
|
1361
|
+
*/
|
|
1362
|
+
this._tickDistance = 0;
|
|
1363
|
+
/**
|
|
1364
|
+
* Whether slider ticks should be generated by this object.
|
|
1365
|
+
*
|
|
1366
|
+
* This exists for backwards compatibility with maps that abuse NaN slider velocity behavior on osu!stable (e.g. /b/2628991).
|
|
1367
|
+
*/
|
|
1368
|
+
this.generateTicks = true;
|
|
1369
|
+
/**
|
|
1370
|
+
* The distance travelled by the cursor upon completion of this slider if it was hit
|
|
1371
|
+
* with as few movements as possible. This is set and used by difficulty calculation.
|
|
1372
|
+
*/
|
|
1373
|
+
this.lazyTravelDistance = 0;
|
|
1374
|
+
/**
|
|
1375
|
+
* The time taken by the cursor upon completion of this slider if it was hit with
|
|
1376
|
+
* as few movements as possible. This is set and used by difficulty calculation.
|
|
1377
|
+
*/
|
|
1378
|
+
this.lazyTravelTime = 0;
|
|
1494
1379
|
this.path = values.path;
|
|
1495
1380
|
this.nodeSamples = values.nodeSamples;
|
|
1496
1381
|
this._repeatCount = values.repeatCount;
|
|
@@ -1676,14 +1561,14 @@ class Slider extends HitObject {
|
|
|
1676
1561
|
this.tail.position = this.endPosition;
|
|
1677
1562
|
}
|
|
1678
1563
|
updateNestedSamples() {
|
|
1564
|
+
var _a;
|
|
1679
1565
|
const bankSamples = this.samples.filter((v) => v instanceof BankHitSampleInfo);
|
|
1680
|
-
const normalSample = bankSamples.find((v) => v.name === BankHitSampleInfo.HIT_NORMAL)
|
|
1681
|
-
bankSamples.at(0);
|
|
1566
|
+
const normalSample = (_a = bankSamples.find((v) => v.name === BankHitSampleInfo.HIT_NORMAL)) !== null && _a !== void 0 ? _a : bankSamples.at(0);
|
|
1682
1567
|
const sampleList = [];
|
|
1683
1568
|
if (normalSample) {
|
|
1684
1569
|
sampleList.push(new BankHitSampleInfo("slidertick", normalSample.bank, normalSample.customSampleBank, normalSample.volume, normalSample.isLayered));
|
|
1685
1570
|
}
|
|
1686
|
-
const getSample = (index) => this.nodeSamples.at(index)
|
|
1571
|
+
const getSample = (index) => { var _a; return (_a = this.nodeSamples.at(index)) !== null && _a !== void 0 ? _a : this.samples; };
|
|
1687
1572
|
this.nestedHitObjects.forEach((v) => {
|
|
1688
1573
|
switch (true) {
|
|
1689
1574
|
case v instanceof SliderHead:
|
|
@@ -1704,6 +1589,7 @@ class Slider extends HitObject {
|
|
|
1704
1589
|
return `Position: [${this.position.x}, ${this.position.y}], distance: ${this.path.expectedDistance}, repeat count: ${this.repeatCount}, slider ticks: ${this.nestedHitObjects.filter((v) => v instanceof SliderTick).length}`;
|
|
1705
1590
|
}
|
|
1706
1591
|
}
|
|
1592
|
+
Slider.legacyLastTickOffset = 36;
|
|
1707
1593
|
|
|
1708
1594
|
/**
|
|
1709
1595
|
* Represents the speed of the countdown before the first hit object.
|
|
@@ -1745,73 +1631,75 @@ exports.GameMode = void 0;
|
|
|
1745
1631
|
* Contains general information about a beatmap.
|
|
1746
1632
|
*/
|
|
1747
1633
|
class BeatmapGeneral {
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1634
|
+
constructor() {
|
|
1635
|
+
/**
|
|
1636
|
+
* The location of the audio file relative to the beatmapset file.
|
|
1637
|
+
*/
|
|
1638
|
+
this.audioFilename = "";
|
|
1639
|
+
/**
|
|
1640
|
+
* The amount of milliseconds of silence before the audio starts playing.
|
|
1641
|
+
*/
|
|
1642
|
+
this.audioLeadIn = 0;
|
|
1643
|
+
/**
|
|
1644
|
+
* The time in milliseconds when the audio preview should start.
|
|
1645
|
+
*
|
|
1646
|
+
* If -1, the audio should begin playing at 40% of its length.
|
|
1647
|
+
*/
|
|
1648
|
+
this.previewTime = -1;
|
|
1649
|
+
/**
|
|
1650
|
+
* The speed of the countdown before the first hit object.
|
|
1651
|
+
*/
|
|
1652
|
+
this.countdown = exports.BeatmapCountdown.normal;
|
|
1653
|
+
/**
|
|
1654
|
+
* The sample bank that will be used if timing points do not override it.
|
|
1655
|
+
*/
|
|
1656
|
+
this.sampleBank = exports.SampleBank.normal;
|
|
1657
|
+
/**
|
|
1658
|
+
* The sample volume that will be used if timing points do not override it.
|
|
1659
|
+
*/
|
|
1660
|
+
this.sampleVolume = 100;
|
|
1661
|
+
/**
|
|
1662
|
+
* The multiplier for the threshold in time where hit objects
|
|
1663
|
+
* placed close together stack, ranging from 0 to 1.
|
|
1664
|
+
*/
|
|
1665
|
+
this.stackLeniency = 0.7;
|
|
1666
|
+
/**
|
|
1667
|
+
* The game mode of the beatmap.
|
|
1668
|
+
*/
|
|
1669
|
+
this.mode = exports.GameMode.osu;
|
|
1670
|
+
/**
|
|
1671
|
+
* Whether or not breaks have a letterboxing effect.
|
|
1672
|
+
*/
|
|
1673
|
+
this.letterBoxInBreaks = false;
|
|
1674
|
+
/**
|
|
1675
|
+
* Whether or not the storyboard can use the user's skin images.
|
|
1676
|
+
*/
|
|
1677
|
+
this.useSkinSprites = false;
|
|
1678
|
+
/**
|
|
1679
|
+
* The draw order of hit circle overlays compared to hit numbers.
|
|
1680
|
+
*/
|
|
1681
|
+
this.overlayPosition = exports.BeatmapOverlayPosition.noChange;
|
|
1682
|
+
/**
|
|
1683
|
+
* The preffered skin to use during gameplay.
|
|
1684
|
+
*/
|
|
1685
|
+
this.skinPreference = "";
|
|
1686
|
+
/**
|
|
1687
|
+
* Whether or not a warning about flashing colours should be shown at the beginning of the map.
|
|
1688
|
+
*/
|
|
1689
|
+
this.epilepsyWarning = false;
|
|
1690
|
+
/**
|
|
1691
|
+
* The time in beats that the countdown starts before the first hit object.
|
|
1692
|
+
*/
|
|
1693
|
+
this.countdownOffset = 0;
|
|
1694
|
+
/**
|
|
1695
|
+
* Whether or not the storyboard allows widescreen viewing.
|
|
1696
|
+
*/
|
|
1697
|
+
this.widescreenStoryboard = false;
|
|
1698
|
+
/**
|
|
1699
|
+
* Whether or not sound samples will change rate when playing with speed-changing mods.
|
|
1700
|
+
*/
|
|
1701
|
+
this.samplesMatchPlaybackRate = true;
|
|
1702
|
+
}
|
|
1815
1703
|
}
|
|
1816
1704
|
|
|
1817
1705
|
/**
|
|
@@ -1829,72 +1717,68 @@ exports.EditorGridSize = void 0;
|
|
|
1829
1717
|
* Contains saved settings for the beatmap editor.
|
|
1830
1718
|
*/
|
|
1831
1719
|
class BeatmapEditor {
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1720
|
+
constructor() {
|
|
1721
|
+
/**
|
|
1722
|
+
* Time in milliseconds of bookmarks.
|
|
1723
|
+
*/
|
|
1724
|
+
this.bookmarks = [];
|
|
1725
|
+
/**
|
|
1726
|
+
* The multiplier at which distance between consecutive notes will be snapped based on their rhythmical difference.
|
|
1727
|
+
*/
|
|
1728
|
+
this.distanceSnap = 1;
|
|
1729
|
+
/**
|
|
1730
|
+
* Determines the editor's behaviour in quantizing hit objects based on the {@link https://osu.ppy.sh/wiki/en/Client/Beatmap_editor/Beat_Snap Beat Snap} principles.
|
|
1731
|
+
*/
|
|
1732
|
+
this.beatDivisor = 4;
|
|
1733
|
+
/**
|
|
1734
|
+
* The grid size setting in the editor.
|
|
1735
|
+
*/
|
|
1736
|
+
this.gridSize = exports.EditorGridSize.small;
|
|
1737
|
+
/**
|
|
1738
|
+
* The scale factor for the {@link https://osu.ppy.sh/wiki/en/Client/Beatmap_editor/Compose#top-left-(hit-objects-timeline) object timeline}.
|
|
1739
|
+
*/
|
|
1740
|
+
this.timelineZoom = 1;
|
|
1741
|
+
}
|
|
1852
1742
|
}
|
|
1853
1743
|
|
|
1854
1744
|
/**
|
|
1855
1745
|
* Contains information used to identify a beatmap.
|
|
1856
1746
|
*/
|
|
1857
1747
|
class BeatmapMetadata {
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
*/
|
|
1893
|
-
beatmapId;
|
|
1894
|
-
/**
|
|
1895
|
-
* The ID of the beatmapset containing this beatmap.
|
|
1896
|
-
*/
|
|
1897
|
-
beatmapSetId;
|
|
1748
|
+
constructor() {
|
|
1749
|
+
/**
|
|
1750
|
+
* The romanized song title of the beatmap.
|
|
1751
|
+
*/
|
|
1752
|
+
this.title = "";
|
|
1753
|
+
/**
|
|
1754
|
+
* The song title of the beatmap.
|
|
1755
|
+
*/
|
|
1756
|
+
this.titleUnicode = "";
|
|
1757
|
+
/**
|
|
1758
|
+
* The romanized artist of the song of the beatmap.
|
|
1759
|
+
*/
|
|
1760
|
+
this.artist = "";
|
|
1761
|
+
/**
|
|
1762
|
+
* The song artist of the beatmap.
|
|
1763
|
+
*/
|
|
1764
|
+
this.artistUnicode = "";
|
|
1765
|
+
/**
|
|
1766
|
+
* The creator of the beatmap.
|
|
1767
|
+
*/
|
|
1768
|
+
this.creator = "";
|
|
1769
|
+
/**
|
|
1770
|
+
* The difficulty name of the beatmap.
|
|
1771
|
+
*/
|
|
1772
|
+
this.version = "";
|
|
1773
|
+
/**
|
|
1774
|
+
* The original media the song was produced for.
|
|
1775
|
+
*/
|
|
1776
|
+
this.source = "";
|
|
1777
|
+
/**
|
|
1778
|
+
* The search terms of the beatmap.
|
|
1779
|
+
*/
|
|
1780
|
+
this.tags = [];
|
|
1781
|
+
}
|
|
1898
1782
|
/**
|
|
1899
1783
|
* The full title of the beatmap, which is `Artist - Title (Creator) [Difficulty Name]`.
|
|
1900
1784
|
*/
|
|
@@ -1928,29 +1812,18 @@ exports.StoryboardLayerType = void 0;
|
|
|
1928
1812
|
* Contains beatmap events.
|
|
1929
1813
|
*/
|
|
1930
1814
|
class BeatmapEvents {
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
*/
|
|
1938
|
-
video;
|
|
1939
|
-
/**
|
|
1940
|
-
* The beatmap's storyboard.
|
|
1941
|
-
*/
|
|
1942
|
-
storyboard;
|
|
1943
|
-
/**
|
|
1944
|
-
* The breaks this beatmap has.
|
|
1945
|
-
*/
|
|
1946
|
-
breaks = [];
|
|
1815
|
+
constructor() {
|
|
1816
|
+
/**
|
|
1817
|
+
* The breaks this beatmap has.
|
|
1818
|
+
*/
|
|
1819
|
+
this.breaks = [];
|
|
1820
|
+
}
|
|
1947
1821
|
/**
|
|
1948
1822
|
* Whether the beatmap's background should be hidden while its storyboard is being displayed.
|
|
1949
1823
|
*/
|
|
1950
1824
|
get storyboardReplacesBackground() {
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
.elements.some((e) => e.path.toLowerCase() === this.background?.filename) ?? false);
|
|
1825
|
+
var _a, _b;
|
|
1826
|
+
return ((_b = (_a = this.storyboard) === null || _a === void 0 ? void 0 : _a.getLayer(exports.StoryboardLayerType.background).elements.some((e) => { var _a; return e.path.toLowerCase() === ((_a = this.background) === null || _a === void 0 ? void 0 : _a.filename); })) !== null && _b !== void 0 ? _b : false);
|
|
1954
1827
|
}
|
|
1955
1828
|
}
|
|
1956
1829
|
|
|
@@ -1958,10 +1831,6 @@ class BeatmapEvents {
|
|
|
1958
1831
|
* Represents a control point in a beatmap.
|
|
1959
1832
|
*/
|
|
1960
1833
|
class ControlPoint {
|
|
1961
|
-
/**
|
|
1962
|
-
* The time at which the control point takes effect in milliseconds.
|
|
1963
|
-
*/
|
|
1964
|
-
time;
|
|
1965
1834
|
constructor(values) {
|
|
1966
1835
|
this.time = values.time;
|
|
1967
1836
|
}
|
|
@@ -1971,14 +1840,6 @@ class ControlPoint {
|
|
|
1971
1840
|
* Represents a control point that changes the beatmap's BPM.
|
|
1972
1841
|
*/
|
|
1973
1842
|
class TimingControlPoint extends ControlPoint {
|
|
1974
|
-
/**
|
|
1975
|
-
* The amount of milliseconds passed for each beat.
|
|
1976
|
-
*/
|
|
1977
|
-
msPerBeat;
|
|
1978
|
-
/**
|
|
1979
|
-
* The amount of beats in a measure.
|
|
1980
|
-
*/
|
|
1981
|
-
timeSignature;
|
|
1982
1843
|
constructor(values) {
|
|
1983
1844
|
super(values);
|
|
1984
1845
|
this.msPerBeat = values.msPerBeat;
|
|
@@ -2005,7 +1866,9 @@ class TimingControlPoint extends ControlPoint {
|
|
|
2005
1866
|
* A manager for a control point.
|
|
2006
1867
|
*/
|
|
2007
1868
|
class ControlPointManager {
|
|
2008
|
-
|
|
1869
|
+
constructor() {
|
|
1870
|
+
this._points = [];
|
|
1871
|
+
}
|
|
2009
1872
|
/**
|
|
2010
1873
|
* The control points in this manager.
|
|
2011
1874
|
*/
|
|
@@ -2086,7 +1949,8 @@ class ControlPointManager {
|
|
|
2086
1949
|
* @returns The active control point at the given time, or the default control point if none found.
|
|
2087
1950
|
*/
|
|
2088
1951
|
binarySearchWithFallback(time, fallback = this.defaultControlPoint) {
|
|
2089
|
-
|
|
1952
|
+
var _a;
|
|
1953
|
+
return (_a = this.binarySearch(time)) !== null && _a !== void 0 ? _a : fallback;
|
|
2090
1954
|
}
|
|
2091
1955
|
/**
|
|
2092
1956
|
* Binary searches one of the control point lists to find the active control point at the given time.
|
|
@@ -2152,13 +2016,17 @@ class ControlPointManager {
|
|
|
2152
2016
|
* A manager for timing control points.
|
|
2153
2017
|
*/
|
|
2154
2018
|
class TimingControlPointManager extends ControlPointManager {
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2019
|
+
constructor() {
|
|
2020
|
+
super(...arguments);
|
|
2021
|
+
this.defaultControlPoint = new TimingControlPoint({
|
|
2022
|
+
time: 0,
|
|
2023
|
+
msPerBeat: 1000,
|
|
2024
|
+
timeSignature: 4,
|
|
2025
|
+
});
|
|
2026
|
+
}
|
|
2160
2027
|
controlPointAt(time) {
|
|
2161
|
-
|
|
2028
|
+
var _a;
|
|
2029
|
+
return this.binarySearchWithFallback(time, (_a = this.points[0]) !== null && _a !== void 0 ? _a : this.defaultControlPoint);
|
|
2162
2030
|
}
|
|
2163
2031
|
}
|
|
2164
2032
|
|
|
@@ -2166,16 +2034,6 @@ class TimingControlPointManager extends ControlPointManager {
|
|
|
2166
2034
|
* Represents a control point that changes speed multiplier.
|
|
2167
2035
|
*/
|
|
2168
2036
|
class DifficultyControlPoint extends ControlPoint {
|
|
2169
|
-
/**
|
|
2170
|
-
* The slider speed multiplier of the control point.
|
|
2171
|
-
*/
|
|
2172
|
-
speedMultiplier;
|
|
2173
|
-
/**
|
|
2174
|
-
* Whether or not slider ticks should be generated at this control point.
|
|
2175
|
-
*
|
|
2176
|
-
* This exists for backwards compatibility with maps that abuse NaN slider velocity behavior on osu!stable (e.g. /b/2628991).
|
|
2177
|
-
*/
|
|
2178
|
-
generateTicks;
|
|
2179
2037
|
constructor(values) {
|
|
2180
2038
|
super(values);
|
|
2181
2039
|
this.speedMultiplier = values.speedMultiplier;
|
|
@@ -2201,11 +2059,14 @@ class DifficultyControlPoint extends ControlPoint {
|
|
|
2201
2059
|
* A manager for difficulty control points.
|
|
2202
2060
|
*/
|
|
2203
2061
|
class DifficultyControlPointManager extends ControlPointManager {
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2062
|
+
constructor() {
|
|
2063
|
+
super(...arguments);
|
|
2064
|
+
this.defaultControlPoint = new DifficultyControlPoint({
|
|
2065
|
+
time: 0,
|
|
2066
|
+
speedMultiplier: 1,
|
|
2067
|
+
generateTicks: true,
|
|
2068
|
+
});
|
|
2069
|
+
}
|
|
2209
2070
|
controlPointAt(time) {
|
|
2210
2071
|
return this.binarySearchWithFallback(time);
|
|
2211
2072
|
}
|
|
@@ -2215,14 +2076,6 @@ class DifficultyControlPointManager extends ControlPointManager {
|
|
|
2215
2076
|
* Represents a control point that applies an effect to a beatmap.
|
|
2216
2077
|
*/
|
|
2217
2078
|
class EffectControlPoint extends ControlPoint {
|
|
2218
|
-
/**
|
|
2219
|
-
* Whether or not kiai time is enabled at this control point.
|
|
2220
|
-
*/
|
|
2221
|
-
isKiai;
|
|
2222
|
-
/**
|
|
2223
|
-
* Whether the first bar line of this control point is ignored.
|
|
2224
|
-
*/
|
|
2225
|
-
omitFirstBarLine;
|
|
2226
2079
|
constructor(values) {
|
|
2227
2080
|
super(values);
|
|
2228
2081
|
this.isKiai = values.isKiai;
|
|
@@ -2240,11 +2093,14 @@ class EffectControlPoint extends ControlPoint {
|
|
|
2240
2093
|
* A manager for effect control points.
|
|
2241
2094
|
*/
|
|
2242
2095
|
class EffectControlPointManager extends ControlPointManager {
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2096
|
+
constructor() {
|
|
2097
|
+
super(...arguments);
|
|
2098
|
+
this.defaultControlPoint = new EffectControlPoint({
|
|
2099
|
+
time: 0,
|
|
2100
|
+
isKiai: false,
|
|
2101
|
+
omitFirstBarLine: false,
|
|
2102
|
+
});
|
|
2103
|
+
}
|
|
2248
2104
|
controlPointAt(time) {
|
|
2249
2105
|
return this.binarySearchWithFallback(time);
|
|
2250
2106
|
}
|
|
@@ -2254,10 +2110,6 @@ class EffectControlPointManager extends ControlPointManager {
|
|
|
2254
2110
|
* Represents a custom gameplay hit sample that can be loaded from files.
|
|
2255
2111
|
*/
|
|
2256
2112
|
class FileHitSampleInfo extends HitSampleInfo {
|
|
2257
|
-
/**
|
|
2258
|
-
* The name of the file to load the sample from.
|
|
2259
|
-
*/
|
|
2260
|
-
filename;
|
|
2261
2113
|
constructor(filename, volume = 0) {
|
|
2262
2114
|
super(volume);
|
|
2263
2115
|
this.filename = filename;
|
|
@@ -2268,20 +2120,6 @@ class FileHitSampleInfo extends HitSampleInfo {
|
|
|
2268
2120
|
* Represents a control point that handles sample sounds.
|
|
2269
2121
|
*/
|
|
2270
2122
|
class SampleControlPoint extends ControlPoint {
|
|
2271
|
-
/**
|
|
2272
|
-
* The sample bank at this control point.
|
|
2273
|
-
*/
|
|
2274
|
-
sampleBank;
|
|
2275
|
-
/**
|
|
2276
|
-
* The sample volume at this control point.
|
|
2277
|
-
*/
|
|
2278
|
-
sampleVolume;
|
|
2279
|
-
/**
|
|
2280
|
-
* The index of the sample bank, if this sample bank uses custom samples.
|
|
2281
|
-
*
|
|
2282
|
-
* If this is 0, the beatmap's sample should be used instead.
|
|
2283
|
-
*/
|
|
2284
|
-
customSampleBank;
|
|
2285
2123
|
constructor(values) {
|
|
2286
2124
|
super(values);
|
|
2287
2125
|
this.sampleBank = values.sampleBank;
|
|
@@ -2333,12 +2171,15 @@ class SampleControlPoint extends ControlPoint {
|
|
|
2333
2171
|
* A manager for sample control points.
|
|
2334
2172
|
*/
|
|
2335
2173
|
class SampleControlPointManager extends ControlPointManager {
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2174
|
+
constructor() {
|
|
2175
|
+
super(...arguments);
|
|
2176
|
+
this.defaultControlPoint = new SampleControlPoint({
|
|
2177
|
+
time: 0,
|
|
2178
|
+
sampleBank: exports.SampleBank.normal,
|
|
2179
|
+
sampleVolume: 100,
|
|
2180
|
+
customSampleBank: 0,
|
|
2181
|
+
});
|
|
2182
|
+
}
|
|
2342
2183
|
controlPointAt(time) {
|
|
2343
2184
|
return this.binarySearchWithFallback(time);
|
|
2344
2185
|
}
|
|
@@ -2348,22 +2189,24 @@ class SampleControlPointManager extends ControlPointManager {
|
|
|
2348
2189
|
* Contains information about timing (control) points of a beatmap.
|
|
2349
2190
|
*/
|
|
2350
2191
|
class BeatmapControlPoints {
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2192
|
+
constructor() {
|
|
2193
|
+
/**
|
|
2194
|
+
* The manager for timing control points of the beatmap.
|
|
2195
|
+
*/
|
|
2196
|
+
this.timing = new TimingControlPointManager();
|
|
2197
|
+
/**
|
|
2198
|
+
* The manager for difficulty control points of the beatmap.
|
|
2199
|
+
*/
|
|
2200
|
+
this.difficulty = new DifficultyControlPointManager();
|
|
2201
|
+
/**
|
|
2202
|
+
* The manager for effect control points of the beatmap.
|
|
2203
|
+
*/
|
|
2204
|
+
this.effect = new EffectControlPointManager();
|
|
2205
|
+
/**
|
|
2206
|
+
* The manager for sample control points of the beatmap.
|
|
2207
|
+
*/
|
|
2208
|
+
this.sample = new SampleControlPointManager();
|
|
2209
|
+
}
|
|
2367
2210
|
/**
|
|
2368
2211
|
* Clears all control points in the beatmap.
|
|
2369
2212
|
*/
|
|
@@ -2379,18 +2222,12 @@ class BeatmapControlPoints {
|
|
|
2379
2222
|
* Contains information about combo and skin colors of a beatmap.
|
|
2380
2223
|
*/
|
|
2381
2224
|
class BeatmapColor {
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
*/
|
|
2389
|
-
sliderTrackOverride;
|
|
2390
|
-
/**
|
|
2391
|
-
* The color of slider borders.
|
|
2392
|
-
*/
|
|
2393
|
-
sliderBorder;
|
|
2225
|
+
constructor() {
|
|
2226
|
+
/**
|
|
2227
|
+
* The combo colors of the beatmap.
|
|
2228
|
+
*/
|
|
2229
|
+
this.combo = [];
|
|
2230
|
+
}
|
|
2394
2231
|
}
|
|
2395
2232
|
|
|
2396
2233
|
/**
|
|
@@ -2417,10 +2254,7 @@ class Circle extends HitObject {
|
|
|
2417
2254
|
*/
|
|
2418
2255
|
class Spinner extends HitObject {
|
|
2419
2256
|
constructor(values) {
|
|
2420
|
-
super({
|
|
2421
|
-
...values,
|
|
2422
|
-
position: new Vector2(256, 192),
|
|
2423
|
-
});
|
|
2257
|
+
super(Object.assign(Object.assign({}, values), { position: new Vector2(256, 192) }));
|
|
2424
2258
|
const bankSample = this.samples.find((v) => v instanceof BankHitSampleInfo);
|
|
2425
2259
|
if (bankSample) {
|
|
2426
2260
|
this.auxiliarySamples.push(new BankHitSampleInfo("spinnerspin", bankSample.bank, bankSample.customSampleBank, bankSample.volume, bankSample.isLayered));
|
|
@@ -2442,28 +2276,30 @@ class Spinner extends HitObject {
|
|
|
2442
2276
|
* Contains information about hit objects of a beatmap.
|
|
2443
2277
|
*/
|
|
2444
2278
|
class BeatmapHitObjects {
|
|
2445
|
-
|
|
2279
|
+
constructor() {
|
|
2280
|
+
this._objects = [];
|
|
2281
|
+
this._circles = 0;
|
|
2282
|
+
this._sliders = 0;
|
|
2283
|
+
this._spinners = 0;
|
|
2284
|
+
}
|
|
2446
2285
|
/**
|
|
2447
2286
|
* The objects of the beatmap.
|
|
2448
2287
|
*/
|
|
2449
2288
|
get objects() {
|
|
2450
2289
|
return this._objects;
|
|
2451
2290
|
}
|
|
2452
|
-
_circles = 0;
|
|
2453
2291
|
/**
|
|
2454
2292
|
* The amount of circles in the beatmap.
|
|
2455
2293
|
*/
|
|
2456
2294
|
get circles() {
|
|
2457
2295
|
return this._circles;
|
|
2458
2296
|
}
|
|
2459
|
-
_sliders = 0;
|
|
2460
2297
|
/**
|
|
2461
2298
|
* The amount of sliders in the beatmap.
|
|
2462
2299
|
*/
|
|
2463
2300
|
get sliders() {
|
|
2464
2301
|
return this._sliders;
|
|
2465
2302
|
}
|
|
2466
|
-
_spinners = 0;
|
|
2467
2303
|
/**
|
|
2468
2304
|
* The amount of spinners in the beatmap.
|
|
2469
2305
|
*/
|
|
@@ -2523,7 +2359,8 @@ class BeatmapHitObjects {
|
|
|
2523
2359
|
* @returns The hitobject that was removed, `null` if no hitobject was removed.
|
|
2524
2360
|
*/
|
|
2525
2361
|
removeAt(index) {
|
|
2526
|
-
|
|
2362
|
+
var _a;
|
|
2363
|
+
const object = (_a = this._objects.splice(index, 1)[0]) !== null && _a !== void 0 ? _a : null;
|
|
2527
2364
|
if (object instanceof Circle) {
|
|
2528
2365
|
--this._circles;
|
|
2529
2366
|
}
|
|
@@ -2579,42 +2416,6 @@ class BeatmapHitObjects {
|
|
|
2579
2416
|
* Represents a beatmap with advanced information.
|
|
2580
2417
|
*/
|
|
2581
2418
|
class Beatmap {
|
|
2582
|
-
/**
|
|
2583
|
-
* The format version of the beatmap.
|
|
2584
|
-
*/
|
|
2585
|
-
formatVersion;
|
|
2586
|
-
/**
|
|
2587
|
-
* General information about the beatmap.
|
|
2588
|
-
*/
|
|
2589
|
-
general;
|
|
2590
|
-
/**
|
|
2591
|
-
* Saved settings for the beatmap editor.
|
|
2592
|
-
*/
|
|
2593
|
-
editor;
|
|
2594
|
-
/**
|
|
2595
|
-
* Information used to identify the beatmap.
|
|
2596
|
-
*/
|
|
2597
|
-
metadata;
|
|
2598
|
-
/**
|
|
2599
|
-
* Difficulty settings of the beatmap.
|
|
2600
|
-
*/
|
|
2601
|
-
difficulty;
|
|
2602
|
-
/**
|
|
2603
|
-
* Events of the beatmap.
|
|
2604
|
-
*/
|
|
2605
|
-
events;
|
|
2606
|
-
/**
|
|
2607
|
-
* Timing and control points of the beatmap.
|
|
2608
|
-
*/
|
|
2609
|
-
controlPoints;
|
|
2610
|
-
/**
|
|
2611
|
-
* Combo and skin colors of the beatmap.
|
|
2612
|
-
*/
|
|
2613
|
-
colors;
|
|
2614
|
-
/**
|
|
2615
|
-
* The objects of the beatmap.
|
|
2616
|
-
*/
|
|
2617
|
-
hitObjects;
|
|
2618
2419
|
constructor(shallowCopy) {
|
|
2619
2420
|
if (shallowCopy) {
|
|
2620
2421
|
this.formatVersion = shallowCopy.formatVersion;
|
|
@@ -2653,12 +2454,10 @@ class Beatmap {
|
|
|
2653
2454
|
* The most common beat length of the beatmap.
|
|
2654
2455
|
*/
|
|
2655
2456
|
get mostCommonBeatLength() {
|
|
2457
|
+
var _a, _b, _c, _d, _e;
|
|
2656
2458
|
// The last playable time in the beatmap - the last timing point extends to this time.
|
|
2657
2459
|
// Note: This is more accurate and may present different results because osu-stable didn't have the ability to calculate slider durations in this context.
|
|
2658
|
-
const lastTime = this.hitObjects.objects[this.hitObjects.objects.length - 1]
|
|
2659
|
-
?.endTime ??
|
|
2660
|
-
this.controlPoints.timing.points[this.controlPoints.timing.points.length - 1]?.time ??
|
|
2661
|
-
0;
|
|
2460
|
+
const lastTime = (_d = (_b = (_a = this.hitObjects.objects[this.hitObjects.objects.length - 1]) === null || _a === void 0 ? void 0 : _a.endTime) !== null && _b !== void 0 ? _b : (_c = this.controlPoints.timing.points[this.controlPoints.timing.points.length - 1]) === null || _c === void 0 ? void 0 : _c.time) !== null && _d !== void 0 ? _d : 0;
|
|
2662
2461
|
const mostCommon =
|
|
2663
2462
|
// Construct a set of {beatLength, duration} objects for each individual timing point.
|
|
2664
2463
|
this.controlPoints.timing.points
|
|
@@ -2676,7 +2475,7 @@ class Beatmap {
|
|
|
2676
2475
|
})
|
|
2677
2476
|
// Get the most common one, or 0 as a suitable default.
|
|
2678
2477
|
.sort((a, b) => b.duration - a.duration)[0];
|
|
2679
|
-
return mostCommon
|
|
2478
|
+
return (_e = mostCommon === null || mostCommon === void 0 ? void 0 : mostCommon.beatLength) !== null && _e !== void 0 ? _e : 0;
|
|
2680
2479
|
}
|
|
2681
2480
|
/**
|
|
2682
2481
|
* Returns a time combined with beatmap-wide time offset.
|
|
@@ -2841,17 +2640,6 @@ class Beatmap {
|
|
|
2841
2640
|
* Represents a beatmap's background.
|
|
2842
2641
|
*/
|
|
2843
2642
|
class BeatmapBackground {
|
|
2844
|
-
/**
|
|
2845
|
-
* The location of the background image relative to the beatmap directory.
|
|
2846
|
-
*/
|
|
2847
|
-
filename;
|
|
2848
|
-
/**
|
|
2849
|
-
* Offset in osu! pixels from the centre of the screen.
|
|
2850
|
-
*
|
|
2851
|
-
* For example, an offset of `50,100` would have the background shown 50 osu!
|
|
2852
|
-
* pixels to the right and 100 osu! pixels down from the centre of the screen.
|
|
2853
|
-
*/
|
|
2854
|
-
offset;
|
|
2855
2643
|
constructor(filename, offset) {
|
|
2856
2644
|
this.filename = filename;
|
|
2857
2645
|
this.offset = offset;
|
|
@@ -2862,11 +2650,6 @@ class BeatmapBackground {
|
|
|
2862
2650
|
* Provides functionality to alter a beatmap after it has been converted.
|
|
2863
2651
|
*/
|
|
2864
2652
|
class BeatmapProcessor {
|
|
2865
|
-
static stackDistance = 3;
|
|
2866
|
-
/**
|
|
2867
|
-
* The beatmap to process. This should already be converted to the applicable mode.
|
|
2868
|
-
*/
|
|
2869
|
-
beatmap;
|
|
2870
2653
|
constructor(beatmap) {
|
|
2871
2654
|
this.beatmap = beatmap;
|
|
2872
2655
|
}
|
|
@@ -3088,12 +2871,12 @@ class BeatmapProcessor {
|
|
|
3088
2871
|
}
|
|
3089
2872
|
}
|
|
3090
2873
|
}
|
|
2874
|
+
BeatmapProcessor.stackDistance = 3;
|
|
3091
2875
|
|
|
3092
2876
|
/**
|
|
3093
2877
|
* Converts a beatmap for another mode.
|
|
3094
2878
|
*/
|
|
3095
2879
|
class BeatmapConverter {
|
|
3096
|
-
beatmap;
|
|
3097
2880
|
constructor(beatmap) {
|
|
3098
2881
|
this.beatmap = beatmap;
|
|
3099
2882
|
}
|
|
@@ -3104,9 +2887,10 @@ class BeatmapConverter {
|
|
|
3104
2887
|
* @returns The converted beatmap.
|
|
3105
2888
|
*/
|
|
3106
2889
|
convert(options) {
|
|
3107
|
-
|
|
3108
|
-
const
|
|
3109
|
-
const
|
|
2890
|
+
var _a, _b, _c;
|
|
2891
|
+
const mods = (_a = options === null || options === void 0 ? void 0 : options.mods) !== null && _a !== void 0 ? _a : [];
|
|
2892
|
+
const mode = (_b = options === null || options === void 0 ? void 0 : options.mode) !== null && _b !== void 0 ? _b : exports.Modes.osu;
|
|
2893
|
+
const customSpeedMultiplier = (_c = options === null || options === void 0 ? void 0 : options.customSpeedMultiplier) !== null && _c !== void 0 ? _c : 1;
|
|
3110
2894
|
// Convert
|
|
3111
2895
|
const converted = new Beatmap(this.beatmap);
|
|
3112
2896
|
// Shallow clone isn't enough to ensure we don't mutate some beatmap properties unexpectedly.
|
|
@@ -3120,7 +2904,7 @@ class BeatmapConverter {
|
|
|
3120
2904
|
});
|
|
3121
2905
|
// Special handling for difficulty adjust mod where difficulty statistics are forced.
|
|
3122
2906
|
const difficultyAdjustMod = mods.find((m) => m instanceof ModDifficultyAdjust);
|
|
3123
|
-
difficultyAdjustMod
|
|
2907
|
+
difficultyAdjustMod === null || difficultyAdjustMod === void 0 ? void 0 : difficultyAdjustMod.applyToDifficulty(mode, converted.difficulty);
|
|
3124
2908
|
mods.forEach((mod) => {
|
|
3125
2909
|
if (mod.isApplicableToDifficultyWithSettings()) {
|
|
3126
2910
|
mod.applyToDifficultyWithSettings(mode, converted.difficulty, mods, customSpeedMultiplier);
|
|
@@ -3237,7 +3021,6 @@ exports.PathType = void 0;
|
|
|
3237
3021
|
* Precision utilities.
|
|
3238
3022
|
*/
|
|
3239
3023
|
class Precision {
|
|
3240
|
-
static FLOAT_EPSILON = 1e-3;
|
|
3241
3024
|
/**
|
|
3242
3025
|
* Checks if two numbers are equal with a given tolerance.
|
|
3243
3026
|
*
|
|
@@ -3303,6 +3086,7 @@ class Precision {
|
|
|
3303
3086
|
return (Math.abs(diff) < maximumError * Math.max(Math.abs(a), Math.abs(b)));
|
|
3304
3087
|
}
|
|
3305
3088
|
}
|
|
3089
|
+
Precision.FLOAT_EPSILON = 1e-3;
|
|
3306
3090
|
|
|
3307
3091
|
/**
|
|
3308
3092
|
* Some utilities, no biggie.
|
|
@@ -3354,12 +3138,6 @@ class Utils {
|
|
|
3354
3138
|
* Path approximator for sliders.
|
|
3355
3139
|
*/
|
|
3356
3140
|
class PathApproximator {
|
|
3357
|
-
static bezierTolerance = 0.25;
|
|
3358
|
-
/**
|
|
3359
|
-
* The amount of pieces to calculate for each control point quadruplet.
|
|
3360
|
-
*/
|
|
3361
|
-
static catmullDetail = 50;
|
|
3362
|
-
static circularArcTolerance = 0.1;
|
|
3363
3141
|
/**
|
|
3364
3142
|
* Approximates a bezier slider's path.
|
|
3365
3143
|
*
|
|
@@ -3611,36 +3389,30 @@ class PathApproximator {
|
|
|
3611
3389
|
(-vec1.y + 3 * vec2.y - 3 * vec3.y + vec4.y) * t3));
|
|
3612
3390
|
}
|
|
3613
3391
|
}
|
|
3392
|
+
PathApproximator.bezierTolerance = 0.25;
|
|
3393
|
+
/**
|
|
3394
|
+
* The amount of pieces to calculate for each control point quadruplet.
|
|
3395
|
+
*/
|
|
3396
|
+
PathApproximator.catmullDetail = 50;
|
|
3397
|
+
PathApproximator.circularArcTolerance = 0.1;
|
|
3614
3398
|
|
|
3615
3399
|
/**
|
|
3616
3400
|
* Represents a slider's path.
|
|
3617
3401
|
*/
|
|
3618
3402
|
class SliderPath {
|
|
3619
|
-
/**
|
|
3620
|
-
* The path type of the slider.
|
|
3621
|
-
*/
|
|
3622
|
-
pathType;
|
|
3623
|
-
/**
|
|
3624
|
-
* The control points (anchor points) of the slider.
|
|
3625
|
-
*/
|
|
3626
|
-
controlPoints;
|
|
3627
|
-
/**
|
|
3628
|
-
* Distance that is expected when calculating slider path.
|
|
3629
|
-
*/
|
|
3630
|
-
expectedDistance;
|
|
3631
|
-
/**
|
|
3632
|
-
* Whether or not the instance has been initialized.
|
|
3633
|
-
*/
|
|
3634
|
-
isInitialized = false;
|
|
3635
|
-
/**
|
|
3636
|
-
* The calculated path of the slider.
|
|
3637
|
-
*/
|
|
3638
|
-
calculatedPath = [];
|
|
3639
|
-
/**
|
|
3640
|
-
* The cumulative length of the slider.
|
|
3641
|
-
*/
|
|
3642
|
-
cumulativeLength = [];
|
|
3643
3403
|
constructor(values) {
|
|
3404
|
+
/**
|
|
3405
|
+
* Whether or not the instance has been initialized.
|
|
3406
|
+
*/
|
|
3407
|
+
this.isInitialized = false;
|
|
3408
|
+
/**
|
|
3409
|
+
* The calculated path of the slider.
|
|
3410
|
+
*/
|
|
3411
|
+
this.calculatedPath = [];
|
|
3412
|
+
/**
|
|
3413
|
+
* The cumulative length of the slider.
|
|
3414
|
+
*/
|
|
3415
|
+
this.cumulativeLength = [];
|
|
3644
3416
|
this.pathType = values.pathType;
|
|
3645
3417
|
this.controlPoints = values.controlPoints;
|
|
3646
3418
|
this.expectedDistance = values.expectedDistance;
|
|
@@ -3826,36 +3598,13 @@ class SliderPath {
|
|
|
3826
3598
|
* Represents an information about a hitobject-specific sample bank.
|
|
3827
3599
|
*/
|
|
3828
3600
|
class SampleBankInfo {
|
|
3829
|
-
/**
|
|
3830
|
-
* The name of the sample bank file, if this sample bank uses custom samples.
|
|
3831
|
-
*/
|
|
3832
|
-
filename;
|
|
3833
|
-
/**
|
|
3834
|
-
* The main sample bank.
|
|
3835
|
-
*/
|
|
3836
|
-
normal;
|
|
3837
|
-
/**
|
|
3838
|
-
* The addition sample bank.
|
|
3839
|
-
*/
|
|
3840
|
-
add;
|
|
3841
|
-
/**
|
|
3842
|
-
* The volume at which the sample bank is played.
|
|
3843
|
-
*
|
|
3844
|
-
* If this is 0, the control point's volume should be used instead.
|
|
3845
|
-
*/
|
|
3846
|
-
volume;
|
|
3847
|
-
/**
|
|
3848
|
-
* The index of the sample bank, if this sample bank uses custom samples.
|
|
3849
|
-
*
|
|
3850
|
-
* If this is 0, the control point's sample index should be used instead.
|
|
3851
|
-
*/
|
|
3852
|
-
customSampleBank;
|
|
3853
3601
|
constructor(bankInfo) {
|
|
3854
|
-
|
|
3855
|
-
this.
|
|
3856
|
-
this.
|
|
3857
|
-
this.
|
|
3858
|
-
this.
|
|
3602
|
+
var _a, _b, _c, _d, _e;
|
|
3603
|
+
this.filename = (_a = bankInfo === null || bankInfo === void 0 ? void 0 : bankInfo.filename) !== null && _a !== void 0 ? _a : "";
|
|
3604
|
+
this.normal = (_b = bankInfo === null || bankInfo === void 0 ? void 0 : bankInfo.normal) !== null && _b !== void 0 ? _b : exports.SampleBank.none;
|
|
3605
|
+
this.add = (_c = bankInfo === null || bankInfo === void 0 ? void 0 : bankInfo.add) !== null && _c !== void 0 ? _c : exports.SampleBank.none;
|
|
3606
|
+
this.volume = (_d = bankInfo === null || bankInfo === void 0 ? void 0 : bankInfo.volume) !== null && _d !== void 0 ? _d : 0;
|
|
3607
|
+
this.customSampleBank = (_e = bankInfo === null || bankInfo === void 0 ? void 0 : bankInfo.customSampleBank) !== null && _e !== void 0 ? _e : 0;
|
|
3859
3608
|
}
|
|
3860
3609
|
}
|
|
3861
3610
|
|
|
@@ -3879,29 +3628,30 @@ var BeatmapSection;
|
|
|
3879
3628
|
* The base of main decoders.
|
|
3880
3629
|
*/
|
|
3881
3630
|
class Decoder {
|
|
3631
|
+
constructor() {
|
|
3632
|
+
/**
|
|
3633
|
+
* The format version of the decoded target.
|
|
3634
|
+
*/
|
|
3635
|
+
this.formatVersion = Decoder.latestVersion;
|
|
3636
|
+
/**
|
|
3637
|
+
* The amount of lines of the file that have been processed up to this point.
|
|
3638
|
+
*/
|
|
3639
|
+
this.line = 0;
|
|
3640
|
+
/**
|
|
3641
|
+
* The currently processed line.
|
|
3642
|
+
*/
|
|
3643
|
+
this.currentLine = "";
|
|
3644
|
+
/**
|
|
3645
|
+
* The currently processed section.
|
|
3646
|
+
*/
|
|
3647
|
+
this.section = BeatmapSection.general;
|
|
3648
|
+
}
|
|
3882
3649
|
/**
|
|
3883
3650
|
* The result of the decoding process.
|
|
3884
3651
|
*/
|
|
3885
3652
|
get result() {
|
|
3886
3653
|
return this.finalResult;
|
|
3887
3654
|
}
|
|
3888
|
-
static latestVersion = 14;
|
|
3889
|
-
/**
|
|
3890
|
-
* The format version of the decoded target.
|
|
3891
|
-
*/
|
|
3892
|
-
formatVersion = Decoder.latestVersion;
|
|
3893
|
-
/**
|
|
3894
|
-
* The amount of lines of the file that have been processed up to this point.
|
|
3895
|
-
*/
|
|
3896
|
-
line = 0;
|
|
3897
|
-
/**
|
|
3898
|
-
* The currently processed line.
|
|
3899
|
-
*/
|
|
3900
|
-
currentLine = "";
|
|
3901
|
-
/**
|
|
3902
|
-
* The currently processed section.
|
|
3903
|
-
*/
|
|
3904
|
-
section = BeatmapSection.general;
|
|
3905
3655
|
/**
|
|
3906
3656
|
* Performs the decoding process.
|
|
3907
3657
|
*
|
|
@@ -3909,6 +3659,7 @@ class Decoder {
|
|
|
3909
3659
|
* @returns The current decoder instance.
|
|
3910
3660
|
*/
|
|
3911
3661
|
decode(str) {
|
|
3662
|
+
var _a;
|
|
3912
3663
|
this.reset();
|
|
3913
3664
|
for (let line of str.split("\n")) {
|
|
3914
3665
|
this.currentLine = line;
|
|
@@ -3948,7 +3699,7 @@ class Decoder {
|
|
|
3948
3699
|
}
|
|
3949
3700
|
catch (e) {
|
|
3950
3701
|
console.warn(e.message);
|
|
3951
|
-
console.log(`at line ${this.line}\n${this.currentLine}\n${this.decoders[this.section]
|
|
3702
|
+
console.log(`at line ${this.line}\n${this.currentLine}\n${(_a = this.decoders[this.section]) === null || _a === void 0 ? void 0 : _a.logExceptionPosition()}`);
|
|
3952
3703
|
}
|
|
3953
3704
|
}
|
|
3954
3705
|
return this;
|
|
@@ -3968,7 +3719,8 @@ class Decoder {
|
|
|
3968
3719
|
* @param line The line to decode.
|
|
3969
3720
|
*/
|
|
3970
3721
|
decodeLine(line) {
|
|
3971
|
-
|
|
3722
|
+
var _a;
|
|
3723
|
+
(_a = this.decoders[this.section]) === null || _a === void 0 ? void 0 : _a.decode(line);
|
|
3972
3724
|
}
|
|
3973
3725
|
/**
|
|
3974
3726
|
* Resets this decoder's instance.
|
|
@@ -3979,21 +3731,17 @@ class Decoder {
|
|
|
3979
3731
|
this.section = BeatmapSection.general;
|
|
3980
3732
|
}
|
|
3981
3733
|
}
|
|
3734
|
+
Decoder.latestVersion = 14;
|
|
3982
3735
|
|
|
3983
3736
|
/**
|
|
3984
3737
|
* The base of all decoders.
|
|
3985
3738
|
*/
|
|
3986
3739
|
class SectionDecoder {
|
|
3987
|
-
/**
|
|
3988
|
-
* The string in the line at which the decoder is processing.
|
|
3989
|
-
*/
|
|
3990
|
-
lastPosition = "";
|
|
3991
|
-
/**
|
|
3992
|
-
* The target of the decoding process.
|
|
3993
|
-
*/
|
|
3994
|
-
target;
|
|
3995
|
-
formatVersion;
|
|
3996
3740
|
constructor(target, formatVersion = Decoder.latestVersion) {
|
|
3741
|
+
/**
|
|
3742
|
+
* The string in the line at which the decoder is processing.
|
|
3743
|
+
*/
|
|
3744
|
+
this.lastPosition = "";
|
|
3997
3745
|
this.target = target;
|
|
3998
3746
|
this.formatVersion = formatVersion;
|
|
3999
3747
|
}
|
|
@@ -4097,8 +3845,11 @@ class SectionDecoder {
|
|
|
4097
3845
|
* A decoder for decoding a beatmap's hitobjects section.
|
|
4098
3846
|
*/
|
|
4099
3847
|
class BeatmapHitObjectsDecoder extends SectionDecoder {
|
|
4100
|
-
|
|
4101
|
-
|
|
3848
|
+
constructor() {
|
|
3849
|
+
super(...arguments);
|
|
3850
|
+
this.extraComboOffset = 0;
|
|
3851
|
+
this.forceNewCombo = false;
|
|
3852
|
+
}
|
|
4102
3853
|
decodeInternal(line) {
|
|
4103
3854
|
const s = line.split(",");
|
|
4104
3855
|
if (s.length < 4) {
|
|
@@ -4116,7 +3867,7 @@ class BeatmapHitObjectsDecoder extends SectionDecoder {
|
|
|
4116
3867
|
const bankInfo = new SampleBankInfo();
|
|
4117
3868
|
let object = null;
|
|
4118
3869
|
if (type & exports.ObjectTypes.circle) {
|
|
4119
|
-
newCombo
|
|
3870
|
+
newCombo || (newCombo = this.forceNewCombo);
|
|
4120
3871
|
comboOffset += this.extraComboOffset;
|
|
4121
3872
|
this.forceNewCombo = false;
|
|
4122
3873
|
this.extraComboOffset = 0;
|
|
@@ -4206,7 +3957,7 @@ class BeatmapHitObjectsDecoder extends SectionDecoder {
|
|
|
4206
3957
|
for (let i = 0; i < nodes; ++i) {
|
|
4207
3958
|
nodeSamples.push(this.convertSoundType(nodeSoundTypes[i], nodeBankInfos[i]));
|
|
4208
3959
|
}
|
|
4209
|
-
newCombo
|
|
3960
|
+
newCombo || (newCombo = this.forceNewCombo);
|
|
4210
3961
|
comboOffset += this.extraComboOffset;
|
|
4211
3962
|
this.forceNewCombo = false;
|
|
4212
3963
|
this.extraComboOffset = 0;
|
|
@@ -4242,7 +3993,7 @@ class BeatmapHitObjectsDecoder extends SectionDecoder {
|
|
|
4242
3993
|
else if (type & exports.ObjectTypes.spinner) {
|
|
4243
3994
|
// Spinners don't create the new combo themselves, but force the next non-spinner hitobject to create a new combo.
|
|
4244
3995
|
// Their combo offset is still added to that next hitobject's combo index.
|
|
4245
|
-
this.forceNewCombo
|
|
3996
|
+
this.forceNewCombo || (this.forceNewCombo = this.target.formatVersion <= 8 || newCombo);
|
|
4246
3997
|
this.extraComboOffset += comboOffset;
|
|
4247
3998
|
object = new Spinner({
|
|
4248
3999
|
startTime: time,
|
|
@@ -4323,6 +4074,7 @@ class BeatmapHitObjectsDecoder extends SectionDecoder {
|
|
|
4323
4074
|
*/
|
|
4324
4075
|
class BeatmapGeneralDecoder extends SectionDecoder {
|
|
4325
4076
|
decodeInternal(line) {
|
|
4077
|
+
var _a;
|
|
4326
4078
|
const p = this.property(line);
|
|
4327
4079
|
switch (p[0]) {
|
|
4328
4080
|
case "AudioFilename":
|
|
@@ -4369,7 +4121,7 @@ class BeatmapGeneralDecoder extends SectionDecoder {
|
|
|
4369
4121
|
this.target.general.overlayPosition = (p[1]);
|
|
4370
4122
|
break;
|
|
4371
4123
|
case "SkinPreference":
|
|
4372
|
-
this.target.general.skinPreference = p[1]
|
|
4124
|
+
this.target.general.skinPreference = (_a = p[1]) !== null && _a !== void 0 ? _a : "";
|
|
4373
4125
|
break;
|
|
4374
4126
|
case "EpilepsyWarning":
|
|
4375
4127
|
this.target.general.epilepsyWarning = !!this.tryParseInt(p[1]);
|
|
@@ -4425,21 +4177,6 @@ class BeatmapEditorDecoder extends SectionDecoder {
|
|
|
4425
4177
|
* Represents a beatmap's video.
|
|
4426
4178
|
*/
|
|
4427
4179
|
class BeatmapVideo {
|
|
4428
|
-
/**
|
|
4429
|
-
* The location of the video relative to the beatmap directory.
|
|
4430
|
-
*/
|
|
4431
|
-
filename;
|
|
4432
|
-
/**
|
|
4433
|
-
* The start time of the video, in milliseconds from the beginning of the beatmap's audio.
|
|
4434
|
-
*/
|
|
4435
|
-
startTime;
|
|
4436
|
-
/**
|
|
4437
|
-
* Offset in osu! pixels from the centre of the screen.
|
|
4438
|
-
*
|
|
4439
|
-
* For example, an offset of `50,100` would have the video shown 50 osu! pixels
|
|
4440
|
-
* to the right and 100 osu! pixels down from the centre of the screen.
|
|
4441
|
-
*/
|
|
4442
|
-
offset;
|
|
4443
4180
|
constructor(startTime, filename, offset) {
|
|
4444
4181
|
this.startTime = startTime;
|
|
4445
4182
|
this.filename = filename;
|
|
@@ -4451,18 +4188,6 @@ class BeatmapVideo {
|
|
|
4451
4188
|
* Represents a break period in a beatmap.
|
|
4452
4189
|
*/
|
|
4453
4190
|
class BreakPoint {
|
|
4454
|
-
/**
|
|
4455
|
-
* The minimum duration required for a break to have any effect.
|
|
4456
|
-
*/
|
|
4457
|
-
static MIN_BREAK_DURATION = 650;
|
|
4458
|
-
/**
|
|
4459
|
-
* The start time of the break period.
|
|
4460
|
-
*/
|
|
4461
|
-
startTime;
|
|
4462
|
-
/**
|
|
4463
|
-
* The end time of the break period.
|
|
4464
|
-
*/
|
|
4465
|
-
endTime;
|
|
4466
4191
|
/**
|
|
4467
4192
|
* The duration of the break period.
|
|
4468
4193
|
*/
|
|
@@ -4490,12 +4215,19 @@ class BreakPoint {
|
|
|
4490
4215
|
time <= this.endTime - BreakPoint.MIN_BREAK_DURATION / 2);
|
|
4491
4216
|
}
|
|
4492
4217
|
}
|
|
4218
|
+
/**
|
|
4219
|
+
* The minimum duration required for a break to have any effect.
|
|
4220
|
+
*/
|
|
4221
|
+
BreakPoint.MIN_BREAK_DURATION = 650;
|
|
4493
4222
|
|
|
4494
4223
|
/**
|
|
4495
4224
|
* A decoder for decoding a beatmap's events section.
|
|
4496
4225
|
*/
|
|
4497
4226
|
class BeatmapEventsDecoder extends SectionDecoder {
|
|
4498
|
-
|
|
4227
|
+
constructor() {
|
|
4228
|
+
super(...arguments);
|
|
4229
|
+
this.storyboardLines = [];
|
|
4230
|
+
}
|
|
4499
4231
|
decodeInternal(line) {
|
|
4500
4232
|
const s = line.split(",");
|
|
4501
4233
|
switch (s[0]) {
|
|
@@ -4515,10 +4247,12 @@ class BeatmapEventsDecoder extends SectionDecoder {
|
|
|
4515
4247
|
}
|
|
4516
4248
|
}
|
|
4517
4249
|
parseBackground(s) {
|
|
4518
|
-
|
|
4250
|
+
var _a, _b;
|
|
4251
|
+
this.target.events.background = new BeatmapBackground(this.setPosition(s[2]).replace(/"/g, ""), new Vector2(this.tryParseFloat(this.setPosition((_a = s[3]) !== null && _a !== void 0 ? _a : "0")), this.tryParseFloat(this.setPosition((_b = s[4]) !== null && _b !== void 0 ? _b : "0"))));
|
|
4519
4252
|
}
|
|
4520
4253
|
parseVideo(s) {
|
|
4521
|
-
|
|
4254
|
+
var _a, _b;
|
|
4255
|
+
this.target.events.video = new BeatmapVideo(this.tryParseInt(this.setPosition(s[1])), this.setPosition(s[2]).replace(/"/g, ""), new Vector2(this.tryParseFloat(this.setPosition((_a = s[3]) !== null && _a !== void 0 ? _a : "0")), this.tryParseFloat(this.setPosition((_b = s[4]) !== null && _b !== void 0 ? _b : "0"))));
|
|
4522
4256
|
}
|
|
4523
4257
|
parseBreak(s) {
|
|
4524
4258
|
this.target.events.breaks.push(new BreakPoint({
|
|
@@ -4684,22 +4418,6 @@ class BeatmapControlPointsDecoder extends SectionDecoder {
|
|
|
4684
4418
|
* Represents an RGB color.
|
|
4685
4419
|
*/
|
|
4686
4420
|
class RGBColor {
|
|
4687
|
-
/**
|
|
4688
|
-
* The red component of the color.
|
|
4689
|
-
*/
|
|
4690
|
-
r;
|
|
4691
|
-
/**
|
|
4692
|
-
* The green component of the color.
|
|
4693
|
-
*/
|
|
4694
|
-
g;
|
|
4695
|
-
/**
|
|
4696
|
-
* The blue component of the color.
|
|
4697
|
-
*/
|
|
4698
|
-
b;
|
|
4699
|
-
/**
|
|
4700
|
-
* The alpha component of the color.
|
|
4701
|
-
*/
|
|
4702
|
-
a;
|
|
4703
4421
|
constructor(r, g, b, a = 1) {
|
|
4704
4422
|
this.r = MathUtils.clamp(r, 0, 255);
|
|
4705
4423
|
this.g = MathUtils.clamp(g, 0, 255);
|
|
@@ -4816,34 +4534,6 @@ exports.BlendingType = void 0;
|
|
|
4816
4534
|
* Contains information about how a blend mode operation should be blended into its destination.
|
|
4817
4535
|
*/
|
|
4818
4536
|
class BlendingParameters {
|
|
4819
|
-
/**
|
|
4820
|
-
* The blending factor for the source color of the blend.
|
|
4821
|
-
*/
|
|
4822
|
-
source;
|
|
4823
|
-
/**
|
|
4824
|
-
* The blending factor for the destination color of the blend.
|
|
4825
|
-
*/
|
|
4826
|
-
destination;
|
|
4827
|
-
/**
|
|
4828
|
-
* The blending factor for the source alpha of the blend.
|
|
4829
|
-
*/
|
|
4830
|
-
sourceAlpha;
|
|
4831
|
-
/**
|
|
4832
|
-
* The blending factor for the destination alpha of the blend.
|
|
4833
|
-
*/
|
|
4834
|
-
destinationAlpha;
|
|
4835
|
-
/**
|
|
4836
|
-
* Gets or sets the blending equation to use for the RGB components of the blend.
|
|
4837
|
-
*/
|
|
4838
|
-
rgbEquation;
|
|
4839
|
-
/**
|
|
4840
|
-
* Gets or sets the blending equation to use for the alpha component of the blend.
|
|
4841
|
-
*/
|
|
4842
|
-
alphaEquation;
|
|
4843
|
-
static none = new BlendingParameters(exports.BlendingType.one, exports.BlendingType.zero, exports.BlendingType.one, exports.BlendingType.zero, exports.BlendingEquation.add, exports.BlendingEquation.add);
|
|
4844
|
-
static inherit = new BlendingParameters(exports.BlendingType.inherit, exports.BlendingType.inherit, exports.BlendingType.inherit, exports.BlendingType.inherit, exports.BlendingEquation.inherit, exports.BlendingEquation.inherit);
|
|
4845
|
-
static mixture = new BlendingParameters(exports.BlendingType.srcAlpha, exports.BlendingType.oneMinusSrcAlpha, exports.BlendingType.one, exports.BlendingType.one, exports.BlendingEquation.add, exports.BlendingEquation.add);
|
|
4846
|
-
static additive = new BlendingParameters(exports.BlendingType.srcAlpha, exports.BlendingType.one, exports.BlendingType.one, exports.BlendingType.one, exports.BlendingEquation.add, exports.BlendingEquation.add);
|
|
4847
4537
|
constructor(source, destination, sourceAlpha, destinationAlpha, rgbEquation, alphaEquation) {
|
|
4848
4538
|
this.source = source;
|
|
4849
4539
|
this.destination = destination;
|
|
@@ -4853,6 +4543,10 @@ class BlendingParameters {
|
|
|
4853
4543
|
this.alphaEquation = alphaEquation;
|
|
4854
4544
|
}
|
|
4855
4545
|
}
|
|
4546
|
+
BlendingParameters.none = new BlendingParameters(exports.BlendingType.one, exports.BlendingType.zero, exports.BlendingType.one, exports.BlendingType.zero, exports.BlendingEquation.add, exports.BlendingEquation.add);
|
|
4547
|
+
BlendingParameters.inherit = new BlendingParameters(exports.BlendingType.inherit, exports.BlendingType.inherit, exports.BlendingType.inherit, exports.BlendingType.inherit, exports.BlendingEquation.inherit, exports.BlendingEquation.inherit);
|
|
4548
|
+
BlendingParameters.mixture = new BlendingParameters(exports.BlendingType.srcAlpha, exports.BlendingType.oneMinusSrcAlpha, exports.BlendingType.one, exports.BlendingType.one, exports.BlendingEquation.add, exports.BlendingEquation.add);
|
|
4549
|
+
BlendingParameters.additive = new BlendingParameters(exports.BlendingType.srcAlpha, exports.BlendingType.one, exports.BlendingType.one, exports.BlendingType.one, exports.BlendingEquation.add, exports.BlendingEquation.add);
|
|
4856
4550
|
|
|
4857
4551
|
/**
|
|
4858
4552
|
* Available storyboard command types.
|
|
@@ -4886,34 +4580,6 @@ exports.StoryboardParameterCommandType = void 0;
|
|
|
4886
4580
|
* Represents a storyboard command.
|
|
4887
4581
|
*/
|
|
4888
4582
|
class Command {
|
|
4889
|
-
/**
|
|
4890
|
-
* The type of the command.
|
|
4891
|
-
*/
|
|
4892
|
-
type;
|
|
4893
|
-
/**
|
|
4894
|
-
* The parameter type of the command.
|
|
4895
|
-
*/
|
|
4896
|
-
parameterType;
|
|
4897
|
-
/**
|
|
4898
|
-
* The easing of the command.
|
|
4899
|
-
*/
|
|
4900
|
-
easing;
|
|
4901
|
-
/**
|
|
4902
|
-
* The time at which the command starts.
|
|
4903
|
-
*/
|
|
4904
|
-
startTime;
|
|
4905
|
-
/**
|
|
4906
|
-
* The time at which the command ends.
|
|
4907
|
-
*/
|
|
4908
|
-
endTime;
|
|
4909
|
-
/**
|
|
4910
|
-
* The start value of the command.
|
|
4911
|
-
*/
|
|
4912
|
-
startValue;
|
|
4913
|
-
/**
|
|
4914
|
-
* The end value of the command.
|
|
4915
|
-
*/
|
|
4916
|
-
endValue;
|
|
4917
4583
|
/**
|
|
4918
4584
|
* The duration of the command.
|
|
4919
4585
|
*/
|
|
@@ -4946,19 +4612,6 @@ class Command {
|
|
|
4946
4612
|
* A command timeline contains all commands of the same type that occur in a sprite.
|
|
4947
4613
|
*/
|
|
4948
4614
|
class CommandTimeline {
|
|
4949
|
-
/**
|
|
4950
|
-
* The type of the command timeline.
|
|
4951
|
-
*/
|
|
4952
|
-
type;
|
|
4953
|
-
/**
|
|
4954
|
-
* The parameter command type of the command timeline.
|
|
4955
|
-
*/
|
|
4956
|
-
parameterType;
|
|
4957
|
-
_commands = [];
|
|
4958
|
-
_startTime = Number.MAX_SAFE_INTEGER;
|
|
4959
|
-
_endTime = Number.MIN_SAFE_INTEGER;
|
|
4960
|
-
_startValue = null;
|
|
4961
|
-
_endValue = null;
|
|
4962
4615
|
/**
|
|
4963
4616
|
* The commands in this command timeline.
|
|
4964
4617
|
*/
|
|
@@ -4987,6 +4640,11 @@ class CommandTimeline {
|
|
|
4987
4640
|
return this._commands.length > 0;
|
|
4988
4641
|
}
|
|
4989
4642
|
constructor(type, parameterType) {
|
|
4643
|
+
this._commands = [];
|
|
4644
|
+
this._startTime = Number.MAX_SAFE_INTEGER;
|
|
4645
|
+
this._endTime = Number.MIN_SAFE_INTEGER;
|
|
4646
|
+
this._startValue = null;
|
|
4647
|
+
this._endValue = null;
|
|
4990
4648
|
this.type = type;
|
|
4991
4649
|
this.parameterType = parameterType;
|
|
4992
4650
|
}
|
|
@@ -5020,66 +4678,68 @@ class CommandTimeline {
|
|
|
5020
4678
|
* Represents a group of command timelines.
|
|
5021
4679
|
*/
|
|
5022
4680
|
class CommandTimelineGroup {
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
this.
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
4681
|
+
constructor() {
|
|
4682
|
+
/**
|
|
4683
|
+
* The command timeline that changes an animation or sprite's X and Y coordinates.
|
|
4684
|
+
*/
|
|
4685
|
+
this.move = new CommandTimeline(exports.StoryboardCommandType.movement);
|
|
4686
|
+
/**
|
|
4687
|
+
* The command timeline that changes an animation or sprite's X-coordinate.
|
|
4688
|
+
*/
|
|
4689
|
+
this.x = new CommandTimeline(exports.StoryboardCommandType.movementX);
|
|
4690
|
+
/**
|
|
4691
|
+
* The command timeline that changes an animation or sprite's Y-coordinate.
|
|
4692
|
+
*/
|
|
4693
|
+
this.y = new CommandTimeline(exports.StoryboardCommandType.movementY);
|
|
4694
|
+
/**
|
|
4695
|
+
* The command timeline that scales an animation or sprite with a number.
|
|
4696
|
+
*/
|
|
4697
|
+
this.scale = new CommandTimeline(exports.StoryboardCommandType.scale);
|
|
4698
|
+
/**
|
|
4699
|
+
* The command timeline that scales an animation or sprite with a vector.
|
|
4700
|
+
*
|
|
4701
|
+
* This allows scaling the width and height of an animation or sprite individually at the same time.
|
|
4702
|
+
*/
|
|
4703
|
+
this.vectorScale = new CommandTimeline(exports.StoryboardCommandType.vectorScale);
|
|
4704
|
+
/**
|
|
4705
|
+
* The command timeline that rotates an animation or sprite, in radians, clockwise.
|
|
4706
|
+
*/
|
|
4707
|
+
this.rotation = new CommandTimeline(exports.StoryboardCommandType.rotation);
|
|
4708
|
+
/**
|
|
4709
|
+
* The command timeline that changes an animation or sprite's virtual light source color.
|
|
4710
|
+
*
|
|
4711
|
+
* The colors of the pixels on the animation or sprite are determined subtractively.
|
|
4712
|
+
*/
|
|
4713
|
+
this.color = new CommandTimeline(exports.StoryboardCommandType.color);
|
|
4714
|
+
/**
|
|
4715
|
+
* The command timeline that changes the opacity of an animation or sprite.
|
|
4716
|
+
*/
|
|
4717
|
+
this.alpha = new CommandTimeline(exports.StoryboardCommandType.fade);
|
|
4718
|
+
/**
|
|
4719
|
+
* The command timeline that determines the blending behavior of an animation or sprite.
|
|
4720
|
+
*/
|
|
4721
|
+
this.blendingParameters = new CommandTimeline(exports.StoryboardCommandType.parameter, exports.StoryboardParameterCommandType.blendingMode);
|
|
4722
|
+
/**
|
|
4723
|
+
* The command timeline that determines whether the animation or sprite should be flipped horizontally.
|
|
4724
|
+
*/
|
|
4725
|
+
this.flipHorizontal = new CommandTimeline(exports.StoryboardCommandType.parameter, exports.StoryboardParameterCommandType.horizontalFlip);
|
|
4726
|
+
/**
|
|
4727
|
+
* The command timeline that determines whether the animation or sprite should be flipped vertically.
|
|
4728
|
+
*/
|
|
4729
|
+
this.flipVertical = new CommandTimeline(exports.StoryboardCommandType.parameter, exports.StoryboardParameterCommandType.verticalFlip);
|
|
4730
|
+
this.timelines = [
|
|
4731
|
+
this.x,
|
|
4732
|
+
this.y,
|
|
4733
|
+
this.scale,
|
|
4734
|
+
this.vectorScale,
|
|
4735
|
+
this.rotation,
|
|
4736
|
+
this.color,
|
|
4737
|
+
this.alpha,
|
|
4738
|
+
this.blendingParameters,
|
|
4739
|
+
this.flipHorizontal,
|
|
4740
|
+
this.flipVertical,
|
|
4741
|
+
];
|
|
4742
|
+
}
|
|
5083
4743
|
/**
|
|
5084
4744
|
* The start time of commands.
|
|
5085
4745
|
*/
|
|
@@ -5141,14 +4801,6 @@ class CommandTimelineGroup {
|
|
|
5141
4801
|
* Represents a loop compound command.
|
|
5142
4802
|
*/
|
|
5143
4803
|
class CommandLoop extends CommandTimelineGroup {
|
|
5144
|
-
/**
|
|
5145
|
-
* The start time of the loop command.
|
|
5146
|
-
*/
|
|
5147
|
-
loopStartTime;
|
|
5148
|
-
/**
|
|
5149
|
-
* The total number of times this loop is played back. Always greater than zero.
|
|
5150
|
-
*/
|
|
5151
|
-
totalIterations;
|
|
5152
4804
|
get startTime() {
|
|
5153
4805
|
return this.loopStartTime + this.commandsStartTime;
|
|
5154
4806
|
}
|
|
@@ -5174,28 +4826,12 @@ class CommandLoop extends CommandTimelineGroup {
|
|
|
5174
4826
|
toString() {
|
|
5175
4827
|
return `${this.loopStartTime} x${this.totalIterations}`;
|
|
5176
4828
|
}
|
|
5177
|
-
}
|
|
5178
|
-
|
|
5179
|
-
/**
|
|
5180
|
-
* Represents a trigger command.
|
|
5181
|
-
*/
|
|
5182
|
-
class CommandTrigger extends CommandTimelineGroup {
|
|
5183
|
-
/**
|
|
5184
|
-
* The name of the trigger.
|
|
5185
|
-
*/
|
|
5186
|
-
triggerName;
|
|
5187
|
-
/**
|
|
5188
|
-
* The start time of the command.
|
|
5189
|
-
*/
|
|
5190
|
-
triggerStartTime;
|
|
5191
|
-
/**
|
|
5192
|
-
* The end time of the command.
|
|
5193
|
-
*/
|
|
5194
|
-
triggerEndTime;
|
|
5195
|
-
/**
|
|
5196
|
-
* The group number of the command.
|
|
5197
|
-
*/
|
|
5198
|
-
groupNumber;
|
|
4829
|
+
}
|
|
4830
|
+
|
|
4831
|
+
/**
|
|
4832
|
+
* Represents a trigger command.
|
|
4833
|
+
*/
|
|
4834
|
+
class CommandTrigger extends CommandTimelineGroup {
|
|
5199
4835
|
constructor(triggerName, startTime, endTime, groupNumber) {
|
|
5200
4836
|
super();
|
|
5201
4837
|
this.triggerName = triggerName;
|
|
@@ -5212,10 +4848,6 @@ class CommandTrigger extends CommandTimelineGroup {
|
|
|
5212
4848
|
* Represents a storyboard element.
|
|
5213
4849
|
*/
|
|
5214
4850
|
class StoryboardElement {
|
|
5215
|
-
/**
|
|
5216
|
-
* The file path to the content of the element.
|
|
5217
|
-
*/
|
|
5218
|
-
path;
|
|
5219
4851
|
/**
|
|
5220
4852
|
* The time at which the element ends.
|
|
5221
4853
|
*/
|
|
@@ -5237,26 +4869,6 @@ class StoryboardElement {
|
|
|
5237
4869
|
* Represents a storyboard sprite.
|
|
5238
4870
|
*/
|
|
5239
4871
|
class StoryboardSprite extends StoryboardElement {
|
|
5240
|
-
/**
|
|
5241
|
-
* The loop commands of the sprite.
|
|
5242
|
-
*/
|
|
5243
|
-
loops = [];
|
|
5244
|
-
/**
|
|
5245
|
-
* The trigger commands of the sprite.
|
|
5246
|
-
*/
|
|
5247
|
-
triggers = [];
|
|
5248
|
-
/**
|
|
5249
|
-
* The origin of the sprite.
|
|
5250
|
-
*/
|
|
5251
|
-
origin;
|
|
5252
|
-
/**
|
|
5253
|
-
* The initial position of the sprite.
|
|
5254
|
-
*/
|
|
5255
|
-
initialPosition;
|
|
5256
|
-
/**
|
|
5257
|
-
* The command timeline group of the sprite.
|
|
5258
|
-
*/
|
|
5259
|
-
timelineGroup = new CommandTimelineGroup();
|
|
5260
4872
|
get startTime() {
|
|
5261
4873
|
// To get the initial start time, we need to check whether the first alpha command to exist (across all loops) has a start value of zero.
|
|
5262
4874
|
// A start value of zero governs, above all else, the first valid display time of a sprite.
|
|
@@ -5312,6 +4924,18 @@ class StoryboardSprite extends StoryboardElement {
|
|
|
5312
4924
|
}
|
|
5313
4925
|
constructor(path, origin, initialPosition) {
|
|
5314
4926
|
super(path);
|
|
4927
|
+
/**
|
|
4928
|
+
* The loop commands of the sprite.
|
|
4929
|
+
*/
|
|
4930
|
+
this.loops = [];
|
|
4931
|
+
/**
|
|
4932
|
+
* The trigger commands of the sprite.
|
|
4933
|
+
*/
|
|
4934
|
+
this.triggers = [];
|
|
4935
|
+
/**
|
|
4936
|
+
* The command timeline group of the sprite.
|
|
4937
|
+
*/
|
|
4938
|
+
this.timelineGroup = new CommandTimelineGroup();
|
|
5315
4939
|
this.origin = origin;
|
|
5316
4940
|
this.initialPosition = initialPosition;
|
|
5317
4941
|
}
|
|
@@ -5350,18 +4974,6 @@ class StoryboardSprite extends StoryboardElement {
|
|
|
5350
4974
|
* Represents a storyboard's animation.
|
|
5351
4975
|
*/
|
|
5352
4976
|
class StoryboardAnimation extends StoryboardSprite {
|
|
5353
|
-
/**
|
|
5354
|
-
* The amount of frames that the animation has.
|
|
5355
|
-
*/
|
|
5356
|
-
frameCount;
|
|
5357
|
-
/**
|
|
5358
|
-
* The delay between frames, in milliseconds.
|
|
5359
|
-
*/
|
|
5360
|
-
frameDelay;
|
|
5361
|
-
/**
|
|
5362
|
-
* The loop type of the animation.
|
|
5363
|
-
*/
|
|
5364
|
-
loopType;
|
|
5365
4977
|
constructor(path, origin, initialPosition, frameCount, frameDelay, loopType) {
|
|
5366
4978
|
super(path, origin, initialPosition);
|
|
5367
4979
|
this.frameCount = frameCount;
|
|
@@ -5374,14 +4986,9 @@ class StoryboardAnimation extends StoryboardSprite {
|
|
|
5374
4986
|
* Represents a storyboard sample.
|
|
5375
4987
|
*/
|
|
5376
4988
|
class StoryboardSample extends StoryboardElement {
|
|
5377
|
-
_startTime;
|
|
5378
4989
|
get startTime() {
|
|
5379
4990
|
return this._startTime;
|
|
5380
4991
|
}
|
|
5381
|
-
/**
|
|
5382
|
-
* The volume at which the sample is played.
|
|
5383
|
-
*/
|
|
5384
|
-
volume;
|
|
5385
4992
|
constructor(path, time, volume) {
|
|
5386
4993
|
super(path);
|
|
5387
4994
|
this._startTime = time;
|
|
@@ -5405,9 +5012,12 @@ exports.StoryboardEventType = void 0;
|
|
|
5405
5012
|
* A decoder for decoding a storyboard's events section.
|
|
5406
5013
|
*/
|
|
5407
5014
|
class StoryboardEventsDecoder extends SectionDecoder {
|
|
5408
|
-
|
|
5409
|
-
|
|
5015
|
+
constructor() {
|
|
5016
|
+
super(...arguments);
|
|
5017
|
+
this.storyboardSprite = null;
|
|
5018
|
+
}
|
|
5410
5019
|
decodeInternal(line) {
|
|
5020
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
5411
5021
|
// Ignore comments, background, and video.
|
|
5412
5022
|
if (["//", "0", "1", "Video", "2", "Break", "3"].some((v) => line.startsWith(v))) {
|
|
5413
5023
|
return;
|
|
@@ -5474,11 +5084,11 @@ class StoryboardEventsDecoder extends SectionDecoder {
|
|
|
5474
5084
|
}
|
|
5475
5085
|
else {
|
|
5476
5086
|
if (depth < 2) {
|
|
5477
|
-
this.timelineGroup = this.storyboardSprite
|
|
5087
|
+
this.timelineGroup = (_a = this.storyboardSprite) === null || _a === void 0 ? void 0 : _a.timelineGroup;
|
|
5478
5088
|
}
|
|
5479
5089
|
switch (this.setPosition(s[0])) {
|
|
5480
5090
|
case exports.StoryboardCommandType.trigger:
|
|
5481
|
-
this.timelineGroup = this.storyboardSprite
|
|
5091
|
+
this.timelineGroup = (_b = this.storyboardSprite) === null || _b === void 0 ? void 0 : _b.addTrigger(this.setPosition(s[1]), s.length > 2
|
|
5482
5092
|
? this.tryParseInt(this.setPosition(s[2]))
|
|
5483
5093
|
: Number.MIN_SAFE_INTEGER, s.length > 3
|
|
5484
5094
|
? this.tryParseInt(this.setPosition(s[3]))
|
|
@@ -5487,7 +5097,7 @@ class StoryboardEventsDecoder extends SectionDecoder {
|
|
|
5487
5097
|
: 0);
|
|
5488
5098
|
break;
|
|
5489
5099
|
case exports.StoryboardCommandType.loop:
|
|
5490
|
-
this.timelineGroup = this.storyboardSprite
|
|
5100
|
+
this.timelineGroup = (_c = this.storyboardSprite) === null || _c === void 0 ? void 0 : _c.addLoop(this.tryParseInt(this.setPosition(s[1])), Math.max(0, this.tryParseInt(this.setPosition(s[2])) - 1));
|
|
5491
5101
|
break;
|
|
5492
5102
|
default: {
|
|
5493
5103
|
if (!s[3]) {
|
|
@@ -5502,7 +5112,7 @@ class StoryboardEventsDecoder extends SectionDecoder {
|
|
|
5502
5112
|
const endValue = s.length > 5
|
|
5503
5113
|
? this.tryParseFloat(this.setPosition(s[5]))
|
|
5504
5114
|
: startValue;
|
|
5505
|
-
this.timelineGroup
|
|
5115
|
+
(_d = this.timelineGroup) === null || _d === void 0 ? void 0 : _d.alpha.add(easing, startTime, endTime, startValue, endValue);
|
|
5506
5116
|
break;
|
|
5507
5117
|
}
|
|
5508
5118
|
case exports.StoryboardCommandType.scale: {
|
|
@@ -5510,7 +5120,7 @@ class StoryboardEventsDecoder extends SectionDecoder {
|
|
|
5510
5120
|
const endValue = s.length > 5
|
|
5511
5121
|
? this.tryParseFloat(this.setPosition(s[5]))
|
|
5512
5122
|
: startValue;
|
|
5513
|
-
this.timelineGroup
|
|
5123
|
+
(_e = this.timelineGroup) === null || _e === void 0 ? void 0 : _e.scale.add(easing, startTime, endTime, startValue, endValue);
|
|
5514
5124
|
break;
|
|
5515
5125
|
}
|
|
5516
5126
|
case exports.StoryboardCommandType.vectorScale: {
|
|
@@ -5522,7 +5132,7 @@ class StoryboardEventsDecoder extends SectionDecoder {
|
|
|
5522
5132
|
const endY = s.length > 7
|
|
5523
5133
|
? this.tryParseFloat(this.setPosition(s[7]))
|
|
5524
5134
|
: startY;
|
|
5525
|
-
this.timelineGroup
|
|
5135
|
+
(_f = this.timelineGroup) === null || _f === void 0 ? void 0 : _f.vectorScale.add(easing, startTime, endTime, new Vector2(startX, startY), new Vector2(endX, endY));
|
|
5526
5136
|
break;
|
|
5527
5137
|
}
|
|
5528
5138
|
case exports.StoryboardCommandType.rotation: {
|
|
@@ -5530,7 +5140,7 @@ class StoryboardEventsDecoder extends SectionDecoder {
|
|
|
5530
5140
|
const endValue = s.length > 5
|
|
5531
5141
|
? this.tryParseFloat(this.setPosition(s[5]))
|
|
5532
5142
|
: startValue;
|
|
5533
|
-
this.timelineGroup
|
|
5143
|
+
(_g = this.timelineGroup) === null || _g === void 0 ? void 0 : _g.rotation.add(easing, startTime, endTime, MathUtils.radiansToDegrees(startValue), MathUtils.radiansToDegrees(endValue));
|
|
5534
5144
|
break;
|
|
5535
5145
|
}
|
|
5536
5146
|
case exports.StoryboardCommandType.movement: {
|
|
@@ -5542,7 +5152,7 @@ class StoryboardEventsDecoder extends SectionDecoder {
|
|
|
5542
5152
|
const endY = s.length > 7
|
|
5543
5153
|
? this.tryParseFloat(this.setPosition(s[7]))
|
|
5544
5154
|
: startY;
|
|
5545
|
-
this.timelineGroup
|
|
5155
|
+
(_h = this.timelineGroup) === null || _h === void 0 ? void 0 : _h.move.add(easing, startTime, endTime, new Vector2(startX, endX), new Vector2(startY, endY));
|
|
5546
5156
|
break;
|
|
5547
5157
|
}
|
|
5548
5158
|
case exports.StoryboardCommandType.movementX: {
|
|
@@ -5550,7 +5160,7 @@ class StoryboardEventsDecoder extends SectionDecoder {
|
|
|
5550
5160
|
const endValue = s.length > 5
|
|
5551
5161
|
? this.tryParseFloat(this.setPosition(s[5]))
|
|
5552
5162
|
: startValue;
|
|
5553
|
-
this.timelineGroup
|
|
5163
|
+
(_j = this.timelineGroup) === null || _j === void 0 ? void 0 : _j.x.add(easing, startTime, endTime, startValue, endValue);
|
|
5554
5164
|
break;
|
|
5555
5165
|
}
|
|
5556
5166
|
case exports.StoryboardCommandType.movementY: {
|
|
@@ -5558,7 +5168,7 @@ class StoryboardEventsDecoder extends SectionDecoder {
|
|
|
5558
5168
|
const endValue = s.length > 5
|
|
5559
5169
|
? this.tryParseFloat(this.setPosition(s[5]))
|
|
5560
5170
|
: startValue;
|
|
5561
|
-
this.timelineGroup
|
|
5171
|
+
(_k = this.timelineGroup) === null || _k === void 0 ? void 0 : _k.y.add(easing, startTime, endTime, startValue, endValue);
|
|
5562
5172
|
break;
|
|
5563
5173
|
}
|
|
5564
5174
|
case exports.StoryboardCommandType.color: {
|
|
@@ -5574,21 +5184,21 @@ class StoryboardEventsDecoder extends SectionDecoder {
|
|
|
5574
5184
|
const endBlue = s.length > 9
|
|
5575
5185
|
? this.tryParseFloat(s[9])
|
|
5576
5186
|
: startBlue;
|
|
5577
|
-
this.timelineGroup
|
|
5187
|
+
(_l = this.timelineGroup) === null || _l === void 0 ? void 0 : _l.color.add(easing, startTime, endTime, new RGBColor(startRed, startGreen, startBlue), new RGBColor(endRed, endGreen, endBlue));
|
|
5578
5188
|
break;
|
|
5579
5189
|
}
|
|
5580
5190
|
case exports.StoryboardCommandType.parameter:
|
|
5581
5191
|
switch (this.setPosition(s[4])) {
|
|
5582
5192
|
case exports.StoryboardParameterCommandType.blendingMode:
|
|
5583
|
-
this.timelineGroup
|
|
5193
|
+
(_m = this.timelineGroup) === null || _m === void 0 ? void 0 : _m.blendingParameters.add(easing, startTime, endTime, BlendingParameters.additive, startTime === endTime
|
|
5584
5194
|
? BlendingParameters.additive
|
|
5585
5195
|
: BlendingParameters.inherit);
|
|
5586
5196
|
break;
|
|
5587
5197
|
case exports.StoryboardParameterCommandType.horizontalFlip:
|
|
5588
|
-
this.timelineGroup
|
|
5198
|
+
(_o = this.timelineGroup) === null || _o === void 0 ? void 0 : _o.flipHorizontal.add(easing, startTime, endTime, true, startTime === endTime);
|
|
5589
5199
|
break;
|
|
5590
5200
|
case exports.StoryboardParameterCommandType.verticalFlip:
|
|
5591
|
-
this.timelineGroup
|
|
5201
|
+
(_p = this.timelineGroup) === null || _p === void 0 ? void 0 : _p.flipVertical.add(easing, startTime, endTime, true, startTime === endTime);
|
|
5592
5202
|
break;
|
|
5593
5203
|
}
|
|
5594
5204
|
break;
|
|
@@ -5641,27 +5251,11 @@ class StoryboardVariablesDecoder extends SectionDecoder {
|
|
|
5641
5251
|
* Represents a storyboard's layer.
|
|
5642
5252
|
*/
|
|
5643
5253
|
class StoryboardLayer {
|
|
5644
|
-
/**
|
|
5645
|
-
* The name of the layer.
|
|
5646
|
-
*/
|
|
5647
|
-
name;
|
|
5648
|
-
/**
|
|
5649
|
-
* The depth of the layer.
|
|
5650
|
-
*/
|
|
5651
|
-
depth;
|
|
5652
|
-
/**
|
|
5653
|
-
* Whether this storyboard layer is visible in pass state.
|
|
5654
|
-
*/
|
|
5655
|
-
visibleWhenPassing;
|
|
5656
|
-
/**
|
|
5657
|
-
* Whether this storyboard layer is visible in fail state.
|
|
5658
|
-
*/
|
|
5659
|
-
visibleWhenFailing;
|
|
5660
|
-
/**
|
|
5661
|
-
* The storyboard elements in this layer.
|
|
5662
|
-
*/
|
|
5663
|
-
elements = [];
|
|
5664
5254
|
constructor(name, depth, visibleWhenPassing = true, visibleWhenFailing = true) {
|
|
5255
|
+
/**
|
|
5256
|
+
* The storyboard elements in this layer.
|
|
5257
|
+
*/
|
|
5258
|
+
this.elements = [];
|
|
5665
5259
|
this.name = name;
|
|
5666
5260
|
this.depth = depth;
|
|
5667
5261
|
this.visibleWhenPassing = visibleWhenPassing;
|
|
@@ -5673,28 +5267,30 @@ class StoryboardLayer {
|
|
|
5673
5267
|
* Represents a storyboard.
|
|
5674
5268
|
*/
|
|
5675
5269
|
class Storyboard {
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5270
|
+
constructor() {
|
|
5271
|
+
/**
|
|
5272
|
+
* The layers in the storyboard.
|
|
5273
|
+
*/
|
|
5274
|
+
this.layers = {
|
|
5275
|
+
Background: new StoryboardLayer(exports.StoryboardLayerType.background, 3),
|
|
5276
|
+
Fail: new StoryboardLayer(exports.StoryboardLayerType.fail, 2, false),
|
|
5277
|
+
Pass: new StoryboardLayer(exports.StoryboardLayerType.pass, 1, true, false),
|
|
5278
|
+
Foreground: new StoryboardLayer(exports.StoryboardLayerType.foreground, 0),
|
|
5279
|
+
Overlay: new StoryboardLayer(exports.StoryboardLayerType.overlay, Number.MIN_SAFE_INTEGER),
|
|
5280
|
+
};
|
|
5281
|
+
/**
|
|
5282
|
+
* Whether the storyboard can fall back to skin sprites in case no matching storyboard sprites are found.
|
|
5283
|
+
*/
|
|
5284
|
+
this.useSkinSprites = false;
|
|
5285
|
+
/**
|
|
5286
|
+
* The variables of the storyboard.
|
|
5287
|
+
*/
|
|
5288
|
+
this.variables = {};
|
|
5289
|
+
/**
|
|
5290
|
+
* The depth of the currently front-most storyboard layer, excluding the overlay layer.
|
|
5291
|
+
*/
|
|
5292
|
+
this.minimumLayerDepth = 0;
|
|
5293
|
+
}
|
|
5698
5294
|
/**
|
|
5699
5295
|
* Across all layers, find the earliest point in time that a storyboard element exists at.
|
|
5700
5296
|
* Will return `null` if there are no elements.
|
|
@@ -5702,10 +5298,11 @@ class Storyboard {
|
|
|
5702
5298
|
* This iterates all elements and as such should be used sparingly or stored locally.
|
|
5703
5299
|
*/
|
|
5704
5300
|
get earliestEventTime() {
|
|
5705
|
-
|
|
5301
|
+
var _a, _b;
|
|
5302
|
+
return ((_b = (_a = Object.values(this.layers)
|
|
5706
5303
|
.map((v) => v.elements)
|
|
5707
5304
|
.flat()
|
|
5708
|
-
.sort((a, b) => a.startTime - b.startTime)[0]
|
|
5305
|
+
.sort((a, b) => a.startTime - b.startTime)[0]) === null || _a === void 0 ? void 0 : _a.startTime) !== null && _b !== void 0 ? _b : null);
|
|
5709
5306
|
}
|
|
5710
5307
|
/**
|
|
5711
5308
|
* Across all layers, find the latest point in time that a storyboard element exists at.
|
|
@@ -5715,10 +5312,11 @@ class Storyboard {
|
|
|
5715
5312
|
* Samples return start time as their end time.
|
|
5716
5313
|
*/
|
|
5717
5314
|
get latestEventTime() {
|
|
5718
|
-
|
|
5315
|
+
var _a, _b;
|
|
5316
|
+
return ((_b = (_a = Object.values(this.layers)
|
|
5719
5317
|
.map((v) => v.elements)
|
|
5720
5318
|
.flat()
|
|
5721
|
-
.sort((a, b) => b.endTime - a.endTime)[0]
|
|
5319
|
+
.sort((a, b) => b.endTime - a.endTime)[0]) === null || _a === void 0 ? void 0 : _a.endTime) !== null && _b !== void 0 ? _b : null);
|
|
5722
5320
|
}
|
|
5723
5321
|
getLayer(type, createIfNotAvailable = true) {
|
|
5724
5322
|
let layer = this.layers[type];
|
|
@@ -5726,7 +5324,7 @@ class Storyboard {
|
|
|
5726
5324
|
layer = new StoryboardLayer(type, --this.minimumLayerDepth);
|
|
5727
5325
|
this.layers[type] = layer;
|
|
5728
5326
|
}
|
|
5729
|
-
return layer
|
|
5327
|
+
return layer !== null && layer !== void 0 ? layer : null;
|
|
5730
5328
|
}
|
|
5731
5329
|
}
|
|
5732
5330
|
|
|
@@ -5734,10 +5332,10 @@ class Storyboard {
|
|
|
5734
5332
|
* A storyboard decoder.
|
|
5735
5333
|
*/
|
|
5736
5334
|
class StoryboardDecoder extends Decoder {
|
|
5737
|
-
finalResult = new Storyboard();
|
|
5738
|
-
decoders = {};
|
|
5739
5335
|
constructor(formatVersion = Decoder.latestVersion) {
|
|
5740
5336
|
super();
|
|
5337
|
+
this.finalResult = new Storyboard();
|
|
5338
|
+
this.decoders = {};
|
|
5741
5339
|
this.formatVersion = formatVersion;
|
|
5742
5340
|
}
|
|
5743
5341
|
reset() {
|
|
@@ -5755,9 +5353,12 @@ class StoryboardDecoder extends Decoder {
|
|
|
5755
5353
|
* A beatmap decoder.
|
|
5756
5354
|
*/
|
|
5757
5355
|
class BeatmapDecoder extends Decoder {
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5356
|
+
constructor() {
|
|
5357
|
+
super(...arguments);
|
|
5358
|
+
this.finalResult = new Beatmap();
|
|
5359
|
+
this.decoders = {};
|
|
5360
|
+
this.previousSection = BeatmapSection.general;
|
|
5361
|
+
}
|
|
5761
5362
|
/**
|
|
5762
5363
|
* @param str The string to decode.
|
|
5763
5364
|
* @param mode The mode to parse the beatmap as. Defaults to osu!standard.
|
|
@@ -5812,14 +5413,6 @@ class BeatmapDecoder extends Decoder {
|
|
|
5812
5413
|
* The base of main encoders.
|
|
5813
5414
|
*/
|
|
5814
5415
|
class Encoder {
|
|
5815
|
-
/**
|
|
5816
|
-
* The target of the encoding process.
|
|
5817
|
-
*/
|
|
5818
|
-
target;
|
|
5819
|
-
/**
|
|
5820
|
-
* The result of the encoding process.
|
|
5821
|
-
*/
|
|
5822
|
-
finalResult = "";
|
|
5823
5416
|
/**
|
|
5824
5417
|
* The result of the encoding process.
|
|
5825
5418
|
*/
|
|
@@ -5830,6 +5423,10 @@ class Encoder {
|
|
|
5830
5423
|
* @param target The target of the encoding process.
|
|
5831
5424
|
*/
|
|
5832
5425
|
constructor(target) {
|
|
5426
|
+
/**
|
|
5427
|
+
* The result of the encoding process.
|
|
5428
|
+
*/
|
|
5429
|
+
this.finalResult = "";
|
|
5833
5430
|
this.target = target;
|
|
5834
5431
|
}
|
|
5835
5432
|
/**
|
|
@@ -5864,15 +5461,11 @@ class Encoder {
|
|
|
5864
5461
|
* The base of all encoders.
|
|
5865
5462
|
*/
|
|
5866
5463
|
class BaseEncoder {
|
|
5867
|
-
/**
|
|
5868
|
-
* The target of the encoding process.
|
|
5869
|
-
*/
|
|
5870
|
-
result = "";
|
|
5871
|
-
/**
|
|
5872
|
-
* Whether sections should be encoded. Defaults to `true`.
|
|
5873
|
-
*/
|
|
5874
|
-
encodeSections;
|
|
5875
5464
|
constructor(encodeSections = true) {
|
|
5465
|
+
/**
|
|
5466
|
+
* The target of the encoding process.
|
|
5467
|
+
*/
|
|
5468
|
+
this.result = "";
|
|
5876
5469
|
this.encodeSections = encodeSections;
|
|
5877
5470
|
}
|
|
5878
5471
|
/**
|
|
@@ -5907,10 +5500,6 @@ class BaseEncoder {
|
|
|
5907
5500
|
* The base of per-section beatmap encoders.
|
|
5908
5501
|
*/
|
|
5909
5502
|
class BeatmapBaseEncoder extends BaseEncoder {
|
|
5910
|
-
/**
|
|
5911
|
-
* The beatmap that is being encoded.
|
|
5912
|
-
*/
|
|
5913
|
-
map;
|
|
5914
5503
|
constructor(map, encodeSections = true) {
|
|
5915
5504
|
super(encodeSections);
|
|
5916
5505
|
this.map = map;
|
|
@@ -5963,8 +5552,12 @@ class BeatmapColorEncoder extends BeatmapBaseEncoder {
|
|
|
5963
5552
|
* An encoder for encoding a beatmap's timing points section.
|
|
5964
5553
|
*/
|
|
5965
5554
|
class BeatmapControlPointsEncoder extends BeatmapBaseEncoder {
|
|
5966
|
-
|
|
5555
|
+
constructor() {
|
|
5556
|
+
super(...arguments);
|
|
5557
|
+
this.controlPointGroups = {};
|
|
5558
|
+
}
|
|
5967
5559
|
encodeInternal() {
|
|
5560
|
+
var _a;
|
|
5968
5561
|
if (this.map.controlPoints.timing.points.length === 0 &&
|
|
5969
5562
|
this.map.controlPoints.difficulty.points.length === 0 &&
|
|
5970
5563
|
this.map.controlPoints.effect.points.length === 0 &&
|
|
@@ -5988,45 +5581,47 @@ class BeatmapControlPointsEncoder extends BeatmapBaseEncoder {
|
|
|
5988
5581
|
}
|
|
5989
5582
|
// Output any remaining effects as secondary non-timing control point.
|
|
5990
5583
|
this.write(`${group.time},`);
|
|
5991
|
-
const difficultyPoint = group.difficulty
|
|
5992
|
-
this.map.controlPoints.difficulty.controlPointAt(group.time);
|
|
5584
|
+
const difficultyPoint = (_a = group.difficulty) !== null && _a !== void 0 ? _a : this.map.controlPoints.difficulty.controlPointAt(group.time);
|
|
5993
5585
|
this.write(`${-100 / difficultyPoint.speedMultiplier},`);
|
|
5994
5586
|
this.outputControlPointGroup(group, false);
|
|
5995
5587
|
}
|
|
5996
5588
|
}
|
|
5997
5589
|
collectTimingControlPointInfo() {
|
|
5590
|
+
var _a, _b;
|
|
5998
5591
|
for (const t of this.map.controlPoints.timing.points) {
|
|
5999
|
-
const group = this.controlPointGroups[t.time]
|
|
6000
|
-
group.timing
|
|
5592
|
+
const group = (_a = this.controlPointGroups[t.time]) !== null && _a !== void 0 ? _a : { time: t.time };
|
|
5593
|
+
(_b = group.timing) !== null && _b !== void 0 ? _b : (group.timing = t);
|
|
6001
5594
|
this.controlPointGroups[t.time] = group;
|
|
6002
5595
|
}
|
|
6003
5596
|
}
|
|
6004
5597
|
collectDifficultyControlPointInfo() {
|
|
5598
|
+
var _a, _b;
|
|
6005
5599
|
for (const t of this.map.controlPoints.difficulty.points) {
|
|
6006
|
-
const group = this.controlPointGroups[t.time]
|
|
6007
|
-
group.difficulty
|
|
5600
|
+
const group = (_a = this.controlPointGroups[t.time]) !== null && _a !== void 0 ? _a : { time: t.time };
|
|
5601
|
+
(_b = group.difficulty) !== null && _b !== void 0 ? _b : (group.difficulty = t);
|
|
6008
5602
|
this.controlPointGroups[t.time] = group;
|
|
6009
5603
|
}
|
|
6010
5604
|
}
|
|
6011
5605
|
collectEffectControlPointInfo() {
|
|
5606
|
+
var _a, _b;
|
|
6012
5607
|
for (const t of this.map.controlPoints.effect.points) {
|
|
6013
|
-
const group = this.controlPointGroups[t.time]
|
|
6014
|
-
group.effect
|
|
5608
|
+
const group = (_a = this.controlPointGroups[t.time]) !== null && _a !== void 0 ? _a : { time: t.time };
|
|
5609
|
+
(_b = group.effect) !== null && _b !== void 0 ? _b : (group.effect = t);
|
|
6015
5610
|
this.controlPointGroups[t.time] = group;
|
|
6016
5611
|
}
|
|
6017
5612
|
}
|
|
6018
5613
|
collectSampleControlPointInfo() {
|
|
5614
|
+
var _a, _b;
|
|
6019
5615
|
for (const t of this.map.controlPoints.sample.points) {
|
|
6020
|
-
const group = this.controlPointGroups[t.time]
|
|
6021
|
-
group.sample
|
|
5616
|
+
const group = (_a = this.controlPointGroups[t.time]) !== null && _a !== void 0 ? _a : { time: t.time };
|
|
5617
|
+
(_b = group.sample) !== null && _b !== void 0 ? _b : (group.sample = t);
|
|
6022
5618
|
this.controlPointGroups[t.time] = group;
|
|
6023
5619
|
}
|
|
6024
5620
|
}
|
|
6025
5621
|
outputControlPointGroup(group, isTimingPoint) {
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
const effectPoint = group.effect
|
|
6029
|
-
this.map.controlPoints.effect.controlPointAt(group.time);
|
|
5622
|
+
var _a, _b, _c;
|
|
5623
|
+
const samplePoint = (_a = group.sample) !== null && _a !== void 0 ? _a : this.map.controlPoints.sample.controlPointAt(group.time);
|
|
5624
|
+
const effectPoint = (_b = group.effect) !== null && _b !== void 0 ? _b : this.map.controlPoints.effect.controlPointAt(group.time);
|
|
6030
5625
|
// Convert effect flags.
|
|
6031
5626
|
let effectFlags = EffectFlags.none;
|
|
6032
5627
|
if (effectPoint.isKiai) {
|
|
@@ -6035,8 +5630,7 @@ class BeatmapControlPointsEncoder extends BeatmapBaseEncoder {
|
|
|
6035
5630
|
if (effectPoint.omitFirstBarLine) {
|
|
6036
5631
|
effectFlags |= EffectFlags.omitFirstBarLine;
|
|
6037
5632
|
}
|
|
6038
|
-
this.write(`${(group.timing
|
|
6039
|
-
this.map.controlPoints.timing.controlPointAt(group.time)).timeSignature},`);
|
|
5633
|
+
this.write(`${((_c = group.timing) !== null && _c !== void 0 ? _c : this.map.controlPoints.timing.controlPointAt(group.time)).timeSignature},`);
|
|
6040
5634
|
this.write(`${samplePoint.sampleBank.toString()},`);
|
|
6041
5635
|
this.write(`${samplePoint.customSampleBank.toString()},`);
|
|
6042
5636
|
this.write(`${samplePoint.sampleVolume.toString()},`);
|
|
@@ -6051,6 +5645,7 @@ class BeatmapControlPointsEncoder extends BeatmapBaseEncoder {
|
|
|
6051
5645
|
*/
|
|
6052
5646
|
class BeatmapDifficultyEncoder extends BeatmapBaseEncoder {
|
|
6053
5647
|
encodeInternal() {
|
|
5648
|
+
var _a;
|
|
6054
5649
|
if (this.encodeSections) {
|
|
6055
5650
|
this.writeLine("[Difficulty]");
|
|
6056
5651
|
}
|
|
@@ -6058,7 +5653,7 @@ class BeatmapDifficultyEncoder extends BeatmapBaseEncoder {
|
|
|
6058
5653
|
this.writeLine(`HPDrainRate: ${difficulty.hp}`);
|
|
6059
5654
|
this.writeLine(`CircleSize: ${difficulty.cs}`);
|
|
6060
5655
|
this.writeLine(`OverallDifficulty: ${difficulty.od}`);
|
|
6061
|
-
this.writeLine(`ApproachRate: ${difficulty.ar
|
|
5656
|
+
this.writeLine(`ApproachRate: ${(_a = difficulty.ar) !== null && _a !== void 0 ? _a : difficulty.od}`);
|
|
6062
5657
|
this.writeLine(`SliderMultiplier: ${difficulty.sliderMultiplier}`);
|
|
6063
5658
|
this.writeLine(`SliderTickRate: ${difficulty.sliderTickRate}`);
|
|
6064
5659
|
}
|
|
@@ -6087,10 +5682,6 @@ class BeatmapEditorEncoder extends BeatmapBaseEncoder {
|
|
|
6087
5682
|
* The base of per-section storyboard encoders.
|
|
6088
5683
|
*/
|
|
6089
5684
|
class StoryboardBaseEncoder extends BaseEncoder {
|
|
6090
|
-
/**
|
|
6091
|
-
* The storyboard that is being encoded.
|
|
6092
|
-
*/
|
|
6093
|
-
storyboard;
|
|
6094
5685
|
constructor(storyboard, encodeSections = true) {
|
|
6095
5686
|
super(encodeSections);
|
|
6096
5687
|
this.storyboard = storyboard;
|
|
@@ -6131,8 +5722,9 @@ class StoryboardEventsEncoder extends StoryboardBaseEncoder {
|
|
|
6131
5722
|
return str;
|
|
6132
5723
|
}
|
|
6133
5724
|
encodeLayer(layerType) {
|
|
5725
|
+
var _a;
|
|
6134
5726
|
const layer = this.storyboard.getLayer(layerType, false);
|
|
6135
|
-
for (const element of layer
|
|
5727
|
+
for (const element of (_a = layer === null || layer === void 0 ? void 0 : layer.elements) !== null && _a !== void 0 ? _a : []) {
|
|
6136
5728
|
// Checking for StoryboardAnimation first is mandatory as it extends StoryboardSprite.
|
|
6137
5729
|
if (element instanceof StoryboardAnimation) {
|
|
6138
5730
|
this.write(`${exports.StoryboardEventType.animation},`);
|
|
@@ -6280,11 +5872,10 @@ class StoryboardVariablesEncoder extends StoryboardBaseEncoder {
|
|
|
6280
5872
|
* original beatmap or storyboard file is not guaranteed (and usually will not be equal).
|
|
6281
5873
|
*/
|
|
6282
5874
|
class StoryboardEncoder extends Encoder {
|
|
6283
|
-
finalResult = "";
|
|
6284
|
-
encoders = [];
|
|
6285
|
-
encodeSections;
|
|
6286
5875
|
constructor(target, encodeSections = true) {
|
|
6287
5876
|
super(target);
|
|
5877
|
+
this.finalResult = "";
|
|
5878
|
+
this.encoders = [];
|
|
6288
5879
|
this.encodeSections = encodeSections;
|
|
6289
5880
|
}
|
|
6290
5881
|
reset() {
|
|
@@ -6437,11 +6028,12 @@ class BeatmapHitObjectsEncoder extends BeatmapBaseEncoder {
|
|
|
6437
6028
|
}
|
|
6438
6029
|
}
|
|
6439
6030
|
getSampleBank(samples, banksOnly = false) {
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6031
|
+
var _a, _b, _c, _d, _e;
|
|
6032
|
+
const normalBank = (_b = (_a = samples.find((s) => s instanceof BankHitSampleInfo &&
|
|
6033
|
+
s.name === BankHitSampleInfo.HIT_NORMAL)) === null || _a === void 0 ? void 0 : _a.bank) !== null && _b !== void 0 ? _b : exports.SampleBank.none;
|
|
6034
|
+
const addBank = (_d = (_c = samples.find((s) => s instanceof BankHitSampleInfo &&
|
|
6443
6035
|
s.name &&
|
|
6444
|
-
s.name !== BankHitSampleInfo.HIT_NORMAL)
|
|
6036
|
+
s.name !== BankHitSampleInfo.HIT_NORMAL)) === null || _c === void 0 ? void 0 : _c.bank) !== null && _d !== void 0 ? _d : exports.SampleBank.none;
|
|
6445
6037
|
let sampleBankString = `${normalBank}:${addBank}`;
|
|
6446
6038
|
if (!banksOnly) {
|
|
6447
6039
|
const firstSample = samples[0];
|
|
@@ -6449,7 +6041,7 @@ class BeatmapHitObjectsEncoder extends BeatmapBaseEncoder {
|
|
|
6449
6041
|
sampleBankString += `${firstSample instanceof BankHitSampleInfo
|
|
6450
6042
|
? firstSample.customSampleBank
|
|
6451
6043
|
: 0}:`;
|
|
6452
|
-
sampleBankString += `${firstSample
|
|
6044
|
+
sampleBankString += `${(_e = firstSample === null || firstSample === void 0 ? void 0 : firstSample.volume) !== null && _e !== void 0 ? _e : 100}:`;
|
|
6453
6045
|
if (firstSample instanceof FileHitSampleInfo) {
|
|
6454
6046
|
sampleBankString += `${this.sampleBankToString(exports.SampleBank.none)}-${firstSample.filename}`;
|
|
6455
6047
|
}
|
|
@@ -6471,6 +6063,7 @@ class BeatmapHitObjectsEncoder extends BeatmapBaseEncoder {
|
|
|
6471
6063
|
*/
|
|
6472
6064
|
class BeatmapMetadataEncoder extends BeatmapBaseEncoder {
|
|
6473
6065
|
encodeInternal() {
|
|
6066
|
+
var _a, _b;
|
|
6474
6067
|
if (this.encodeSections) {
|
|
6475
6068
|
this.writeLine("[Metadata]");
|
|
6476
6069
|
}
|
|
@@ -6491,10 +6084,10 @@ class BeatmapMetadataEncoder extends BeatmapBaseEncoder {
|
|
|
6491
6084
|
if (metadata.tags.length > 0) {
|
|
6492
6085
|
this.writeLine(`Tags: ${metadata.tags.join(" ")}`);
|
|
6493
6086
|
}
|
|
6494
|
-
if ((metadata.beatmapId
|
|
6087
|
+
if (((_a = metadata.beatmapId) !== null && _a !== void 0 ? _a : -1) > 0) {
|
|
6495
6088
|
this.writeLine(`BeatmapID: ${metadata.beatmapId}`);
|
|
6496
6089
|
}
|
|
6497
|
-
if ((metadata.beatmapSetId
|
|
6090
|
+
if (((_b = metadata.beatmapSetId) !== null && _b !== void 0 ? _b : -1) > 0) {
|
|
6498
6091
|
this.writeLine(`BeatmapSetID: ${metadata.beatmapSetId}`);
|
|
6499
6092
|
}
|
|
6500
6093
|
}
|
|
@@ -6507,8 +6100,11 @@ class BeatmapMetadataEncoder extends BeatmapBaseEncoder {
|
|
|
6507
6100
|
* original beatmap file is not guaranteed (and usually will not be equal).
|
|
6508
6101
|
*/
|
|
6509
6102
|
class BeatmapEncoder extends Encoder {
|
|
6510
|
-
|
|
6511
|
-
|
|
6103
|
+
constructor() {
|
|
6104
|
+
super(...arguments);
|
|
6105
|
+
this.encoders = [];
|
|
6106
|
+
this.latestVersion = 14;
|
|
6107
|
+
}
|
|
6512
6108
|
encodeInternal() {
|
|
6513
6109
|
this.writeLine(`osu file format v${this.latestVersion}`);
|
|
6514
6110
|
this.writeLine();
|
|
@@ -6805,29 +6401,63 @@ class Brent {
|
|
|
6805
6401
|
}
|
|
6806
6402
|
}
|
|
6807
6403
|
|
|
6404
|
+
/******************************************************************************
|
|
6405
|
+
Copyright (c) Microsoft Corporation.
|
|
6406
|
+
|
|
6407
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6408
|
+
purpose with or without fee is hereby granted.
|
|
6409
|
+
|
|
6410
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
6411
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
6412
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
6413
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
6414
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
6415
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
6416
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
6417
|
+
***************************************************************************** */
|
|
6418
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
6419
|
+
|
|
6420
|
+
|
|
6421
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
6422
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6423
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6424
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6425
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6426
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
6427
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
6428
|
+
});
|
|
6429
|
+
}
|
|
6430
|
+
|
|
6431
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
6432
|
+
var e = new Error(message);
|
|
6433
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
6434
|
+
};
|
|
6435
|
+
|
|
6808
6436
|
/**
|
|
6809
6437
|
* The base of API request builders.
|
|
6810
6438
|
*/
|
|
6811
6439
|
class APIRequestBuilder {
|
|
6812
|
-
|
|
6813
|
-
|
|
6814
|
-
|
|
6815
|
-
|
|
6816
|
-
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
|
|
6823
|
-
|
|
6440
|
+
constructor() {
|
|
6441
|
+
/**
|
|
6442
|
+
* Whether or not to include the API key in the request URL.
|
|
6443
|
+
*/
|
|
6444
|
+
this.requiresAPIkey = true;
|
|
6445
|
+
/**
|
|
6446
|
+
* The endpoint of this builder.
|
|
6447
|
+
*/
|
|
6448
|
+
this.endpoint = "";
|
|
6449
|
+
/**
|
|
6450
|
+
* The parameters of this builder.
|
|
6451
|
+
*/
|
|
6452
|
+
this.params = new Map();
|
|
6453
|
+
this.fetchAttempts = 0;
|
|
6454
|
+
}
|
|
6824
6455
|
/**
|
|
6825
6456
|
* The base URL of this builder.
|
|
6826
6457
|
*/
|
|
6827
6458
|
get baseURL() {
|
|
6828
6459
|
return this.host + this.endpoint;
|
|
6829
6460
|
}
|
|
6830
|
-
fetchAttempts = 0;
|
|
6831
6461
|
/**
|
|
6832
6462
|
* Sets the API endpoint.
|
|
6833
6463
|
*
|
|
@@ -6871,18 +6501,18 @@ class APIRequestBuilder {
|
|
|
6871
6501
|
return new Promise((resolve) => {
|
|
6872
6502
|
const url = this.buildURL();
|
|
6873
6503
|
fetch(url)
|
|
6874
|
-
.then(
|
|
6504
|
+
.then((res) => __awaiter(this, void 0, void 0, function* () {
|
|
6875
6505
|
++this.fetchAttempts;
|
|
6876
6506
|
if (res.status >= 500 && this.fetchAttempts < 5) {
|
|
6877
|
-
console.error(`Request to ${url} failed with the following error: ${
|
|
6507
|
+
console.error(`Request to ${url} failed with the following error: ${yield res.text()}; ${this.fetchAttempts} attempts so far; retrying`);
|
|
6878
6508
|
return resolve(this.sendRequest());
|
|
6879
6509
|
}
|
|
6880
6510
|
this.fetchAttempts = 0;
|
|
6881
6511
|
return resolve({
|
|
6882
|
-
data: Buffer.from(
|
|
6512
|
+
data: Buffer.from(yield res.arrayBuffer()),
|
|
6883
6513
|
statusCode: res.status,
|
|
6884
6514
|
});
|
|
6885
|
-
})
|
|
6515
|
+
}))
|
|
6886
6516
|
.catch((e) => {
|
|
6887
6517
|
console.error(`Request to ${url} failed with the following error: ${e.message}; ${this.fetchAttempts} attempts so far; aborting`);
|
|
6888
6518
|
this.fetchAttempts = 0;
|
|
@@ -6918,9 +6548,12 @@ class APIRequestBuilder {
|
|
|
6918
6548
|
* An API request builder for osu!droid.
|
|
6919
6549
|
*/
|
|
6920
6550
|
class DroidAPIRequestBuilder extends APIRequestBuilder {
|
|
6921
|
-
|
|
6922
|
-
|
|
6923
|
-
|
|
6551
|
+
constructor() {
|
|
6552
|
+
super(...arguments);
|
|
6553
|
+
this.host = "https://osudroid.moe/api/";
|
|
6554
|
+
this.APIkey = process.env.DROID_API_KEY;
|
|
6555
|
+
this.APIkeyParam = `apiKey=${this.APIkey}&`;
|
|
6556
|
+
}
|
|
6924
6557
|
buildURL() {
|
|
6925
6558
|
if (this.endpoint === "upload") {
|
|
6926
6559
|
let url = this.baseURL + "/";
|
|
@@ -7015,364 +6648,6 @@ class Polynomial {
|
|
|
7015
6648
|
* This class shares the same implementation as {@link https://numerics.mathdotnet.com/ Math.NET Numerics}.
|
|
7016
6649
|
*/
|
|
7017
6650
|
class ErrorFunction {
|
|
7018
|
-
//#region Coefficients for erfImp
|
|
7019
|
-
/**
|
|
7020
|
-
* Polynomial coefficients for a numerator of erfImp
|
|
7021
|
-
* calculation for erf(x) in the interval [1e-10, 0.5].
|
|
7022
|
-
*/
|
|
7023
|
-
static erfImpAn = [
|
|
7024
|
-
0.003379167095512574, -0.0007369565304816795, -0.37473233739291961,
|
|
7025
|
-
0.0817442448733587, -0.04210893199365486, 0.007016570951209576,
|
|
7026
|
-
-0.004950912559824351, 0.0008716465990379225,
|
|
7027
|
-
];
|
|
7028
|
-
/**
|
|
7029
|
-
* Polynomial coefficients for a denominator of erfImp
|
|
7030
|
-
* calculation for erf(x) in the interval [1e-10, 0.5].
|
|
7031
|
-
*/
|
|
7032
|
-
static erfImpAd = [
|
|
7033
|
-
1, -0.2180882180879246, 0.4125429727254421, -0.08418911478731068,
|
|
7034
|
-
0.0655338856400242, -0.01200196044549418, 0.00408165558926174,
|
|
7035
|
-
-0.0006159007215577697,
|
|
7036
|
-
];
|
|
7037
|
-
/**
|
|
7038
|
-
* Polynomial coefficients for a numerator in erfImp
|
|
7039
|
-
* calculationfor erfc(x) in the interval [0.5, 0.75].
|
|
7040
|
-
*/
|
|
7041
|
-
static erfImpBn = [
|
|
7042
|
-
-0.03617903907182625, 0.29225188344488268, 0.2814470417976045,
|
|
7043
|
-
0.12561020886276694, 0.02741350282689305, 0.002508396721680658,
|
|
7044
|
-
];
|
|
7045
|
-
/**
|
|
7046
|
-
* Polynomial coefficients for a denominator in erfImp
|
|
7047
|
-
* calculation for Erfc(x) in the interval [0.5, 0.75].
|
|
7048
|
-
*/
|
|
7049
|
-
static erfImpBd = [
|
|
7050
|
-
1, 1.8545005897903486, 1.43575803037831418, 0.58282765875303655,
|
|
7051
|
-
0.1248104769329497, 0.011372417654635328,
|
|
7052
|
-
];
|
|
7053
|
-
/**
|
|
7054
|
-
* Polynomial coefficients for a numerator in erfImp
|
|
7055
|
-
* calculation for erfc(x) in the interval [0.75, 1.25].
|
|
7056
|
-
*/
|
|
7057
|
-
static erfImpCn = [
|
|
7058
|
-
-0.03978768926111369, 0.15316521246787829, 0.19126029560093624,
|
|
7059
|
-
0.10276327061989304, 0.029637090615738836, 0.004609348678027549,
|
|
7060
|
-
0.0003076078203486802,
|
|
7061
|
-
];
|
|
7062
|
-
/**
|
|
7063
|
-
* Polynomial coefficients for a denominator in erfImp
|
|
7064
|
-
* calculation for erfc(x) in the interval [0.75, 1.25].
|
|
7065
|
-
*/
|
|
7066
|
-
static erfImpCd = [
|
|
7067
|
-
1, 1.955200729876277, 1.6476231719938486, 0.7682386070221263,
|
|
7068
|
-
0.20979318593650978, 0.03195693168999134, 0.0021336316089578537,
|
|
7069
|
-
];
|
|
7070
|
-
/**
|
|
7071
|
-
* Polynomial coefficients for a numerator in erfImp
|
|
7072
|
-
* calculation for erfc(x) in the interval [1.25, 2.25].
|
|
7073
|
-
*/
|
|
7074
|
-
static erfImpDn = [
|
|
7075
|
-
-0.030083856055794972, 0.05385788298444545, 0.07262115416519142,
|
|
7076
|
-
0.03676284698880493, 0.009646290155725275, 0.0013345348007529107,
|
|
7077
|
-
0.778087599782504e-4,
|
|
7078
|
-
];
|
|
7079
|
-
/**
|
|
7080
|
-
* Polynomial coefficients for a denominator in erfImp
|
|
7081
|
-
* calculation for erfc(x) in the interval [1.25, 2.25].
|
|
7082
|
-
*/
|
|
7083
|
-
static erfImpDd = [
|
|
7084
|
-
1, 1.7596709814716753, 1.3288357143796112, 0.5525285965087576,
|
|
7085
|
-
0.1337930569413329, 0.017950964517628076, 0.001047124400199374,
|
|
7086
|
-
-0.10664038182035734e-7,
|
|
7087
|
-
];
|
|
7088
|
-
/**
|
|
7089
|
-
* Polynomial coefficients for a numerator in erfImp
|
|
7090
|
-
* calculation for erfc(x) in the interval [2.25, 3.5].
|
|
7091
|
-
*/
|
|
7092
|
-
static erfImpEn = [
|
|
7093
|
-
-0.011790757013722784, 0.01426213209053881, 0.02022344359029608,
|
|
7094
|
-
0.00930668299990432, 0.0021335780242206599, 0.000250229873864601,
|
|
7095
|
-
0.1205349122195882e-4,
|
|
7096
|
-
];
|
|
7097
|
-
/**
|
|
7098
|
-
* Polynomial coefficients for a denominator in erfImp
|
|
7099
|
-
* calculation for erfc(x) in the interval [2.25, 3.5].
|
|
7100
|
-
*/
|
|
7101
|
-
static erfImpEd = [
|
|
7102
|
-
1, 1.5037622520362048, 0.9653977862044629, 0.3392652304767967,
|
|
7103
|
-
0.068974064954157, 0.0077106026249176831, 0.0003714211015310693,
|
|
7104
|
-
];
|
|
7105
|
-
/**
|
|
7106
|
-
* Polynomial coefficients for a numerator in erfImp
|
|
7107
|
-
* calculation for erfc(x) in the interval [3.5, 5.25].
|
|
7108
|
-
*/
|
|
7109
|
-
static erfImpFn = [
|
|
7110
|
-
-0.005469547955387293, 0.004041902787317071, 0.0054963369553161171,
|
|
7111
|
-
0.002126164726039454, 0.0003949840144950839, 0.36556547706444238e-4,
|
|
7112
|
-
0.13548589710993232e-5,
|
|
7113
|
-
];
|
|
7114
|
-
/**
|
|
7115
|
-
* Polynomial coefficients for a denominator in erfImp
|
|
7116
|
-
* calculation for erfc(x) in the interval [3.5, 5.25].
|
|
7117
|
-
*/
|
|
7118
|
-
static erfImpFd = [
|
|
7119
|
-
1, 1.210196977736308, 0.6209146682211439, 0.1730384306611428,
|
|
7120
|
-
0.0276550813773432, 0.002406259744243097, 0.8918118172513366e-4,
|
|
7121
|
-
-0.4655288362833827e-11,
|
|
7122
|
-
];
|
|
7123
|
-
/**
|
|
7124
|
-
* Polynomial coefficients for a numerator in erfImp
|
|
7125
|
-
* calculation for erfc(x) in the interval [5.25, 8].
|
|
7126
|
-
*/
|
|
7127
|
-
static erfImpGn = [
|
|
7128
|
-
-0.002707225359057783, 0.00131875634250294, 0.0011992593326100233,
|
|
7129
|
-
0.00027849619811344664, 0.2678229882183318e-4, 0.9230436723150282e-6,
|
|
7130
|
-
];
|
|
7131
|
-
/**
|
|
7132
|
-
* Polynomial coefficients for a denominator in erfImp
|
|
7133
|
-
* calculation for erfc(x) in the interval [5.25, 8].
|
|
7134
|
-
*/
|
|
7135
|
-
static erfImpGd = [
|
|
7136
|
-
1, 0.8146328085431416, 0.26890166585629954, 0.04498772161030411,
|
|
7137
|
-
0.003817596633202485, 0.0001315718978885969, 0.4048153596757641e-11,
|
|
7138
|
-
];
|
|
7139
|
-
/**
|
|
7140
|
-
* Polynomial coefficients for a numerator in erfImp
|
|
7141
|
-
* calculation for erfc(x) in the interval [8, 11.5].
|
|
7142
|
-
*/
|
|
7143
|
-
static erfImpHn = [
|
|
7144
|
-
-0.001099467206917422, 0.00040642544275042267, 0.0002744994894169007,
|
|
7145
|
-
0.4652937706466594e-4, 0.320955425395767463e-5, 0.778286018145021e-7,
|
|
7146
|
-
];
|
|
7147
|
-
/**
|
|
7148
|
-
* Polynomial coefficients for a denominator in erfImp
|
|
7149
|
-
* calculation for erfc(x) in the interval [8, 11.5].
|
|
7150
|
-
*/
|
|
7151
|
-
static erfImpHd = [
|
|
7152
|
-
1, 0.588173710611846, 0.13936333128940975, 0.016632934041708368,
|
|
7153
|
-
0.0010002392131023491, 0.2425483752158723e-4,
|
|
7154
|
-
];
|
|
7155
|
-
/**
|
|
7156
|
-
* Polynomial coefficients for a numerator in erfImp
|
|
7157
|
-
* calculation for erfc(x) in the interval [11.5, 17].
|
|
7158
|
-
*/
|
|
7159
|
-
static erfImpIn = [
|
|
7160
|
-
-0.0005690799360109496, 0.0001694985403737623, 0.5184723545811009e-4,
|
|
7161
|
-
0.38281931223192885e-5, 0.8249899312818944e-7,
|
|
7162
|
-
];
|
|
7163
|
-
/**
|
|
7164
|
-
* Polynomial coefficients for a denominator in erfImp
|
|
7165
|
-
* calculation for erfc(x) in the interval [11.5, 17].
|
|
7166
|
-
*/
|
|
7167
|
-
static erfImpId = [
|
|
7168
|
-
1, 0.3396372500511393, 0.04347264787031066, 0.002485493352246371,
|
|
7169
|
-
0.5356333053371529e-4, -0.11749094440545958e-12,
|
|
7170
|
-
];
|
|
7171
|
-
/**
|
|
7172
|
-
* Polynomial coefficients for a numerator in erfImp
|
|
7173
|
-
* calculation for erfc(x) in the interval [17, 24].
|
|
7174
|
-
*/
|
|
7175
|
-
static erfImpJn = [
|
|
7176
|
-
-0.000241313599483991337, 0.5742249752025015e-4, 0.11599896292738377e-4,
|
|
7177
|
-
0.581762134402594e-6, 0.8539715550856736e-8,
|
|
7178
|
-
];
|
|
7179
|
-
/**
|
|
7180
|
-
* Polynomial coefficients for a denominator in erfImp
|
|
7181
|
-
* calculation for erfc(x) in the interval [17, 24].
|
|
7182
|
-
*/
|
|
7183
|
-
static erfImpJd = [
|
|
7184
|
-
1, 0.23304413829968784, 0.02041869405464403, 0.0007971856475643983,
|
|
7185
|
-
0.11701928167017232e-4,
|
|
7186
|
-
];
|
|
7187
|
-
/**
|
|
7188
|
-
* Polynomial coefficients for a numerator in erfImp
|
|
7189
|
-
* calculation for erfc(x) in the interval [24, 38].
|
|
7190
|
-
*/
|
|
7191
|
-
static erfImpKn = [
|
|
7192
|
-
-0.00014667469927776036, 0.1626665521122805e-4, 0.26911624850916523e-5,
|
|
7193
|
-
0.979584479468092e-7, 0.10199464762572346e-8,
|
|
7194
|
-
];
|
|
7195
|
-
/**
|
|
7196
|
-
* Polynomial coefficients for a denominator in erfImp
|
|
7197
|
-
* calculation for erfc(x) in the interval [24, 38].
|
|
7198
|
-
*/
|
|
7199
|
-
static erfImpKd = [
|
|
7200
|
-
1, 0.16590781294484722, 0.010336171619150588, 0.0002865930263738684,
|
|
7201
|
-
0.29840157084090034e-5,
|
|
7202
|
-
];
|
|
7203
|
-
/**
|
|
7204
|
-
* Polynomial coefficients for a numerator in erfImp
|
|
7205
|
-
* calculation for erfc(x) in the interval [38, 60].
|
|
7206
|
-
*/
|
|
7207
|
-
static erfImpLn = [
|
|
7208
|
-
-0.5839057976297718e-4, 0.4125103251054962e-5, 0.43179092242025094e-6,
|
|
7209
|
-
0.9933651555900132e-8, 0.653480510020105e-10,
|
|
7210
|
-
];
|
|
7211
|
-
/**
|
|
7212
|
-
* Polynomial coefficients for a denominator in erfImp
|
|
7213
|
-
* calculation for erfc(x) in the interval [38, 60].
|
|
7214
|
-
*/
|
|
7215
|
-
static erfImpLd = [
|
|
7216
|
-
1, 0.1050770860720399, 0.004142784286754756, 0.726338754644524e-4,
|
|
7217
|
-
0.477818471047398785e-6,
|
|
7218
|
-
];
|
|
7219
|
-
/**
|
|
7220
|
-
* Polynomial coefficients for a numerator in erfImp
|
|
7221
|
-
* calculation for erfc(x) in the interval [60, 85].
|
|
7222
|
-
*/
|
|
7223
|
-
static erfImpMn = [
|
|
7224
|
-
-0.196457797609229579e-4, 0.1572438876668007e-5, 0.5439025111927009e-7,
|
|
7225
|
-
0.3174724923691177e-9,
|
|
7226
|
-
];
|
|
7227
|
-
/**
|
|
7228
|
-
* Polynomial coefficients for a denominator in erfImp
|
|
7229
|
-
* calculation for erfc(x) in the interval [60, 85].
|
|
7230
|
-
*/
|
|
7231
|
-
static erfImpMd = [
|
|
7232
|
-
1, 0.05280398924095763, 0.0009268760691517533, 0.5410117232266303e-5,
|
|
7233
|
-
0.5350938458036424e-15,
|
|
7234
|
-
];
|
|
7235
|
-
/**
|
|
7236
|
-
* Polynomial coefficients for a numerator in erfImp
|
|
7237
|
-
* calculation for erfc(x) in the interval [85, 110].
|
|
7238
|
-
*/
|
|
7239
|
-
static erfImpNn = [
|
|
7240
|
-
-0.789224703978723e-5, 0.622088451660987e-6, 0.1457284456768824e-7,
|
|
7241
|
-
0.603715505542715e-10,
|
|
7242
|
-
];
|
|
7243
|
-
/**
|
|
7244
|
-
* Polynomial coefficients for a denominator in erfImp
|
|
7245
|
-
* calculation for erfc(x) in the interval [85, 110].
|
|
7246
|
-
*/
|
|
7247
|
-
static erfImpNd = [
|
|
7248
|
-
1, 0.037532884635629371, 0.0004679195359746253, 0.19384703927584565e-5,
|
|
7249
|
-
];
|
|
7250
|
-
//#endregion
|
|
7251
|
-
//#region Coefficients for erfInvImp
|
|
7252
|
-
/**
|
|
7253
|
-
* Polynomial coefficients for a numerator of erfInvImp
|
|
7254
|
-
* calculation for erf^-1(z) in the interval [0, 0.5].
|
|
7255
|
-
*/
|
|
7256
|
-
static ervInvImpAn = [
|
|
7257
|
-
-0.0005087819496582806, -0.0083687481974173677, 0.033480662540974461,
|
|
7258
|
-
-0.012692614766297402, -0.03656379714117627, 0.02198786811111689,
|
|
7259
|
-
0.008226878746769157, -0.005387729650712429,
|
|
7260
|
-
];
|
|
7261
|
-
/**
|
|
7262
|
-
* Polynomial coefficients for a denominator of erfInvImp
|
|
7263
|
-
* calculation for erf^-1(z) in the interval [0, 0.5].
|
|
7264
|
-
*/
|
|
7265
|
-
static ervInvImpAd = [
|
|
7266
|
-
1, -0.9700050433032906, -1.565745582341758, 1.5622155839842302,
|
|
7267
|
-
0.662328840472003, -0.7122890234154285, -0.05273963823400997,
|
|
7268
|
-
0.079528368734157168, -0.0023339375937419, 0.0008862163904564247,
|
|
7269
|
-
];
|
|
7270
|
-
/**
|
|
7271
|
-
* Polynomial coefficients for a numerator of erfInvImp
|
|
7272
|
-
* calculation for erf^-1(z) in the interval [0.5, 0.75].
|
|
7273
|
-
*/
|
|
7274
|
-
static ervInvImpBn = [
|
|
7275
|
-
-0.2024335083559388, 0.10526468069939171, 8.3705032834312,
|
|
7276
|
-
17.6447298408374, -18.85106480587143, -44.6382324441787,
|
|
7277
|
-
17.445385985570866, 21.12946554483405, -3.671922547077293,
|
|
7278
|
-
];
|
|
7279
|
-
/**
|
|
7280
|
-
* Polynomial coefficients for a denominator of erfInvImp
|
|
7281
|
-
* calculation for erf^-1(z) in the interval [0.5, 0.75].
|
|
7282
|
-
*/
|
|
7283
|
-
static ervInvImpBd = [
|
|
7284
|
-
1, 6.24264124854247537, 3.9713437953343869, -28.66081804998,
|
|
7285
|
-
-20.14326346804852, 48.56092131087399, 10.82686673554602,
|
|
7286
|
-
-22.64369334131397, 1.7211476576120028,
|
|
7287
|
-
];
|
|
7288
|
-
/**
|
|
7289
|
-
* Polynomial coefficients for a numerator of erfInvImp
|
|
7290
|
-
* calculation for erf^-1(z) in the interval [0.75, 1] with x less than 3.
|
|
7291
|
-
*/
|
|
7292
|
-
static ervInvImpCn = [
|
|
7293
|
-
-0.1311027816799519, -0.1637940471933171, 0.11703015634199525,
|
|
7294
|
-
0.387079738972604337, 0.3377855389120359, 0.1428695344081572,
|
|
7295
|
-
0.029015791000532906, 0.002145589953888053, -0.6794655751811264e-6,
|
|
7296
|
-
0.2852253317822171e-7, -0.681149956853777e-9,
|
|
7297
|
-
];
|
|
7298
|
-
/**
|
|
7299
|
-
* Polynomial coefficients for a denominator of erfInvImp
|
|
7300
|
-
* calculation for erf^-1(z) in the interval [0.75, 1] with x less than 3.
|
|
7301
|
-
*/
|
|
7302
|
-
static ervInvImpCd = [
|
|
7303
|
-
1, 3.466254072425672, 5.381683457070069, 4.778465929458438,
|
|
7304
|
-
2.5930192162362027, 0.848854343457902, 0.1522643382953318,
|
|
7305
|
-
0.01105924229346489,
|
|
7306
|
-
];
|
|
7307
|
-
/**
|
|
7308
|
-
* Polynomial coefficients for a numerator of erfInvImp
|
|
7309
|
-
* calculation for erf^-1(z) in the interval [0.75, 1] with x between 3 and 6.
|
|
7310
|
-
*/
|
|
7311
|
-
static ervInvImpDn = [
|
|
7312
|
-
-0.0350353787183178, -0.002224265292134479, 0.018557330651423107,
|
|
7313
|
-
0.009508047013259196, 0.001871234928195592, 0.00015754461742496055,
|
|
7314
|
-
0.460469890584318e-5, -0.2304047769118826e-9, 0.266339227425782e-11,
|
|
7315
|
-
];
|
|
7316
|
-
/**
|
|
7317
|
-
* Polynomial coefficients for a denominator of erfInvImp
|
|
7318
|
-
* calculation for erf^-1(z) in the interval [0.75, 1] with x between 3 and 6.
|
|
7319
|
-
*/
|
|
7320
|
-
static ervInvImpDd = [
|
|
7321
|
-
1, 1.365334981755406, 0.7620591645536234, 0.22009110576413124,
|
|
7322
|
-
0.03415891436709477, 0.00263861676657016, 0.7646752923027944e-4,
|
|
7323
|
-
];
|
|
7324
|
-
/**
|
|
7325
|
-
* Polynomial coefficients for a numerator of erfInvImp
|
|
7326
|
-
* calculation for erf^-1(z) in the interval [0.75, 1] with x between 6 and 18.
|
|
7327
|
-
*/
|
|
7328
|
-
static ervInvImpEn = [
|
|
7329
|
-
-0.016743100507663373, -0.001129514387455803, 0.001056288621524929,
|
|
7330
|
-
0.0002093863174875881, 0.14962478375834237e-4, 0.4496967899277065e-6,
|
|
7331
|
-
0.4625961635228786e-8, -0.281128735628831791e-13,
|
|
7332
|
-
0.9905570997331033e-16,
|
|
7333
|
-
];
|
|
7334
|
-
/**
|
|
7335
|
-
* Polynomial coefficients for a denominator of erfInvImp
|
|
7336
|
-
* calculation for erf^-1(z) in the interval [0.75, 1] with x between 6 and 18.
|
|
7337
|
-
*/
|
|
7338
|
-
static ervInvImpEd = [
|
|
7339
|
-
1, 0.5914293448864175, 0.1381518657490833, 0.01607460870936765,
|
|
7340
|
-
0.0009640118070051655, 0.275335474764726e-4, 0.282243172016108e-6,
|
|
7341
|
-
];
|
|
7342
|
-
/**
|
|
7343
|
-
* Polynomial coefficients for a numerator of erfInvImp
|
|
7344
|
-
* calculation for erf^-1(z) in the interval [0.75, 1] with x between 18 and 44.
|
|
7345
|
-
*/
|
|
7346
|
-
static ervInvImpFn = [
|
|
7347
|
-
-0.0024978212791898131, -0.779190719229054e-5, 0.2547230374130275e-4,
|
|
7348
|
-
0.1623977773425109e-5, 0.3963410113048011685e-7, 0.4116328311909442e-9,
|
|
7349
|
-
0.145596286718675e-11, -0.11676501239718427e-17,
|
|
7350
|
-
];
|
|
7351
|
-
/**
|
|
7352
|
-
* Polynomial coefficients for a denominator of erfInvImp
|
|
7353
|
-
* calculation for erf^-1(z) in the interval [0.75, 1] with x between 18 and 44.
|
|
7354
|
-
*/
|
|
7355
|
-
static ervInvImpFd = [
|
|
7356
|
-
1, 0.20712311221442251, 0.01694108381209759, 0.0006905382656226846,
|
|
7357
|
-
0.14500735981823264e-4, 0.14443775662814415e-6, 0.5097612765997785e-9,
|
|
7358
|
-
];
|
|
7359
|
-
/**
|
|
7360
|
-
* Polynomial coefficients for a numerator of erfInvImp
|
|
7361
|
-
* calculation for erf^-1(z) in the interval [0.75, 1] with x greater than 44.
|
|
7362
|
-
*/
|
|
7363
|
-
static ervInvImpGn = [
|
|
7364
|
-
-0.0005390429110190786, -0.2839875900472772e-6, 0.8994651148922914e-6,
|
|
7365
|
-
0.2293458592659209e-7, 0.2255614448635001e-9, 0.9478466275030226e-12,
|
|
7366
|
-
0.13588013010892486e-14, -0.3488903933999489e-21,
|
|
7367
|
-
];
|
|
7368
|
-
/**
|
|
7369
|
-
* Polynomial coefficients for a denominator of erfInvImp
|
|
7370
|
-
* calculation for erf^-1(z) in the interval [0.75, 1] with x greater than 44.
|
|
7371
|
-
*/
|
|
7372
|
-
static ervInvImpGd = [
|
|
7373
|
-
1, 0.08457462340018994, 0.002820929847262647, 0.4682929219408942e-4,
|
|
7374
|
-
0.3999688121938621e-6, 0.1618092908879045e-8, 0.2315586083102596e-11,
|
|
7375
|
-
];
|
|
7376
6651
|
//#endregion
|
|
7377
6652
|
//#region Evaluations
|
|
7378
6653
|
/**
|
|
@@ -7754,6 +7029,364 @@ class ErrorFunction {
|
|
|
7754
7029
|
return s * result;
|
|
7755
7030
|
}
|
|
7756
7031
|
}
|
|
7032
|
+
//#region Coefficients for erfImp
|
|
7033
|
+
/**
|
|
7034
|
+
* Polynomial coefficients for a numerator of erfImp
|
|
7035
|
+
* calculation for erf(x) in the interval [1e-10, 0.5].
|
|
7036
|
+
*/
|
|
7037
|
+
ErrorFunction.erfImpAn = [
|
|
7038
|
+
0.003379167095512574, -0.0007369565304816795, -0.37473233739291961,
|
|
7039
|
+
0.0817442448733587, -0.04210893199365486, 0.007016570951209576,
|
|
7040
|
+
-0.004950912559824351, 0.0008716465990379225,
|
|
7041
|
+
];
|
|
7042
|
+
/**
|
|
7043
|
+
* Polynomial coefficients for a denominator of erfImp
|
|
7044
|
+
* calculation for erf(x) in the interval [1e-10, 0.5].
|
|
7045
|
+
*/
|
|
7046
|
+
ErrorFunction.erfImpAd = [
|
|
7047
|
+
1, -0.2180882180879246, 0.4125429727254421, -0.08418911478731068,
|
|
7048
|
+
0.0655338856400242, -0.01200196044549418, 0.00408165558926174,
|
|
7049
|
+
-0.0006159007215577697,
|
|
7050
|
+
];
|
|
7051
|
+
/**
|
|
7052
|
+
* Polynomial coefficients for a numerator in erfImp
|
|
7053
|
+
* calculationfor erfc(x) in the interval [0.5, 0.75].
|
|
7054
|
+
*/
|
|
7055
|
+
ErrorFunction.erfImpBn = [
|
|
7056
|
+
-0.03617903907182625, 0.29225188344488268, 0.2814470417976045,
|
|
7057
|
+
0.12561020886276694, 0.02741350282689305, 0.002508396721680658,
|
|
7058
|
+
];
|
|
7059
|
+
/**
|
|
7060
|
+
* Polynomial coefficients for a denominator in erfImp
|
|
7061
|
+
* calculation for Erfc(x) in the interval [0.5, 0.75].
|
|
7062
|
+
*/
|
|
7063
|
+
ErrorFunction.erfImpBd = [
|
|
7064
|
+
1, 1.8545005897903486, 1.43575803037831418, 0.58282765875303655,
|
|
7065
|
+
0.1248104769329497, 0.011372417654635328,
|
|
7066
|
+
];
|
|
7067
|
+
/**
|
|
7068
|
+
* Polynomial coefficients for a numerator in erfImp
|
|
7069
|
+
* calculation for erfc(x) in the interval [0.75, 1.25].
|
|
7070
|
+
*/
|
|
7071
|
+
ErrorFunction.erfImpCn = [
|
|
7072
|
+
-0.03978768926111369, 0.15316521246787829, 0.19126029560093624,
|
|
7073
|
+
0.10276327061989304, 0.029637090615738836, 0.004609348678027549,
|
|
7074
|
+
0.0003076078203486802,
|
|
7075
|
+
];
|
|
7076
|
+
/**
|
|
7077
|
+
* Polynomial coefficients for a denominator in erfImp
|
|
7078
|
+
* calculation for erfc(x) in the interval [0.75, 1.25].
|
|
7079
|
+
*/
|
|
7080
|
+
ErrorFunction.erfImpCd = [
|
|
7081
|
+
1, 1.955200729876277, 1.6476231719938486, 0.7682386070221263,
|
|
7082
|
+
0.20979318593650978, 0.03195693168999134, 0.0021336316089578537,
|
|
7083
|
+
];
|
|
7084
|
+
/**
|
|
7085
|
+
* Polynomial coefficients for a numerator in erfImp
|
|
7086
|
+
* calculation for erfc(x) in the interval [1.25, 2.25].
|
|
7087
|
+
*/
|
|
7088
|
+
ErrorFunction.erfImpDn = [
|
|
7089
|
+
-0.030083856055794972, 0.05385788298444545, 0.07262115416519142,
|
|
7090
|
+
0.03676284698880493, 0.009646290155725275, 0.0013345348007529107,
|
|
7091
|
+
0.778087599782504e-4,
|
|
7092
|
+
];
|
|
7093
|
+
/**
|
|
7094
|
+
* Polynomial coefficients for a denominator in erfImp
|
|
7095
|
+
* calculation for erfc(x) in the interval [1.25, 2.25].
|
|
7096
|
+
*/
|
|
7097
|
+
ErrorFunction.erfImpDd = [
|
|
7098
|
+
1, 1.7596709814716753, 1.3288357143796112, 0.5525285965087576,
|
|
7099
|
+
0.1337930569413329, 0.017950964517628076, 0.001047124400199374,
|
|
7100
|
+
-0.10664038182035734e-7,
|
|
7101
|
+
];
|
|
7102
|
+
/**
|
|
7103
|
+
* Polynomial coefficients for a numerator in erfImp
|
|
7104
|
+
* calculation for erfc(x) in the interval [2.25, 3.5].
|
|
7105
|
+
*/
|
|
7106
|
+
ErrorFunction.erfImpEn = [
|
|
7107
|
+
-0.011790757013722784, 0.01426213209053881, 0.02022344359029608,
|
|
7108
|
+
0.00930668299990432, 0.0021335780242206599, 0.000250229873864601,
|
|
7109
|
+
0.1205349122195882e-4,
|
|
7110
|
+
];
|
|
7111
|
+
/**
|
|
7112
|
+
* Polynomial coefficients for a denominator in erfImp
|
|
7113
|
+
* calculation for erfc(x) in the interval [2.25, 3.5].
|
|
7114
|
+
*/
|
|
7115
|
+
ErrorFunction.erfImpEd = [
|
|
7116
|
+
1, 1.5037622520362048, 0.9653977862044629, 0.3392652304767967,
|
|
7117
|
+
0.068974064954157, 0.0077106026249176831, 0.0003714211015310693,
|
|
7118
|
+
];
|
|
7119
|
+
/**
|
|
7120
|
+
* Polynomial coefficients for a numerator in erfImp
|
|
7121
|
+
* calculation for erfc(x) in the interval [3.5, 5.25].
|
|
7122
|
+
*/
|
|
7123
|
+
ErrorFunction.erfImpFn = [
|
|
7124
|
+
-0.005469547955387293, 0.004041902787317071, 0.0054963369553161171,
|
|
7125
|
+
0.002126164726039454, 0.0003949840144950839, 0.36556547706444238e-4,
|
|
7126
|
+
0.13548589710993232e-5,
|
|
7127
|
+
];
|
|
7128
|
+
/**
|
|
7129
|
+
* Polynomial coefficients for a denominator in erfImp
|
|
7130
|
+
* calculation for erfc(x) in the interval [3.5, 5.25].
|
|
7131
|
+
*/
|
|
7132
|
+
ErrorFunction.erfImpFd = [
|
|
7133
|
+
1, 1.210196977736308, 0.6209146682211439, 0.1730384306611428,
|
|
7134
|
+
0.0276550813773432, 0.002406259744243097, 0.8918118172513366e-4,
|
|
7135
|
+
-0.4655288362833827e-11,
|
|
7136
|
+
];
|
|
7137
|
+
/**
|
|
7138
|
+
* Polynomial coefficients for a numerator in erfImp
|
|
7139
|
+
* calculation for erfc(x) in the interval [5.25, 8].
|
|
7140
|
+
*/
|
|
7141
|
+
ErrorFunction.erfImpGn = [
|
|
7142
|
+
-0.002707225359057783, 0.00131875634250294, 0.0011992593326100233,
|
|
7143
|
+
0.00027849619811344664, 0.2678229882183318e-4, 0.9230436723150282e-6,
|
|
7144
|
+
];
|
|
7145
|
+
/**
|
|
7146
|
+
* Polynomial coefficients for a denominator in erfImp
|
|
7147
|
+
* calculation for erfc(x) in the interval [5.25, 8].
|
|
7148
|
+
*/
|
|
7149
|
+
ErrorFunction.erfImpGd = [
|
|
7150
|
+
1, 0.8146328085431416, 0.26890166585629954, 0.04498772161030411,
|
|
7151
|
+
0.003817596633202485, 0.0001315718978885969, 0.4048153596757641e-11,
|
|
7152
|
+
];
|
|
7153
|
+
/**
|
|
7154
|
+
* Polynomial coefficients for a numerator in erfImp
|
|
7155
|
+
* calculation for erfc(x) in the interval [8, 11.5].
|
|
7156
|
+
*/
|
|
7157
|
+
ErrorFunction.erfImpHn = [
|
|
7158
|
+
-0.001099467206917422, 0.00040642544275042267, 0.0002744994894169007,
|
|
7159
|
+
0.4652937706466594e-4, 0.320955425395767463e-5, 0.778286018145021e-7,
|
|
7160
|
+
];
|
|
7161
|
+
/**
|
|
7162
|
+
* Polynomial coefficients for a denominator in erfImp
|
|
7163
|
+
* calculation for erfc(x) in the interval [8, 11.5].
|
|
7164
|
+
*/
|
|
7165
|
+
ErrorFunction.erfImpHd = [
|
|
7166
|
+
1, 0.588173710611846, 0.13936333128940975, 0.016632934041708368,
|
|
7167
|
+
0.0010002392131023491, 0.2425483752158723e-4,
|
|
7168
|
+
];
|
|
7169
|
+
/**
|
|
7170
|
+
* Polynomial coefficients for a numerator in erfImp
|
|
7171
|
+
* calculation for erfc(x) in the interval [11.5, 17].
|
|
7172
|
+
*/
|
|
7173
|
+
ErrorFunction.erfImpIn = [
|
|
7174
|
+
-0.0005690799360109496, 0.0001694985403737623, 0.5184723545811009e-4,
|
|
7175
|
+
0.38281931223192885e-5, 0.8249899312818944e-7,
|
|
7176
|
+
];
|
|
7177
|
+
/**
|
|
7178
|
+
* Polynomial coefficients for a denominator in erfImp
|
|
7179
|
+
* calculation for erfc(x) in the interval [11.5, 17].
|
|
7180
|
+
*/
|
|
7181
|
+
ErrorFunction.erfImpId = [
|
|
7182
|
+
1, 0.3396372500511393, 0.04347264787031066, 0.002485493352246371,
|
|
7183
|
+
0.5356333053371529e-4, -0.11749094440545958e-12,
|
|
7184
|
+
];
|
|
7185
|
+
/**
|
|
7186
|
+
* Polynomial coefficients for a numerator in erfImp
|
|
7187
|
+
* calculation for erfc(x) in the interval [17, 24].
|
|
7188
|
+
*/
|
|
7189
|
+
ErrorFunction.erfImpJn = [
|
|
7190
|
+
-0.000241313599483991337, 0.5742249752025015e-4, 0.11599896292738377e-4,
|
|
7191
|
+
0.581762134402594e-6, 0.8539715550856736e-8,
|
|
7192
|
+
];
|
|
7193
|
+
/**
|
|
7194
|
+
* Polynomial coefficients for a denominator in erfImp
|
|
7195
|
+
* calculation for erfc(x) in the interval [17, 24].
|
|
7196
|
+
*/
|
|
7197
|
+
ErrorFunction.erfImpJd = [
|
|
7198
|
+
1, 0.23304413829968784, 0.02041869405464403, 0.0007971856475643983,
|
|
7199
|
+
0.11701928167017232e-4,
|
|
7200
|
+
];
|
|
7201
|
+
/**
|
|
7202
|
+
* Polynomial coefficients for a numerator in erfImp
|
|
7203
|
+
* calculation for erfc(x) in the interval [24, 38].
|
|
7204
|
+
*/
|
|
7205
|
+
ErrorFunction.erfImpKn = [
|
|
7206
|
+
-0.00014667469927776036, 0.1626665521122805e-4, 0.26911624850916523e-5,
|
|
7207
|
+
0.979584479468092e-7, 0.10199464762572346e-8,
|
|
7208
|
+
];
|
|
7209
|
+
/**
|
|
7210
|
+
* Polynomial coefficients for a denominator in erfImp
|
|
7211
|
+
* calculation for erfc(x) in the interval [24, 38].
|
|
7212
|
+
*/
|
|
7213
|
+
ErrorFunction.erfImpKd = [
|
|
7214
|
+
1, 0.16590781294484722, 0.010336171619150588, 0.0002865930263738684,
|
|
7215
|
+
0.29840157084090034e-5,
|
|
7216
|
+
];
|
|
7217
|
+
/**
|
|
7218
|
+
* Polynomial coefficients for a numerator in erfImp
|
|
7219
|
+
* calculation for erfc(x) in the interval [38, 60].
|
|
7220
|
+
*/
|
|
7221
|
+
ErrorFunction.erfImpLn = [
|
|
7222
|
+
-0.5839057976297718e-4, 0.4125103251054962e-5, 0.43179092242025094e-6,
|
|
7223
|
+
0.9933651555900132e-8, 0.653480510020105e-10,
|
|
7224
|
+
];
|
|
7225
|
+
/**
|
|
7226
|
+
* Polynomial coefficients for a denominator in erfImp
|
|
7227
|
+
* calculation for erfc(x) in the interval [38, 60].
|
|
7228
|
+
*/
|
|
7229
|
+
ErrorFunction.erfImpLd = [
|
|
7230
|
+
1, 0.1050770860720399, 0.004142784286754756, 0.726338754644524e-4,
|
|
7231
|
+
0.477818471047398785e-6,
|
|
7232
|
+
];
|
|
7233
|
+
/**
|
|
7234
|
+
* Polynomial coefficients for a numerator in erfImp
|
|
7235
|
+
* calculation for erfc(x) in the interval [60, 85].
|
|
7236
|
+
*/
|
|
7237
|
+
ErrorFunction.erfImpMn = [
|
|
7238
|
+
-0.196457797609229579e-4, 0.1572438876668007e-5, 0.5439025111927009e-7,
|
|
7239
|
+
0.3174724923691177e-9,
|
|
7240
|
+
];
|
|
7241
|
+
/**
|
|
7242
|
+
* Polynomial coefficients for a denominator in erfImp
|
|
7243
|
+
* calculation for erfc(x) in the interval [60, 85].
|
|
7244
|
+
*/
|
|
7245
|
+
ErrorFunction.erfImpMd = [
|
|
7246
|
+
1, 0.05280398924095763, 0.0009268760691517533, 0.5410117232266303e-5,
|
|
7247
|
+
0.5350938458036424e-15,
|
|
7248
|
+
];
|
|
7249
|
+
/**
|
|
7250
|
+
* Polynomial coefficients for a numerator in erfImp
|
|
7251
|
+
* calculation for erfc(x) in the interval [85, 110].
|
|
7252
|
+
*/
|
|
7253
|
+
ErrorFunction.erfImpNn = [
|
|
7254
|
+
-0.789224703978723e-5, 0.622088451660987e-6, 0.1457284456768824e-7,
|
|
7255
|
+
0.603715505542715e-10,
|
|
7256
|
+
];
|
|
7257
|
+
/**
|
|
7258
|
+
* Polynomial coefficients for a denominator in erfImp
|
|
7259
|
+
* calculation for erfc(x) in the interval [85, 110].
|
|
7260
|
+
*/
|
|
7261
|
+
ErrorFunction.erfImpNd = [
|
|
7262
|
+
1, 0.037532884635629371, 0.0004679195359746253, 0.19384703927584565e-5,
|
|
7263
|
+
];
|
|
7264
|
+
//#endregion
|
|
7265
|
+
//#region Coefficients for erfInvImp
|
|
7266
|
+
/**
|
|
7267
|
+
* Polynomial coefficients for a numerator of erfInvImp
|
|
7268
|
+
* calculation for erf^-1(z) in the interval [0, 0.5].
|
|
7269
|
+
*/
|
|
7270
|
+
ErrorFunction.ervInvImpAn = [
|
|
7271
|
+
-0.0005087819496582806, -0.0083687481974173677, 0.033480662540974461,
|
|
7272
|
+
-0.012692614766297402, -0.03656379714117627, 0.02198786811111689,
|
|
7273
|
+
0.008226878746769157, -0.005387729650712429,
|
|
7274
|
+
];
|
|
7275
|
+
/**
|
|
7276
|
+
* Polynomial coefficients for a denominator of erfInvImp
|
|
7277
|
+
* calculation for erf^-1(z) in the interval [0, 0.5].
|
|
7278
|
+
*/
|
|
7279
|
+
ErrorFunction.ervInvImpAd = [
|
|
7280
|
+
1, -0.9700050433032906, -1.565745582341758, 1.5622155839842302,
|
|
7281
|
+
0.662328840472003, -0.7122890234154285, -0.05273963823400997,
|
|
7282
|
+
0.079528368734157168, -0.0023339375937419, 0.0008862163904564247,
|
|
7283
|
+
];
|
|
7284
|
+
/**
|
|
7285
|
+
* Polynomial coefficients for a numerator of erfInvImp
|
|
7286
|
+
* calculation for erf^-1(z) in the interval [0.5, 0.75].
|
|
7287
|
+
*/
|
|
7288
|
+
ErrorFunction.ervInvImpBn = [
|
|
7289
|
+
-0.2024335083559388, 0.10526468069939171, 8.3705032834312,
|
|
7290
|
+
17.6447298408374, -18.85106480587143, -44.6382324441787,
|
|
7291
|
+
17.445385985570866, 21.12946554483405, -3.671922547077293,
|
|
7292
|
+
];
|
|
7293
|
+
/**
|
|
7294
|
+
* Polynomial coefficients for a denominator of erfInvImp
|
|
7295
|
+
* calculation for erf^-1(z) in the interval [0.5, 0.75].
|
|
7296
|
+
*/
|
|
7297
|
+
ErrorFunction.ervInvImpBd = [
|
|
7298
|
+
1, 6.24264124854247537, 3.9713437953343869, -28.66081804998,
|
|
7299
|
+
-20.14326346804852, 48.56092131087399, 10.82686673554602,
|
|
7300
|
+
-22.64369334131397, 1.7211476576120028,
|
|
7301
|
+
];
|
|
7302
|
+
/**
|
|
7303
|
+
* Polynomial coefficients for a numerator of erfInvImp
|
|
7304
|
+
* calculation for erf^-1(z) in the interval [0.75, 1] with x less than 3.
|
|
7305
|
+
*/
|
|
7306
|
+
ErrorFunction.ervInvImpCn = [
|
|
7307
|
+
-0.1311027816799519, -0.1637940471933171, 0.11703015634199525,
|
|
7308
|
+
0.387079738972604337, 0.3377855389120359, 0.1428695344081572,
|
|
7309
|
+
0.029015791000532906, 0.002145589953888053, -0.6794655751811264e-6,
|
|
7310
|
+
0.2852253317822171e-7, -0.681149956853777e-9,
|
|
7311
|
+
];
|
|
7312
|
+
/**
|
|
7313
|
+
* Polynomial coefficients for a denominator of erfInvImp
|
|
7314
|
+
* calculation for erf^-1(z) in the interval [0.75, 1] with x less than 3.
|
|
7315
|
+
*/
|
|
7316
|
+
ErrorFunction.ervInvImpCd = [
|
|
7317
|
+
1, 3.466254072425672, 5.381683457070069, 4.778465929458438,
|
|
7318
|
+
2.5930192162362027, 0.848854343457902, 0.1522643382953318,
|
|
7319
|
+
0.01105924229346489,
|
|
7320
|
+
];
|
|
7321
|
+
/**
|
|
7322
|
+
* Polynomial coefficients for a numerator of erfInvImp
|
|
7323
|
+
* calculation for erf^-1(z) in the interval [0.75, 1] with x between 3 and 6.
|
|
7324
|
+
*/
|
|
7325
|
+
ErrorFunction.ervInvImpDn = [
|
|
7326
|
+
-0.0350353787183178, -0.002224265292134479, 0.018557330651423107,
|
|
7327
|
+
0.009508047013259196, 0.001871234928195592, 0.00015754461742496055,
|
|
7328
|
+
0.460469890584318e-5, -0.2304047769118826e-9, 0.266339227425782e-11,
|
|
7329
|
+
];
|
|
7330
|
+
/**
|
|
7331
|
+
* Polynomial coefficients for a denominator of erfInvImp
|
|
7332
|
+
* calculation for erf^-1(z) in the interval [0.75, 1] with x between 3 and 6.
|
|
7333
|
+
*/
|
|
7334
|
+
ErrorFunction.ervInvImpDd = [
|
|
7335
|
+
1, 1.365334981755406, 0.7620591645536234, 0.22009110576413124,
|
|
7336
|
+
0.03415891436709477, 0.00263861676657016, 0.7646752923027944e-4,
|
|
7337
|
+
];
|
|
7338
|
+
/**
|
|
7339
|
+
* Polynomial coefficients for a numerator of erfInvImp
|
|
7340
|
+
* calculation for erf^-1(z) in the interval [0.75, 1] with x between 6 and 18.
|
|
7341
|
+
*/
|
|
7342
|
+
ErrorFunction.ervInvImpEn = [
|
|
7343
|
+
-0.016743100507663373, -0.001129514387455803, 0.001056288621524929,
|
|
7344
|
+
0.0002093863174875881, 0.14962478375834237e-4, 0.4496967899277065e-6,
|
|
7345
|
+
0.4625961635228786e-8, -0.281128735628831791e-13,
|
|
7346
|
+
0.9905570997331033e-16,
|
|
7347
|
+
];
|
|
7348
|
+
/**
|
|
7349
|
+
* Polynomial coefficients for a denominator of erfInvImp
|
|
7350
|
+
* calculation for erf^-1(z) in the interval [0.75, 1] with x between 6 and 18.
|
|
7351
|
+
*/
|
|
7352
|
+
ErrorFunction.ervInvImpEd = [
|
|
7353
|
+
1, 0.5914293448864175, 0.1381518657490833, 0.01607460870936765,
|
|
7354
|
+
0.0009640118070051655, 0.275335474764726e-4, 0.282243172016108e-6,
|
|
7355
|
+
];
|
|
7356
|
+
/**
|
|
7357
|
+
* Polynomial coefficients for a numerator of erfInvImp
|
|
7358
|
+
* calculation for erf^-1(z) in the interval [0.75, 1] with x between 18 and 44.
|
|
7359
|
+
*/
|
|
7360
|
+
ErrorFunction.ervInvImpFn = [
|
|
7361
|
+
-0.0024978212791898131, -0.779190719229054e-5, 0.2547230374130275e-4,
|
|
7362
|
+
0.1623977773425109e-5, 0.3963410113048011685e-7, 0.4116328311909442e-9,
|
|
7363
|
+
0.145596286718675e-11, -0.11676501239718427e-17,
|
|
7364
|
+
];
|
|
7365
|
+
/**
|
|
7366
|
+
* Polynomial coefficients for a denominator of erfInvImp
|
|
7367
|
+
* calculation for erf^-1(z) in the interval [0.75, 1] with x between 18 and 44.
|
|
7368
|
+
*/
|
|
7369
|
+
ErrorFunction.ervInvImpFd = [
|
|
7370
|
+
1, 0.20712311221442251, 0.01694108381209759, 0.0006905382656226846,
|
|
7371
|
+
0.14500735981823264e-4, 0.14443775662814415e-6, 0.5097612765997785e-9,
|
|
7372
|
+
];
|
|
7373
|
+
/**
|
|
7374
|
+
* Polynomial coefficients for a numerator of erfInvImp
|
|
7375
|
+
* calculation for erf^-1(z) in the interval [0.75, 1] with x greater than 44.
|
|
7376
|
+
*/
|
|
7377
|
+
ErrorFunction.ervInvImpGn = [
|
|
7378
|
+
-0.0005390429110190786, -0.2839875900472772e-6, 0.8994651148922914e-6,
|
|
7379
|
+
0.2293458592659209e-7, 0.2255614448635001e-9, 0.9478466275030226e-12,
|
|
7380
|
+
0.13588013010892486e-14, -0.3488903933999489e-21,
|
|
7381
|
+
];
|
|
7382
|
+
/**
|
|
7383
|
+
* Polynomial coefficients for a denominator of erfInvImp
|
|
7384
|
+
* calculation for erf^-1(z) in the interval [0.75, 1] with x greater than 44.
|
|
7385
|
+
*/
|
|
7386
|
+
ErrorFunction.ervInvImpGd = [
|
|
7387
|
+
1, 0.08457462340018994, 0.002820929847262647, 0.4682929219408942e-4,
|
|
7388
|
+
0.3999688121938621e-6, 0.1618092908879045e-8, 0.2315586083102596e-11,
|
|
7389
|
+
];
|
|
7757
7390
|
|
|
7758
7391
|
/**
|
|
7759
7392
|
* Holds interpolation methods for numbers.
|
|
@@ -7776,187 +7409,193 @@ class Interpolation {
|
|
|
7776
7409
|
* An API request builder for osu!standard.
|
|
7777
7410
|
*/
|
|
7778
7411
|
class OsuAPIRequestBuilder extends APIRequestBuilder {
|
|
7779
|
-
|
|
7780
|
-
|
|
7781
|
-
|
|
7412
|
+
constructor() {
|
|
7413
|
+
super(...arguments);
|
|
7414
|
+
this.host = "https://osu.ppy.sh/api/";
|
|
7415
|
+
this.APIkey = process.env.OSU_API_KEY;
|
|
7416
|
+
this.APIkeyParam = `k=${this.APIkey}&`;
|
|
7417
|
+
}
|
|
7782
7418
|
}
|
|
7783
7419
|
|
|
7784
7420
|
/**
|
|
7785
7421
|
* Represents a beatmap with general information.
|
|
7786
7422
|
*/
|
|
7787
7423
|
class MapInfo {
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
|
|
7791
|
-
|
|
7424
|
+
constructor() {
|
|
7425
|
+
/**
|
|
7426
|
+
* The title of the song of the beatmap.
|
|
7427
|
+
*/
|
|
7428
|
+
this.title = "";
|
|
7429
|
+
/**
|
|
7430
|
+
* The artist of the song of the beatmap.
|
|
7431
|
+
*/
|
|
7432
|
+
this.artist = "";
|
|
7433
|
+
/**
|
|
7434
|
+
* The creator of the beatmap.
|
|
7435
|
+
*/
|
|
7436
|
+
this.creator = "";
|
|
7437
|
+
/**
|
|
7438
|
+
* The user ID of the creator of the beatmap.
|
|
7439
|
+
*/
|
|
7440
|
+
this.creatorId = 0;
|
|
7441
|
+
/**
|
|
7442
|
+
* The difficulty name of the beatmap.
|
|
7443
|
+
*/
|
|
7444
|
+
this.version = "";
|
|
7445
|
+
/**
|
|
7446
|
+
* The source of the song, if any.
|
|
7447
|
+
*/
|
|
7448
|
+
this.source = "";
|
|
7449
|
+
/**
|
|
7450
|
+
* The ranking status of the beatmap.
|
|
7451
|
+
*/
|
|
7452
|
+
this.approved = 0;
|
|
7453
|
+
/**
|
|
7454
|
+
* The ID of the beatmap.
|
|
7455
|
+
*/
|
|
7456
|
+
this.beatmapId = 0;
|
|
7457
|
+
/**
|
|
7458
|
+
* The ID of the beatmapset containing the beatmap.
|
|
7459
|
+
*/
|
|
7460
|
+
this.beatmapSetId = 0;
|
|
7461
|
+
/**
|
|
7462
|
+
* The amount of times the beatmap has been played.
|
|
7463
|
+
*/
|
|
7464
|
+
this.plays = 0;
|
|
7465
|
+
/**
|
|
7466
|
+
* The amount of times this beatmap has been passed.
|
|
7467
|
+
*/
|
|
7468
|
+
this.passes = 0;
|
|
7469
|
+
/**
|
|
7470
|
+
* The amount of times the beatmap has been favorited.
|
|
7471
|
+
*/
|
|
7472
|
+
this.favorites = 0;
|
|
7473
|
+
/**
|
|
7474
|
+
* The user rating of this beatmap.
|
|
7475
|
+
*/
|
|
7476
|
+
this.rating = 0;
|
|
7477
|
+
/**
|
|
7478
|
+
* The date of which the beatmap was submitted.
|
|
7479
|
+
*/
|
|
7480
|
+
this.submitDate = new Date(0);
|
|
7481
|
+
/**
|
|
7482
|
+
* The date of which this beatmap was approved.
|
|
7483
|
+
*/
|
|
7484
|
+
this.approvedDate = null;
|
|
7485
|
+
/**
|
|
7486
|
+
* The date of which the beatmap was last updated.
|
|
7487
|
+
*/
|
|
7488
|
+
this.lastUpdate = new Date(0);
|
|
7489
|
+
/**
|
|
7490
|
+
* The duration of the beatmap not including breaks.
|
|
7491
|
+
*/
|
|
7492
|
+
this.hitLength = 0;
|
|
7493
|
+
/**
|
|
7494
|
+
* The duration of the beatmap including breaks.
|
|
7495
|
+
*/
|
|
7496
|
+
this.totalLength = 0;
|
|
7497
|
+
/**
|
|
7498
|
+
* The genre of this beatmap.
|
|
7499
|
+
*/
|
|
7500
|
+
this.genre = exports.BeatmapGenre.any;
|
|
7501
|
+
/**
|
|
7502
|
+
* The language of this beatmap.
|
|
7503
|
+
*/
|
|
7504
|
+
this.language = exports.BeatmapLanguage.any;
|
|
7505
|
+
/**
|
|
7506
|
+
* The BPM of the beatmap.
|
|
7507
|
+
*/
|
|
7508
|
+
this.bpm = 0;
|
|
7509
|
+
/**
|
|
7510
|
+
* The amount of circles in the beatmap.
|
|
7511
|
+
*/
|
|
7512
|
+
this.circles = 0;
|
|
7513
|
+
/**
|
|
7514
|
+
* The amount of sliders in the beatmap.
|
|
7515
|
+
*/
|
|
7516
|
+
this.sliders = 0;
|
|
7517
|
+
/**
|
|
7518
|
+
* The amount of spinners in the beatmap.
|
|
7519
|
+
*/
|
|
7520
|
+
this.spinners = 0;
|
|
7521
|
+
/**
|
|
7522
|
+
* The maximum combo of the beatmap.
|
|
7523
|
+
*/
|
|
7524
|
+
this.maxCombo = 0;
|
|
7525
|
+
/**
|
|
7526
|
+
* The circle size of the beatmap.
|
|
7527
|
+
*/
|
|
7528
|
+
this.cs = 0;
|
|
7529
|
+
/**
|
|
7530
|
+
* The approach rate of the beatmap.
|
|
7531
|
+
*/
|
|
7532
|
+
this.ar = 0;
|
|
7533
|
+
/**
|
|
7534
|
+
* The overall difficulty of the beatmap.
|
|
7535
|
+
*/
|
|
7536
|
+
this.od = 0;
|
|
7537
|
+
/**
|
|
7538
|
+
* The health drain rate of the beatmap.
|
|
7539
|
+
*/
|
|
7540
|
+
this.hp = 0;
|
|
7541
|
+
/**
|
|
7542
|
+
* The beatmap packs that contain this beatmap, represented by their ID.
|
|
7543
|
+
*/
|
|
7544
|
+
this.packs = [];
|
|
7545
|
+
/**
|
|
7546
|
+
* The tags of this beatmap.
|
|
7547
|
+
*/
|
|
7548
|
+
this.tags = [];
|
|
7549
|
+
/**
|
|
7550
|
+
* The aim difficulty rating of the beatmap.
|
|
7551
|
+
*/
|
|
7552
|
+
this.aimDifficulty = null;
|
|
7553
|
+
/**
|
|
7554
|
+
* The speed difficulty rating of the beatmap.
|
|
7555
|
+
*/
|
|
7556
|
+
this.speedDifficulty = null;
|
|
7557
|
+
/**
|
|
7558
|
+
* The generic difficulty rating of the beatmap.
|
|
7559
|
+
*/
|
|
7560
|
+
this.totalDifficulty = null;
|
|
7561
|
+
/**
|
|
7562
|
+
* The MD5 hash of the beatmap.
|
|
7563
|
+
*/
|
|
7564
|
+
this.hash = "";
|
|
7565
|
+
/**
|
|
7566
|
+
* Whether this beatmap has a storyboard.
|
|
7567
|
+
*/
|
|
7568
|
+
this.storyboardAvailable = false;
|
|
7569
|
+
/**
|
|
7570
|
+
* Whether this beatmap has a video.
|
|
7571
|
+
*/
|
|
7572
|
+
this.videoAvailable = false;
|
|
7573
|
+
/**
|
|
7574
|
+
* Whether the download for this beatmap is available.
|
|
7575
|
+
*
|
|
7576
|
+
* The download of a beatmap may not be available due to old beatmap, etc.
|
|
7577
|
+
*/
|
|
7578
|
+
this.downloadAvailable = true;
|
|
7579
|
+
/**
|
|
7580
|
+
* Whether the audio of this beatmap is available.
|
|
7581
|
+
*
|
|
7582
|
+
* The audio of a beatmap may not be available due to DMCA takedown, etc.
|
|
7583
|
+
*/
|
|
7584
|
+
this.audioAvailable = true;
|
|
7585
|
+
this.cachedBeatmap = null;
|
|
7586
|
+
}
|
|
7792
7587
|
/**
|
|
7793
7588
|
* The full title of the beatmap, which is `Artist - Title (Creator) [Difficulty Name]`.
|
|
7794
7589
|
*/
|
|
7795
7590
|
get fullTitle() {
|
|
7796
7591
|
return `${this.artist} - ${this.title} (${this.creator}) [${this.version}]`;
|
|
7797
7592
|
}
|
|
7798
|
-
/**
|
|
7799
|
-
* The artist of the song of the beatmap.
|
|
7800
|
-
*/
|
|
7801
|
-
artist = "";
|
|
7802
|
-
/**
|
|
7803
|
-
* The creator of the beatmap.
|
|
7804
|
-
*/
|
|
7805
|
-
creator = "";
|
|
7806
|
-
/**
|
|
7807
|
-
* The user ID of the creator of the beatmap.
|
|
7808
|
-
*/
|
|
7809
|
-
creatorId = 0;
|
|
7810
|
-
/**
|
|
7811
|
-
* The difficulty name of the beatmap.
|
|
7812
|
-
*/
|
|
7813
|
-
version = "";
|
|
7814
|
-
/**
|
|
7815
|
-
* The source of the song, if any.
|
|
7816
|
-
*/
|
|
7817
|
-
source = "";
|
|
7818
|
-
/**
|
|
7819
|
-
* The ranking status of the beatmap.
|
|
7820
|
-
*/
|
|
7821
|
-
approved = 0;
|
|
7822
|
-
/**
|
|
7823
|
-
* The ID of the beatmap.
|
|
7824
|
-
*/
|
|
7825
|
-
beatmapId = 0;
|
|
7826
|
-
/**
|
|
7827
|
-
* The ID of the beatmapset containing the beatmap.
|
|
7828
|
-
*/
|
|
7829
|
-
beatmapSetId = 0;
|
|
7830
|
-
/**
|
|
7831
|
-
* The amount of times the beatmap has been played.
|
|
7832
|
-
*/
|
|
7833
|
-
plays = 0;
|
|
7834
|
-
/**
|
|
7835
|
-
* The amount of times this beatmap has been passed.
|
|
7836
|
-
*/
|
|
7837
|
-
passes = 0;
|
|
7838
|
-
/**
|
|
7839
|
-
* The amount of times the beatmap has been favorited.
|
|
7840
|
-
*/
|
|
7841
|
-
favorites = 0;
|
|
7842
|
-
/**
|
|
7843
|
-
* The user rating of this beatmap.
|
|
7844
|
-
*/
|
|
7845
|
-
rating = 0;
|
|
7846
|
-
/**
|
|
7847
|
-
* The date of which the beatmap was submitted.
|
|
7848
|
-
*/
|
|
7849
|
-
submitDate = new Date(0);
|
|
7850
|
-
/**
|
|
7851
|
-
* The date of which this beatmap was approved.
|
|
7852
|
-
*/
|
|
7853
|
-
approvedDate = null;
|
|
7854
|
-
/**
|
|
7855
|
-
* The date of which the beatmap was last updated.
|
|
7856
|
-
*/
|
|
7857
|
-
lastUpdate = new Date(0);
|
|
7858
|
-
/**
|
|
7859
|
-
* The duration of the beatmap not including breaks.
|
|
7860
|
-
*/
|
|
7861
|
-
hitLength = 0;
|
|
7862
|
-
/**
|
|
7863
|
-
* The duration of the beatmap including breaks.
|
|
7864
|
-
*/
|
|
7865
|
-
totalLength = 0;
|
|
7866
|
-
/**
|
|
7867
|
-
* The genre of this beatmap.
|
|
7868
|
-
*/
|
|
7869
|
-
genre = exports.BeatmapGenre.any;
|
|
7870
|
-
/**
|
|
7871
|
-
* The language of this beatmap.
|
|
7872
|
-
*/
|
|
7873
|
-
language = exports.BeatmapLanguage.any;
|
|
7874
|
-
/**
|
|
7875
|
-
* The BPM of the beatmap.
|
|
7876
|
-
*/
|
|
7877
|
-
bpm = 0;
|
|
7878
|
-
/**
|
|
7879
|
-
* The amount of circles in the beatmap.
|
|
7880
|
-
*/
|
|
7881
|
-
circles = 0;
|
|
7882
|
-
/**
|
|
7883
|
-
* The amount of sliders in the beatmap.
|
|
7884
|
-
*/
|
|
7885
|
-
sliders = 0;
|
|
7886
|
-
/**
|
|
7887
|
-
* The amount of spinners in the beatmap.
|
|
7888
|
-
*/
|
|
7889
|
-
spinners = 0;
|
|
7890
7593
|
/**
|
|
7891
7594
|
* The amount of objects in the beatmap.
|
|
7892
7595
|
*/
|
|
7893
7596
|
get objects() {
|
|
7894
7597
|
return this.circles + this.sliders + this.spinners;
|
|
7895
7598
|
}
|
|
7896
|
-
/**
|
|
7897
|
-
* The maximum combo of the beatmap.
|
|
7898
|
-
*/
|
|
7899
|
-
maxCombo = 0;
|
|
7900
|
-
/**
|
|
7901
|
-
* The circle size of the beatmap.
|
|
7902
|
-
*/
|
|
7903
|
-
cs = 0;
|
|
7904
|
-
/**
|
|
7905
|
-
* The approach rate of the beatmap.
|
|
7906
|
-
*/
|
|
7907
|
-
ar = 0;
|
|
7908
|
-
/**
|
|
7909
|
-
* The overall difficulty of the beatmap.
|
|
7910
|
-
*/
|
|
7911
|
-
od = 0;
|
|
7912
|
-
/**
|
|
7913
|
-
* The health drain rate of the beatmap.
|
|
7914
|
-
*/
|
|
7915
|
-
hp = 0;
|
|
7916
|
-
/**
|
|
7917
|
-
* The beatmap packs that contain this beatmap, represented by their ID.
|
|
7918
|
-
*/
|
|
7919
|
-
packs = [];
|
|
7920
|
-
/**
|
|
7921
|
-
* The tags of this beatmap.
|
|
7922
|
-
*/
|
|
7923
|
-
tags = [];
|
|
7924
|
-
/**
|
|
7925
|
-
* The aim difficulty rating of the beatmap.
|
|
7926
|
-
*/
|
|
7927
|
-
aimDifficulty = null;
|
|
7928
|
-
/**
|
|
7929
|
-
* The speed difficulty rating of the beatmap.
|
|
7930
|
-
*/
|
|
7931
|
-
speedDifficulty = null;
|
|
7932
|
-
/**
|
|
7933
|
-
* The generic difficulty rating of the beatmap.
|
|
7934
|
-
*/
|
|
7935
|
-
totalDifficulty = null;
|
|
7936
|
-
/**
|
|
7937
|
-
* The MD5 hash of the beatmap.
|
|
7938
|
-
*/
|
|
7939
|
-
hash = "";
|
|
7940
|
-
/**
|
|
7941
|
-
* Whether this beatmap has a storyboard.
|
|
7942
|
-
*/
|
|
7943
|
-
storyboardAvailable = false;
|
|
7944
|
-
/**
|
|
7945
|
-
* Whether this beatmap has a video.
|
|
7946
|
-
*/
|
|
7947
|
-
videoAvailable = false;
|
|
7948
|
-
/**
|
|
7949
|
-
* Whether the download for this beatmap is available.
|
|
7950
|
-
*
|
|
7951
|
-
* The download of a beatmap may not be available due to old beatmap, etc.
|
|
7952
|
-
*/
|
|
7953
|
-
downloadAvailable = true;
|
|
7954
|
-
/**
|
|
7955
|
-
* Whether the audio of this beatmap is available.
|
|
7956
|
-
*
|
|
7957
|
-
* The audio of a beatmap may not be available due to DMCA takedown, etc.
|
|
7958
|
-
*/
|
|
7959
|
-
audioAvailable = true;
|
|
7960
7599
|
/**
|
|
7961
7600
|
* The decoded beatmap from beatmap decoder.
|
|
7962
7601
|
*/
|
|
@@ -7975,27 +7614,28 @@ class MapInfo {
|
|
|
7975
7614
|
get beatmapSetLink() {
|
|
7976
7615
|
return `https://osu.ppy.sh/s/${this.beatmapSetId}`;
|
|
7977
7616
|
}
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
7984
|
-
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
|
|
7994
|
-
|
|
7995
|
-
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
|
|
7617
|
+
static getInformation(beatmapIdOrHash, downloadBeatmap) {
|
|
7618
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
7619
|
+
const apiRequestBuilder = new OsuAPIRequestBuilder()
|
|
7620
|
+
.setEndpoint("get_beatmaps")
|
|
7621
|
+
.addParameter(typeof beatmapIdOrHash === "string" ? "h" : "b", beatmapIdOrHash);
|
|
7622
|
+
const result = yield apiRequestBuilder.sendRequest();
|
|
7623
|
+
if (result.statusCode !== 200) {
|
|
7624
|
+
throw new Error("osu! API error");
|
|
7625
|
+
}
|
|
7626
|
+
const mapinfo = JSON.parse(result.data.toString("utf-8"))[0];
|
|
7627
|
+
if (!mapinfo) {
|
|
7628
|
+
return null;
|
|
7629
|
+
}
|
|
7630
|
+
if (parseInt(mapinfo.mode) !== 0) {
|
|
7631
|
+
return null;
|
|
7632
|
+
}
|
|
7633
|
+
const map = this.from(mapinfo);
|
|
7634
|
+
if (downloadBeatmap !== false) {
|
|
7635
|
+
yield map.retrieveBeatmapFile();
|
|
7636
|
+
}
|
|
7637
|
+
return map;
|
|
7638
|
+
});
|
|
7999
7639
|
}
|
|
8000
7640
|
/**
|
|
8001
7641
|
* Constructs a `MapInfo` from an osu! API response.
|
|
@@ -8068,6 +7708,7 @@ class MapInfo {
|
|
|
8068
7708
|
* @returns The raw API response represented by this `MapInfo`.
|
|
8069
7709
|
*/
|
|
8070
7710
|
toAPIResponse() {
|
|
7711
|
+
var _a, _b, _c, _d, _e, _f;
|
|
8071
7712
|
const padDateNumber = (num) => num.toString().padStart(2, "0");
|
|
8072
7713
|
const convertDate = (date) => `${date.getUTCFullYear()}-${padDateNumber(date.getUTCMonth() + 1)}-${padDateNumber(date.getUTCDate())} ${padDateNumber(date.getUTCHours())}:${padDateNumber(date.getUTCMinutes())}:${padDateNumber(date.getUTCSeconds())}`;
|
|
8073
7714
|
return {
|
|
@@ -8083,9 +7724,9 @@ class MapInfo {
|
|
|
8083
7724
|
bpm: this.bpm.toString(),
|
|
8084
7725
|
creator: this.creator.toString(),
|
|
8085
7726
|
creator_id: this.creatorId.toString(),
|
|
8086
|
-
difficultyrating: this.totalDifficulty
|
|
8087
|
-
diff_aim: this.aimDifficulty
|
|
8088
|
-
diff_speed: this.speedDifficulty
|
|
7727
|
+
difficultyrating: (_b = (_a = this.totalDifficulty) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : null,
|
|
7728
|
+
diff_aim: (_d = (_c = this.aimDifficulty) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : null,
|
|
7729
|
+
diff_speed: (_f = (_e = this.speedDifficulty) === null || _e === void 0 ? void 0 : _e.toString()) !== null && _f !== void 0 ? _f : null,
|
|
8089
7730
|
diff_size: this.cs.toString(),
|
|
8090
7731
|
diff_overall: this.od.toString(),
|
|
8091
7732
|
diff_approach: this.ar.toString(),
|
|
@@ -8129,21 +7770,23 @@ class MapInfo {
|
|
|
8129
7770
|
*
|
|
8130
7771
|
* @param force Whether to download the file regardless if it's already available.
|
|
8131
7772
|
*/
|
|
8132
|
-
|
|
8133
|
-
|
|
8134
|
-
|
|
8135
|
-
|
|
8136
|
-
const url = `https://osu.ppy.sh/osu/${this.beatmapId}`;
|
|
8137
|
-
return fetch(url)
|
|
8138
|
-
.then(async (res) => {
|
|
8139
|
-
const text = await res.text();
|
|
8140
|
-
if (res.status >= 500) {
|
|
8141
|
-
throw new Error(text);
|
|
7773
|
+
retrieveBeatmapFile(force) {
|
|
7774
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
7775
|
+
if (this.hasDownloadedBeatmap() && !force) {
|
|
7776
|
+
return;
|
|
8142
7777
|
}
|
|
8143
|
-
|
|
8144
|
-
|
|
8145
|
-
|
|
8146
|
-
|
|
7778
|
+
const url = `https://osu.ppy.sh/osu/${this.beatmapId}`;
|
|
7779
|
+
return fetch(url)
|
|
7780
|
+
.then((res) => __awaiter(this, void 0, void 0, function* () {
|
|
7781
|
+
const text = yield res.text();
|
|
7782
|
+
if (res.status >= 500) {
|
|
7783
|
+
throw new Error(text);
|
|
7784
|
+
}
|
|
7785
|
+
this.cachedBeatmap = new BeatmapDecoder().decode(text).result;
|
|
7786
|
+
}))
|
|
7787
|
+
.catch((e) => {
|
|
7788
|
+
console.error(`Request to ${url} failed with the following error: ${e.message}; aborting`);
|
|
7789
|
+
});
|
|
8147
7790
|
});
|
|
8148
7791
|
}
|
|
8149
7792
|
/**
|
|
@@ -8158,45 +7801,54 @@ class MapInfo {
|
|
|
8158
7801
|
* Represents the Auto mod.
|
|
8159
7802
|
*/
|
|
8160
7803
|
class ModAuto extends Mod {
|
|
8161
|
-
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
|
|
8168
|
-
|
|
8169
|
-
|
|
7804
|
+
constructor() {
|
|
7805
|
+
super(...arguments);
|
|
7806
|
+
this.acronym = "AT";
|
|
7807
|
+
this.name = "Autoplay";
|
|
7808
|
+
this.droidRanked = false;
|
|
7809
|
+
this.droidScoreMultiplier = 1;
|
|
7810
|
+
this.droidString = "a";
|
|
7811
|
+
this.isDroidLegacyMod = false;
|
|
7812
|
+
this.pcRanked = false;
|
|
7813
|
+
this.pcScoreMultiplier = 1;
|
|
7814
|
+
this.bitwise = 1 << 11;
|
|
7815
|
+
}
|
|
8170
7816
|
}
|
|
8171
7817
|
|
|
8172
7818
|
/**
|
|
8173
7819
|
* Represents the Autopilot mod.
|
|
8174
7820
|
*/
|
|
8175
7821
|
class ModAutopilot extends Mod {
|
|
8176
|
-
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
|
|
8180
|
-
|
|
8181
|
-
|
|
8182
|
-
|
|
8183
|
-
|
|
8184
|
-
|
|
7822
|
+
constructor() {
|
|
7823
|
+
super(...arguments);
|
|
7824
|
+
this.acronym = "AP";
|
|
7825
|
+
this.name = "Autopilot";
|
|
7826
|
+
this.droidRanked = false;
|
|
7827
|
+
this.droidScoreMultiplier = 0.001;
|
|
7828
|
+
this.droidString = "p";
|
|
7829
|
+
this.isDroidLegacyMod = false;
|
|
7830
|
+
this.pcRanked = false;
|
|
7831
|
+
this.pcScoreMultiplier = 0;
|
|
7832
|
+
this.bitwise = 1 << 13;
|
|
7833
|
+
}
|
|
8185
7834
|
}
|
|
8186
7835
|
|
|
8187
7836
|
/**
|
|
8188
7837
|
* Represents the Easy mod.
|
|
8189
7838
|
*/
|
|
8190
7839
|
class ModEasy extends Mod {
|
|
8191
|
-
|
|
8192
|
-
|
|
8193
|
-
|
|
8194
|
-
|
|
8195
|
-
|
|
8196
|
-
|
|
8197
|
-
|
|
8198
|
-
|
|
8199
|
-
|
|
7840
|
+
constructor() {
|
|
7841
|
+
super(...arguments);
|
|
7842
|
+
this.acronym = "EZ";
|
|
7843
|
+
this.name = "Easy";
|
|
7844
|
+
this.droidRanked = true;
|
|
7845
|
+
this.droidScoreMultiplier = 0.5;
|
|
7846
|
+
this.droidString = "e";
|
|
7847
|
+
this.isDroidLegacyMod = false;
|
|
7848
|
+
this.pcRanked = true;
|
|
7849
|
+
this.pcScoreMultiplier = 0.5;
|
|
7850
|
+
this.bitwise = 1 << 1;
|
|
7851
|
+
}
|
|
8200
7852
|
applyToDifficulty(mode, difficulty) {
|
|
8201
7853
|
switch (mode) {
|
|
8202
7854
|
case exports.Modes.droid: {
|
|
@@ -8219,30 +7871,36 @@ class ModEasy extends Mod {
|
|
|
8219
7871
|
* Represents the Flashlight mod.
|
|
8220
7872
|
*/
|
|
8221
7873
|
class ModFlashlight extends Mod {
|
|
8222
|
-
|
|
8223
|
-
|
|
8224
|
-
|
|
8225
|
-
|
|
8226
|
-
|
|
8227
|
-
|
|
8228
|
-
|
|
8229
|
-
|
|
8230
|
-
|
|
7874
|
+
constructor() {
|
|
7875
|
+
super(...arguments);
|
|
7876
|
+
this.acronym = "FL";
|
|
7877
|
+
this.name = "Flashlight";
|
|
7878
|
+
this.droidRanked = true;
|
|
7879
|
+
this.droidScoreMultiplier = 1.12;
|
|
7880
|
+
this.droidString = "i";
|
|
7881
|
+
this.isDroidLegacyMod = false;
|
|
7882
|
+
this.pcRanked = true;
|
|
7883
|
+
this.pcScoreMultiplier = 1.12;
|
|
7884
|
+
this.bitwise = 1 << 10;
|
|
7885
|
+
}
|
|
8231
7886
|
}
|
|
8232
7887
|
|
|
8233
7888
|
/**
|
|
8234
7889
|
* Represents the HardRock mod.
|
|
8235
7890
|
*/
|
|
8236
7891
|
class ModHardRock extends Mod {
|
|
8237
|
-
|
|
8238
|
-
|
|
8239
|
-
|
|
8240
|
-
|
|
8241
|
-
|
|
8242
|
-
|
|
8243
|
-
|
|
8244
|
-
|
|
8245
|
-
|
|
7892
|
+
constructor() {
|
|
7893
|
+
super(...arguments);
|
|
7894
|
+
this.acronym = "HR";
|
|
7895
|
+
this.name = "HardRock";
|
|
7896
|
+
this.droidRanked = true;
|
|
7897
|
+
this.droidScoreMultiplier = 1.06;
|
|
7898
|
+
this.droidString = "r";
|
|
7899
|
+
this.isDroidLegacyMod = false;
|
|
7900
|
+
this.pcRanked = true;
|
|
7901
|
+
this.pcScoreMultiplier = 1.06;
|
|
7902
|
+
this.bitwise = 1 << 4;
|
|
7903
|
+
}
|
|
8246
7904
|
applyToDifficulty(mode, difficulty) {
|
|
8247
7905
|
switch (mode) {
|
|
8248
7906
|
case exports.Modes.droid: {
|
|
@@ -8270,17 +7928,18 @@ class ModHardRock extends Mod {
|
|
|
8270
7928
|
* Represents the Hidden mod.
|
|
8271
7929
|
*/
|
|
8272
7930
|
class ModHidden extends Mod {
|
|
8273
|
-
|
|
8274
|
-
|
|
8275
|
-
|
|
8276
|
-
|
|
8277
|
-
|
|
8278
|
-
|
|
8279
|
-
|
|
8280
|
-
|
|
8281
|
-
|
|
8282
|
-
|
|
8283
|
-
|
|
7931
|
+
constructor() {
|
|
7932
|
+
super(...arguments);
|
|
7933
|
+
this.acronym = "HD";
|
|
7934
|
+
this.name = "Hidden";
|
|
7935
|
+
this.droidRanked = true;
|
|
7936
|
+
this.droidScoreMultiplier = 1.06;
|
|
7937
|
+
this.droidString = "h";
|
|
7938
|
+
this.isDroidLegacyMod = false;
|
|
7939
|
+
this.pcRanked = true;
|
|
7940
|
+
this.pcScoreMultiplier = 1.06;
|
|
7941
|
+
this.bitwise = 1 << 3;
|
|
7942
|
+
}
|
|
8284
7943
|
applyToBeatmap(beatmap) {
|
|
8285
7944
|
const applyFadeInAdjustment = (hitObject) => {
|
|
8286
7945
|
hitObject.timeFadeIn =
|
|
@@ -8292,53 +7951,64 @@ class ModHidden extends Mod {
|
|
|
8292
7951
|
beatmap.hitObjects.objects.forEach(applyFadeInAdjustment);
|
|
8293
7952
|
}
|
|
8294
7953
|
}
|
|
7954
|
+
ModHidden.fadeInDurationMultiplier = 0.4;
|
|
7955
|
+
ModHidden.fadeOutDurationMultiplier = 0.3;
|
|
8295
7956
|
|
|
8296
7957
|
/**
|
|
8297
7958
|
* Represents the NoFail mod.
|
|
8298
7959
|
*/
|
|
8299
7960
|
class ModNoFail extends Mod {
|
|
8300
|
-
|
|
8301
|
-
|
|
8302
|
-
|
|
8303
|
-
|
|
8304
|
-
|
|
8305
|
-
|
|
8306
|
-
|
|
8307
|
-
|
|
8308
|
-
|
|
7961
|
+
constructor() {
|
|
7962
|
+
super(...arguments);
|
|
7963
|
+
this.acronym = "NF";
|
|
7964
|
+
this.name = "NoFail";
|
|
7965
|
+
this.droidRanked = true;
|
|
7966
|
+
this.droidScoreMultiplier = 0.5;
|
|
7967
|
+
this.droidString = "n";
|
|
7968
|
+
this.isDroidLegacyMod = false;
|
|
7969
|
+
this.pcRanked = true;
|
|
7970
|
+
this.pcScoreMultiplier = 0.5;
|
|
7971
|
+
this.bitwise = 1 << 0;
|
|
7972
|
+
}
|
|
8309
7973
|
}
|
|
8310
7974
|
|
|
8311
7975
|
/**
|
|
8312
7976
|
* Represents the Perfect mod.
|
|
8313
7977
|
*/
|
|
8314
7978
|
class ModPerfect extends Mod {
|
|
8315
|
-
|
|
8316
|
-
|
|
8317
|
-
|
|
8318
|
-
|
|
8319
|
-
|
|
8320
|
-
|
|
8321
|
-
|
|
8322
|
-
|
|
8323
|
-
|
|
7979
|
+
constructor() {
|
|
7980
|
+
super(...arguments);
|
|
7981
|
+
this.acronym = "PF";
|
|
7982
|
+
this.name = "Perfect";
|
|
7983
|
+
this.droidRanked = true;
|
|
7984
|
+
this.droidScoreMultiplier = 1;
|
|
7985
|
+
this.droidString = "f";
|
|
7986
|
+
this.isDroidLegacyMod = false;
|
|
7987
|
+
this.pcRanked = true;
|
|
7988
|
+
this.pcScoreMultiplier = 1;
|
|
7989
|
+
this.bitwise = 1 << 14;
|
|
7990
|
+
}
|
|
8324
7991
|
}
|
|
8325
7992
|
|
|
8326
7993
|
/**
|
|
8327
7994
|
* Represents the ReallyEasy mod.
|
|
8328
7995
|
*/
|
|
8329
7996
|
class ModReallyEasy extends Mod {
|
|
8330
|
-
|
|
8331
|
-
|
|
8332
|
-
|
|
8333
|
-
|
|
8334
|
-
|
|
8335
|
-
|
|
7997
|
+
constructor() {
|
|
7998
|
+
super(...arguments);
|
|
7999
|
+
this.acronym = "RE";
|
|
8000
|
+
this.name = "ReallyEasy";
|
|
8001
|
+
this.droidRanked = false;
|
|
8002
|
+
this.droidScoreMultiplier = 0.4;
|
|
8003
|
+
this.droidString = "l";
|
|
8004
|
+
this.isDroidLegacyMod = false;
|
|
8005
|
+
}
|
|
8336
8006
|
applyToDifficultyWithSettings(mode, difficulty, mods, customSpeedMultiplier) {
|
|
8337
8007
|
if (mode !== exports.Modes.droid) {
|
|
8338
8008
|
return;
|
|
8339
8009
|
}
|
|
8340
8010
|
const difficultyAdjustMod = mods.find((m) => m instanceof ModDifficultyAdjust);
|
|
8341
|
-
if (difficultyAdjustMod
|
|
8011
|
+
if ((difficultyAdjustMod === null || difficultyAdjustMod === void 0 ? void 0 : difficultyAdjustMod.ar) === undefined &&
|
|
8342
8012
|
difficulty.ar !== undefined) {
|
|
8343
8013
|
if (mods.some((m) => m instanceof ModEasy)) {
|
|
8344
8014
|
difficulty.ar *= 2;
|
|
@@ -8347,14 +8017,14 @@ class ModReallyEasy extends Mod {
|
|
|
8347
8017
|
difficulty.ar -= 0.5;
|
|
8348
8018
|
difficulty.ar -= customSpeedMultiplier - 1;
|
|
8349
8019
|
}
|
|
8350
|
-
if (difficultyAdjustMod
|
|
8020
|
+
if ((difficultyAdjustMod === null || difficultyAdjustMod === void 0 ? void 0 : difficultyAdjustMod.cs) === undefined) {
|
|
8351
8021
|
const scale = CircleSizeCalculator.droidCSToDroidScale(difficulty.cs);
|
|
8352
8022
|
difficulty.cs = CircleSizeCalculator.droidScaleToDroidCS(scale + 0.125);
|
|
8353
8023
|
}
|
|
8354
|
-
if (difficultyAdjustMod
|
|
8024
|
+
if ((difficultyAdjustMod === null || difficultyAdjustMod === void 0 ? void 0 : difficultyAdjustMod.od) === undefined) {
|
|
8355
8025
|
difficulty.od /= 2;
|
|
8356
8026
|
}
|
|
8357
|
-
if (difficultyAdjustMod
|
|
8027
|
+
if ((difficultyAdjustMod === null || difficultyAdjustMod === void 0 ? void 0 : difficultyAdjustMod.hp) === undefined) {
|
|
8358
8028
|
difficulty.hp /= 2;
|
|
8359
8029
|
}
|
|
8360
8030
|
}
|
|
@@ -8364,30 +8034,36 @@ class ModReallyEasy extends Mod {
|
|
|
8364
8034
|
* Represents the Relax mod.
|
|
8365
8035
|
*/
|
|
8366
8036
|
class ModRelax extends Mod {
|
|
8367
|
-
|
|
8368
|
-
|
|
8369
|
-
|
|
8370
|
-
|
|
8371
|
-
|
|
8372
|
-
|
|
8373
|
-
|
|
8374
|
-
|
|
8375
|
-
|
|
8037
|
+
constructor() {
|
|
8038
|
+
super(...arguments);
|
|
8039
|
+
this.acronym = "RX";
|
|
8040
|
+
this.name = "Relax";
|
|
8041
|
+
this.droidRanked = false;
|
|
8042
|
+
this.droidScoreMultiplier = 0.001;
|
|
8043
|
+
this.droidString = "x";
|
|
8044
|
+
this.isDroidLegacyMod = false;
|
|
8045
|
+
this.pcRanked = false;
|
|
8046
|
+
this.pcScoreMultiplier = 0;
|
|
8047
|
+
this.bitwise = 1 << 7;
|
|
8048
|
+
}
|
|
8376
8049
|
}
|
|
8377
8050
|
|
|
8378
8051
|
/**
|
|
8379
8052
|
* Represents the ScoreV2 mod.
|
|
8380
8053
|
*/
|
|
8381
8054
|
class ModScoreV2 extends Mod {
|
|
8382
|
-
|
|
8383
|
-
|
|
8384
|
-
|
|
8385
|
-
|
|
8386
|
-
|
|
8387
|
-
|
|
8388
|
-
|
|
8389
|
-
|
|
8390
|
-
|
|
8055
|
+
constructor() {
|
|
8056
|
+
super(...arguments);
|
|
8057
|
+
this.acronym = "V2";
|
|
8058
|
+
this.name = "ScoreV2";
|
|
8059
|
+
this.droidRanked = false;
|
|
8060
|
+
this.droidScoreMultiplier = 1;
|
|
8061
|
+
this.droidString = "v";
|
|
8062
|
+
this.isDroidLegacyMod = false;
|
|
8063
|
+
this.pcRanked = false;
|
|
8064
|
+
this.pcScoreMultiplier = 1;
|
|
8065
|
+
this.bitwise = 1 << 29;
|
|
8066
|
+
}
|
|
8391
8067
|
}
|
|
8392
8068
|
|
|
8393
8069
|
/**
|
|
@@ -8396,12 +8072,15 @@ class ModScoreV2 extends Mod {
|
|
|
8396
8072
|
* This is a legacy osu!droid mod that may still be exist when parsing replays.
|
|
8397
8073
|
*/
|
|
8398
8074
|
class ModSmallCircle extends Mod {
|
|
8399
|
-
|
|
8400
|
-
|
|
8401
|
-
|
|
8402
|
-
|
|
8403
|
-
|
|
8404
|
-
|
|
8075
|
+
constructor() {
|
|
8076
|
+
super(...arguments);
|
|
8077
|
+
this.acronym = "SC";
|
|
8078
|
+
this.name = "SmallCircle";
|
|
8079
|
+
this.droidRanked = false;
|
|
8080
|
+
this.droidScoreMultiplier = 1.06;
|
|
8081
|
+
this.droidString = "m";
|
|
8082
|
+
this.isDroidLegacyMod = true;
|
|
8083
|
+
}
|
|
8405
8084
|
applyToDifficulty(mode, difficulty) {
|
|
8406
8085
|
switch (mode) {
|
|
8407
8086
|
case exports.Modes.droid: {
|
|
@@ -8423,96 +8102,53 @@ class ModSmallCircle extends Mod {
|
|
|
8423
8102
|
* Represents the SpunOut mod.
|
|
8424
8103
|
*/
|
|
8425
8104
|
class ModSpunOut extends Mod {
|
|
8426
|
-
|
|
8427
|
-
|
|
8428
|
-
|
|
8429
|
-
|
|
8430
|
-
|
|
8105
|
+
constructor() {
|
|
8106
|
+
super(...arguments);
|
|
8107
|
+
this.acronym = "SO";
|
|
8108
|
+
this.name = "SpunOut";
|
|
8109
|
+
this.pcRanked = true;
|
|
8110
|
+
this.pcScoreMultiplier = 0.9;
|
|
8111
|
+
this.bitwise = 1 << 12;
|
|
8112
|
+
}
|
|
8431
8113
|
}
|
|
8432
8114
|
|
|
8433
8115
|
/**
|
|
8434
8116
|
* Represents the SuddenDeath mod.
|
|
8435
8117
|
*/
|
|
8436
8118
|
class ModSuddenDeath extends Mod {
|
|
8437
|
-
|
|
8438
|
-
|
|
8439
|
-
|
|
8440
|
-
|
|
8441
|
-
|
|
8442
|
-
|
|
8443
|
-
|
|
8444
|
-
|
|
8445
|
-
|
|
8119
|
+
constructor() {
|
|
8120
|
+
super(...arguments);
|
|
8121
|
+
this.acronym = "SD";
|
|
8122
|
+
this.name = "Sudden Death";
|
|
8123
|
+
this.droidRanked = true;
|
|
8124
|
+
this.droidScoreMultiplier = 1;
|
|
8125
|
+
this.droidString = "u";
|
|
8126
|
+
this.isDroidLegacyMod = false;
|
|
8127
|
+
this.pcRanked = true;
|
|
8128
|
+
this.pcScoreMultiplier = 1;
|
|
8129
|
+
this.bitwise = 1 << 5;
|
|
8130
|
+
}
|
|
8446
8131
|
}
|
|
8447
8132
|
|
|
8448
8133
|
/**
|
|
8449
8134
|
* Represents the TouchDevice mod.
|
|
8450
8135
|
*/
|
|
8451
8136
|
class ModTouchDevice extends Mod {
|
|
8452
|
-
|
|
8453
|
-
|
|
8454
|
-
|
|
8455
|
-
|
|
8456
|
-
|
|
8137
|
+
constructor() {
|
|
8138
|
+
super(...arguments);
|
|
8139
|
+
this.acronym = "TD";
|
|
8140
|
+
this.name = "TouchDevice";
|
|
8141
|
+
this.pcRanked = true;
|
|
8142
|
+
this.pcScoreMultiplier = 1;
|
|
8143
|
+
this.bitwise = 1 << 2;
|
|
8144
|
+
}
|
|
8457
8145
|
}
|
|
8458
8146
|
|
|
8147
|
+
var _a;
|
|
8459
8148
|
/**
|
|
8460
8149
|
* Utilities for mods.
|
|
8461
8150
|
*/
|
|
8462
8151
|
class ModUtil {
|
|
8463
|
-
/**
|
|
8464
|
-
* Mods that are incompatible with each other.
|
|
8465
|
-
*/
|
|
8466
|
-
static incompatibleMods = [
|
|
8467
|
-
[
|
|
8468
|
-
new ModDoubleTime(),
|
|
8469
|
-
new ModNightCore(),
|
|
8470
|
-
new ModHalfTime(),
|
|
8471
|
-
new ModSpeedUp(),
|
|
8472
|
-
],
|
|
8473
|
-
[new ModNoFail(), new ModSuddenDeath(), new ModPerfect()],
|
|
8474
|
-
[new ModHardRock(), new ModEasy()],
|
|
8475
|
-
[new ModAuto(), new ModRelax(), new ModAutopilot()],
|
|
8476
|
-
];
|
|
8477
|
-
/**
|
|
8478
|
-
* All mods that exists.
|
|
8479
|
-
*/
|
|
8480
|
-
static allMods = [
|
|
8481
|
-
// Janky order to keep the order on what players are used to
|
|
8482
|
-
new ModAuto(),
|
|
8483
|
-
new ModRelax(),
|
|
8484
|
-
new ModAutopilot(),
|
|
8485
|
-
new ModEasy(),
|
|
8486
|
-
new ModNoFail(),
|
|
8487
|
-
new ModHidden(),
|
|
8488
|
-
new ModHardRock(),
|
|
8489
|
-
new ModDoubleTime(),
|
|
8490
|
-
new ModNightCore(),
|
|
8491
|
-
new ModHalfTime(),
|
|
8492
|
-
new ModSpeedUp(),
|
|
8493
|
-
new ModFlashlight(),
|
|
8494
|
-
new ModSuddenDeath(),
|
|
8495
|
-
new ModPerfect(),
|
|
8496
|
-
new ModPrecise(),
|
|
8497
|
-
new ModReallyEasy(),
|
|
8498
|
-
new ModScoreV2(),
|
|
8499
|
-
new ModSmallCircle(),
|
|
8500
|
-
new ModSpunOut(),
|
|
8501
|
-
new ModTouchDevice(),
|
|
8502
|
-
];
|
|
8503
|
-
/**
|
|
8504
|
-
* Mods that change the playback speed of a beatmap.
|
|
8505
|
-
*/
|
|
8506
|
-
static speedChangingMods = [
|
|
8507
|
-
new ModDoubleTime(),
|
|
8508
|
-
new ModNightCore(),
|
|
8509
|
-
new ModHalfTime(),
|
|
8510
|
-
new ModSpeedUp(),
|
|
8511
|
-
];
|
|
8512
|
-
/**
|
|
8513
|
-
* Mods that change the way the map looks.
|
|
8514
|
-
*/
|
|
8515
|
-
static mapChangingMods = this.speedChangingMods.concat(new ModEasy(), new ModHardRock(), new ModReallyEasy(), new ModSmallCircle());
|
|
8516
8152
|
/**
|
|
8517
8153
|
* Gets a list of mods from a droid mod string, such as "hd".
|
|
8518
8154
|
*
|
|
@@ -8622,15 +8258,69 @@ class ModUtil {
|
|
|
8622
8258
|
* @returns The processed mods.
|
|
8623
8259
|
*/
|
|
8624
8260
|
static processParsingOptions(mods, options) {
|
|
8625
|
-
if (options
|
|
8261
|
+
if ((options === null || options === void 0 ? void 0 : options.checkDuplicate) !== false) {
|
|
8626
8262
|
mods = this.checkDuplicateMods(mods);
|
|
8627
8263
|
}
|
|
8628
|
-
if (options
|
|
8264
|
+
if ((options === null || options === void 0 ? void 0 : options.checkIncompatible) !== false) {
|
|
8629
8265
|
mods = this.checkIncompatibleMods(mods);
|
|
8630
8266
|
}
|
|
8631
8267
|
return mods;
|
|
8632
8268
|
}
|
|
8633
8269
|
}
|
|
8270
|
+
_a = ModUtil;
|
|
8271
|
+
/**
|
|
8272
|
+
* Mods that are incompatible with each other.
|
|
8273
|
+
*/
|
|
8274
|
+
ModUtil.incompatibleMods = [
|
|
8275
|
+
[
|
|
8276
|
+
new ModDoubleTime(),
|
|
8277
|
+
new ModNightCore(),
|
|
8278
|
+
new ModHalfTime(),
|
|
8279
|
+
new ModSpeedUp(),
|
|
8280
|
+
],
|
|
8281
|
+
[new ModNoFail(), new ModSuddenDeath(), new ModPerfect()],
|
|
8282
|
+
[new ModHardRock(), new ModEasy()],
|
|
8283
|
+
[new ModAuto(), new ModRelax(), new ModAutopilot()],
|
|
8284
|
+
];
|
|
8285
|
+
/**
|
|
8286
|
+
* All mods that exists.
|
|
8287
|
+
*/
|
|
8288
|
+
ModUtil.allMods = [
|
|
8289
|
+
// Janky order to keep the order on what players are used to
|
|
8290
|
+
new ModAuto(),
|
|
8291
|
+
new ModRelax(),
|
|
8292
|
+
new ModAutopilot(),
|
|
8293
|
+
new ModEasy(),
|
|
8294
|
+
new ModNoFail(),
|
|
8295
|
+
new ModHidden(),
|
|
8296
|
+
new ModHardRock(),
|
|
8297
|
+
new ModDoubleTime(),
|
|
8298
|
+
new ModNightCore(),
|
|
8299
|
+
new ModHalfTime(),
|
|
8300
|
+
new ModSpeedUp(),
|
|
8301
|
+
new ModFlashlight(),
|
|
8302
|
+
new ModSuddenDeath(),
|
|
8303
|
+
new ModPerfect(),
|
|
8304
|
+
new ModPrecise(),
|
|
8305
|
+
new ModReallyEasy(),
|
|
8306
|
+
new ModScoreV2(),
|
|
8307
|
+
new ModSmallCircle(),
|
|
8308
|
+
new ModSpunOut(),
|
|
8309
|
+
new ModTouchDevice(),
|
|
8310
|
+
];
|
|
8311
|
+
/**
|
|
8312
|
+
* Mods that change the playback speed of a beatmap.
|
|
8313
|
+
*/
|
|
8314
|
+
ModUtil.speedChangingMods = [
|
|
8315
|
+
new ModDoubleTime(),
|
|
8316
|
+
new ModNightCore(),
|
|
8317
|
+
new ModHalfTime(),
|
|
8318
|
+
new ModSpeedUp(),
|
|
8319
|
+
];
|
|
8320
|
+
/**
|
|
8321
|
+
* Mods that change the way the map looks.
|
|
8322
|
+
*/
|
|
8323
|
+
ModUtil.mapChangingMods = _a.speedChangingMods.concat(new ModEasy(), new ModHardRock(), new ModReallyEasy(), new ModSmallCircle());
|
|
8634
8324
|
|
|
8635
8325
|
/**
|
|
8636
8326
|
* Continuous Univariate Normal distribution, also known as Gaussian distribution.
|
|
@@ -8661,11 +8351,11 @@ class NormalDistribution {
|
|
|
8661
8351
|
* Represents the osu! playfield.
|
|
8662
8352
|
*/
|
|
8663
8353
|
class Playfield {
|
|
8664
|
-
/**
|
|
8665
|
-
* The size of the playfield, which is 512x384.
|
|
8666
|
-
*/
|
|
8667
|
-
static baseSize = new Vector2(512, 384);
|
|
8668
8354
|
}
|
|
8355
|
+
/**
|
|
8356
|
+
* The size of the playfield, which is 512x384.
|
|
8357
|
+
*/
|
|
8358
|
+
Playfield.baseSize = new Vector2(512, 384);
|
|
8669
8359
|
|
|
8670
8360
|
/**
|
|
8671
8361
|
* Ranking status of a beatmap.
|