@slot-engine/core 0.2.1 → 0.2.2
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.d.mts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +51 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +51 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -545,6 +545,7 @@ declare class BoardService<TGameModes extends AnyGameModes = AnyGameModes, TSymb
|
|
|
545
545
|
getPaddingTop(): Reels;
|
|
546
546
|
getPaddingBottom(): Reels;
|
|
547
547
|
getAnticipation(): boolean[];
|
|
548
|
+
getLockedReels(): boolean[];
|
|
548
549
|
/**
|
|
549
550
|
* Gets the symbol at the specified reel and row index.
|
|
550
551
|
*/
|
|
@@ -562,6 +563,10 @@ declare class BoardService<TGameModes extends AnyGameModes = AnyGameModes, TSymb
|
|
|
562
563
|
* Sets the anticipation value for a specific reel.
|
|
563
564
|
*/
|
|
564
565
|
setAnticipationForReel(reelIndex: number, value: boolean): void;
|
|
566
|
+
/**
|
|
567
|
+
* Sets the locked state for a specific reel.
|
|
568
|
+
*/
|
|
569
|
+
setReelLocked(reelIndex: number, value: boolean): void;
|
|
565
570
|
/**
|
|
566
571
|
* Counts how many symbols matching the criteria are on a specific reel.
|
|
567
572
|
*/
|
|
@@ -1729,6 +1734,8 @@ declare class StandaloneBoard {
|
|
|
1729
1734
|
getBoardReels(): Reels;
|
|
1730
1735
|
getPaddingTop(): Reels;
|
|
1731
1736
|
getPaddingBottom(): Reels;
|
|
1737
|
+
getAnticipation(): boolean[];
|
|
1738
|
+
getLockedReels(): boolean[];
|
|
1732
1739
|
/**
|
|
1733
1740
|
* Gets the symbol at the specified reel and row index.
|
|
1734
1741
|
*/
|
|
@@ -1746,6 +1753,10 @@ declare class StandaloneBoard {
|
|
|
1746
1753
|
* Sets the anticipation value for a specific reel.
|
|
1747
1754
|
*/
|
|
1748
1755
|
setAnticipationForReel(reelIndex: number, value: boolean): void;
|
|
1756
|
+
/**
|
|
1757
|
+
* Sets the locked state for a specific reel.
|
|
1758
|
+
*/
|
|
1759
|
+
setReelLocked(reelIndex: number, value: boolean): void;
|
|
1749
1760
|
/**
|
|
1750
1761
|
* Counts how many symbols matching the criteria are on a specific reel.
|
|
1751
1762
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -545,6 +545,7 @@ declare class BoardService<TGameModes extends AnyGameModes = AnyGameModes, TSymb
|
|
|
545
545
|
getPaddingTop(): Reels;
|
|
546
546
|
getPaddingBottom(): Reels;
|
|
547
547
|
getAnticipation(): boolean[];
|
|
548
|
+
getLockedReels(): boolean[];
|
|
548
549
|
/**
|
|
549
550
|
* Gets the symbol at the specified reel and row index.
|
|
550
551
|
*/
|
|
@@ -562,6 +563,10 @@ declare class BoardService<TGameModes extends AnyGameModes = AnyGameModes, TSymb
|
|
|
562
563
|
* Sets the anticipation value for a specific reel.
|
|
563
564
|
*/
|
|
564
565
|
setAnticipationForReel(reelIndex: number, value: boolean): void;
|
|
566
|
+
/**
|
|
567
|
+
* Sets the locked state for a specific reel.
|
|
568
|
+
*/
|
|
569
|
+
setReelLocked(reelIndex: number, value: boolean): void;
|
|
565
570
|
/**
|
|
566
571
|
* Counts how many symbols matching the criteria are on a specific reel.
|
|
567
572
|
*/
|
|
@@ -1729,6 +1734,8 @@ declare class StandaloneBoard {
|
|
|
1729
1734
|
getBoardReels(): Reels;
|
|
1730
1735
|
getPaddingTop(): Reels;
|
|
1731
1736
|
getPaddingBottom(): Reels;
|
|
1737
|
+
getAnticipation(): boolean[];
|
|
1738
|
+
getLockedReels(): boolean[];
|
|
1732
1739
|
/**
|
|
1733
1740
|
* Gets the symbol at the specified reel and row index.
|
|
1734
1741
|
*/
|
|
@@ -1746,6 +1753,10 @@ declare class StandaloneBoard {
|
|
|
1746
1753
|
* Sets the anticipation value for a specific reel.
|
|
1747
1754
|
*/
|
|
1748
1755
|
setAnticipationForReel(reelIndex: number, value: boolean): void;
|
|
1756
|
+
/**
|
|
1757
|
+
* Sets the locked state for a specific reel.
|
|
1758
|
+
*/
|
|
1759
|
+
setReelLocked(reelIndex: number, value: boolean): void;
|
|
1749
1760
|
/**
|
|
1750
1761
|
* Counts how many symbols matching the criteria are on a specific reel.
|
|
1751
1762
|
*/
|
package/dist/index.js
CHANGED
|
@@ -477,8 +477,18 @@ var Board = class {
|
|
|
477
477
|
* Used for triggering anticipation effects.
|
|
478
478
|
*/
|
|
479
479
|
anticipation;
|
|
480
|
+
/**
|
|
481
|
+
* The most recent stop positions for the reels.
|
|
482
|
+
*/
|
|
480
483
|
lastDrawnReelStops;
|
|
484
|
+
/**
|
|
485
|
+
* The reel set used in the most recent draw.
|
|
486
|
+
*/
|
|
481
487
|
lastUsedReels;
|
|
488
|
+
/**
|
|
489
|
+
* Indicates whether each reel is locked or not.
|
|
490
|
+
*/
|
|
491
|
+
reelsLocked;
|
|
482
492
|
constructor() {
|
|
483
493
|
this.reels = [];
|
|
484
494
|
this.paddingTop = [];
|
|
@@ -486,6 +496,7 @@ var Board = class {
|
|
|
486
496
|
this.anticipation = [];
|
|
487
497
|
this.lastDrawnReelStops = [];
|
|
488
498
|
this.lastUsedReels = [];
|
|
499
|
+
this.reelsLocked = [];
|
|
489
500
|
}
|
|
490
501
|
getSymbol(reelIndex, rowIndex) {
|
|
491
502
|
return this.reels[reelIndex]?.[rowIndex];
|
|
@@ -633,14 +644,19 @@ var Board = class {
|
|
|
633
644
|
return reelSet;
|
|
634
645
|
}
|
|
635
646
|
resetReels(opts) {
|
|
636
|
-
const
|
|
647
|
+
const { ctx, reelsAmount, reelsLocked } = opts;
|
|
648
|
+
const length = reelsAmount ?? ctx.services.game.getCurrentGameMode().reelsAmount;
|
|
637
649
|
this.reels = this.makeEmptyReels(opts);
|
|
638
650
|
this.anticipation = Array.from({ length }, () => false);
|
|
651
|
+
this.reelsLocked = reelsLocked ?? Array.from({ length }, () => false);
|
|
639
652
|
this.paddingTop = this.makeEmptyReels(opts);
|
|
640
653
|
this.paddingBottom = this.makeEmptyReels(opts);
|
|
641
654
|
}
|
|
642
655
|
drawBoardMixed(opts) {
|
|
643
|
-
this.resetReels(
|
|
656
|
+
this.resetReels({
|
|
657
|
+
...opts,
|
|
658
|
+
...this.reelsLocked.length && { reelsLocked: this.reelsLocked }
|
|
659
|
+
});
|
|
644
660
|
const reelsAmount = opts.reelsAmount ?? opts.ctx.services.game.getCurrentGameMode().reelsAmount;
|
|
645
661
|
const symbolsPerReel = opts.symbolsPerReel ?? opts.ctx.services.game.getCurrentGameMode().symbolsPerReel;
|
|
646
662
|
const padSymbols = opts.padSymbols ?? opts.ctx.config.padSymbols;
|
|
@@ -669,6 +685,18 @@ var Board = class {
|
|
|
669
685
|
);
|
|
670
686
|
}
|
|
671
687
|
}
|
|
688
|
+
if (this.reelsLocked.some((locked) => locked) && this.lastDrawnReelStops.length == 0) {
|
|
689
|
+
throw new Error(
|
|
690
|
+
"Cannot draw board with locked reels before drawing it at least once."
|
|
691
|
+
);
|
|
692
|
+
}
|
|
693
|
+
if (this.reelsLocked.some((locked) => locked)) {
|
|
694
|
+
for (let ridx = 0; ridx < reelsAmount; ridx++) {
|
|
695
|
+
if (this.reelsLocked[ridx]) {
|
|
696
|
+
finalReelStops[ridx] = this.lastDrawnReelStops[ridx];
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
}
|
|
672
700
|
this.lastDrawnReelStops = finalReelStops.map((pos) => pos);
|
|
673
701
|
this.lastUsedReels = opts.reels;
|
|
674
702
|
for (let ridx = 0; ridx < reelsAmount; ridx++) {
|
|
@@ -830,6 +858,9 @@ var BoardService = class extends AbstractService {
|
|
|
830
858
|
getAnticipation() {
|
|
831
859
|
return this.board.anticipation;
|
|
832
860
|
}
|
|
861
|
+
getLockedReels() {
|
|
862
|
+
return this.board.reelsLocked;
|
|
863
|
+
}
|
|
833
864
|
/**
|
|
834
865
|
* Gets the symbol at the specified reel and row index.
|
|
835
866
|
*/
|
|
@@ -859,6 +890,12 @@ var BoardService = class extends AbstractService {
|
|
|
859
890
|
setAnticipationForReel(reelIndex, value) {
|
|
860
891
|
this.board.anticipation[reelIndex] = value;
|
|
861
892
|
}
|
|
893
|
+
/**
|
|
894
|
+
* Sets the locked state for a specific reel.
|
|
895
|
+
*/
|
|
896
|
+
setReelLocked(reelIndex, value) {
|
|
897
|
+
this.board.reelsLocked[reelIndex] = value;
|
|
898
|
+
}
|
|
862
899
|
/**
|
|
863
900
|
* Counts how many symbols matching the criteria are on a specific reel.
|
|
864
901
|
*/
|
|
@@ -4591,6 +4628,12 @@ var StandaloneBoard = class {
|
|
|
4591
4628
|
getPaddingBottom() {
|
|
4592
4629
|
return this.board.paddingBottom;
|
|
4593
4630
|
}
|
|
4631
|
+
getAnticipation() {
|
|
4632
|
+
return this.board.anticipation;
|
|
4633
|
+
}
|
|
4634
|
+
getLockedReels() {
|
|
4635
|
+
return this.board.reelsLocked;
|
|
4636
|
+
}
|
|
4594
4637
|
/**
|
|
4595
4638
|
* Gets the symbol at the specified reel and row index.
|
|
4596
4639
|
*/
|
|
@@ -4620,6 +4663,12 @@ var StandaloneBoard = class {
|
|
|
4620
4663
|
setAnticipationForReel(reelIndex, value) {
|
|
4621
4664
|
this.board.anticipation[reelIndex] = value;
|
|
4622
4665
|
}
|
|
4666
|
+
/**
|
|
4667
|
+
* Sets the locked state for a specific reel.
|
|
4668
|
+
*/
|
|
4669
|
+
setReelLocked(reelIndex, value) {
|
|
4670
|
+
this.board.reelsLocked[reelIndex] = value;
|
|
4671
|
+
}
|
|
4623
4672
|
/**
|
|
4624
4673
|
* Counts how many symbols matching the criteria are on a specific reel.
|
|
4625
4674
|
*/
|