@slot-engine/core 0.1.7 → 0.1.8
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 +92 -6
- package/dist/index.d.ts +92 -6
- package/dist/index.js +153 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +153 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -452,6 +452,10 @@ declare class BoardService<TGameModes extends AnyGameModes = AnyGameModes, TSymb
|
|
|
452
452
|
* Sets the symbol at the specified reel and row index.
|
|
453
453
|
*/
|
|
454
454
|
setSymbol(reelIndex: number, rowIndex: number, symbol: GameSymbol): void;
|
|
455
|
+
/**
|
|
456
|
+
* Removes the symbol at the specified reel and row index.
|
|
457
|
+
*/
|
|
458
|
+
removeSymbol(reelIndex: number, rowIndex: number): void;
|
|
455
459
|
private resetReels;
|
|
456
460
|
/**
|
|
457
461
|
* Sets the anticipation value for a specific reel.
|
|
@@ -502,11 +506,15 @@ declare class BoardService<TGameModes extends AnyGameModes = AnyGameModes, TSymb
|
|
|
502
506
|
reels: Reels;
|
|
503
507
|
forcedStops: Record<string, number>;
|
|
504
508
|
randomOffset?: boolean;
|
|
505
|
-
}):
|
|
509
|
+
}): {
|
|
510
|
+
stopPositions: number[];
|
|
511
|
+
};
|
|
506
512
|
/**
|
|
507
513
|
* Draws a board using random reel stops.
|
|
508
514
|
*/
|
|
509
|
-
drawBoardWithRandomStops(reels: Reels):
|
|
515
|
+
drawBoardWithRandomStops(reels: Reels): {
|
|
516
|
+
stopPositions: number[];
|
|
517
|
+
};
|
|
510
518
|
private drawBoardMixed;
|
|
511
519
|
/**
|
|
512
520
|
* Tumbles the board. All given symbols will be deleted and new symbols will fall from the top.
|
|
@@ -518,6 +526,24 @@ declare class BoardService<TGameModes extends AnyGameModes = AnyGameModes, TSymb
|
|
|
518
526
|
newBoardSymbols: Record<string, GameSymbol[]>;
|
|
519
527
|
newPaddingTopSymbols: Record<string, GameSymbol[]>;
|
|
520
528
|
};
|
|
529
|
+
/**
|
|
530
|
+
* **Experimental - May be changed or replaced in the future**
|
|
531
|
+
*
|
|
532
|
+
* Tumbles the board normally like `tumbleBoard`, but allows specifying a different reel set to get symbols from.\
|
|
533
|
+
* Also requires specifying the starting stops from where the symbols will be tumbled.\
|
|
534
|
+
* **This method does not remember the last tumbled position. Use this if you need to do a singular one-off tumble.**
|
|
535
|
+
*/
|
|
536
|
+
tumbleBoardAndForget(opts: {
|
|
537
|
+
symbolsToDelete: Array<{
|
|
538
|
+
reelIdx: number;
|
|
539
|
+
rowIdx: number;
|
|
540
|
+
}>;
|
|
541
|
+
reels: Reels;
|
|
542
|
+
forcedStops: number[];
|
|
543
|
+
}): {
|
|
544
|
+
newBoardSymbols: Record<string, GameSymbol[]>;
|
|
545
|
+
newPaddingTopSymbols: Record<string, GameSymbol[]>;
|
|
546
|
+
};
|
|
521
547
|
/**
|
|
522
548
|
* Dedupes win symbols for tumble.\
|
|
523
549
|
* Returns a list of symbols to remove from the board based on the given win combinations.
|
|
@@ -529,6 +555,18 @@ declare class BoardService<TGameModes extends AnyGameModes = AnyGameModes, TSymb
|
|
|
529
555
|
reelIdx: number;
|
|
530
556
|
rowIdx: number;
|
|
531
557
|
}[];
|
|
558
|
+
/**
|
|
559
|
+
* Sets the symbolsPerReel for the current game mode.
|
|
560
|
+
*
|
|
561
|
+
* The value will be reset to the original value as set in the game mode config in the next simulation.
|
|
562
|
+
*/
|
|
563
|
+
setSymbolsPerReel(symbolsPerReel: number[]): void;
|
|
564
|
+
/**
|
|
565
|
+
* Sets the reelsAmount for the current game mode.
|
|
566
|
+
*
|
|
567
|
+
* The value will be reset to the original value as set in the game mode config in the next simulation.
|
|
568
|
+
*/
|
|
569
|
+
setReelsAmount(reelsAmount: number): void;
|
|
532
570
|
}
|
|
533
571
|
|
|
534
572
|
declare class Recorder {
|
|
@@ -721,14 +759,28 @@ interface ReelSetOptions {
|
|
|
721
759
|
|
|
722
760
|
declare class GameMode {
|
|
723
761
|
readonly name: string;
|
|
724
|
-
readonly
|
|
725
|
-
readonly
|
|
762
|
+
private readonly _reelsAmount;
|
|
763
|
+
private readonly _symbolsPerReel;
|
|
764
|
+
reelsAmount: number;
|
|
765
|
+
symbolsPerReel: number[];
|
|
726
766
|
readonly cost: number;
|
|
727
767
|
readonly rtp: number;
|
|
728
768
|
readonly reelSets: ReelSet[];
|
|
729
769
|
readonly resultSets: ResultSet<any>[];
|
|
730
770
|
readonly isBonusBuy: boolean;
|
|
731
771
|
constructor(opts: GameModeOpts);
|
|
772
|
+
/**
|
|
773
|
+
* Intended for internal use only.
|
|
774
|
+
*/
|
|
775
|
+
_resetTempValues(): void;
|
|
776
|
+
/**
|
|
777
|
+
* Intended for internal use only.
|
|
778
|
+
*/
|
|
779
|
+
_setSymbolsPerReel(symbolsPerReel: number[]): void;
|
|
780
|
+
/**
|
|
781
|
+
* Intended for internal use only.
|
|
782
|
+
*/
|
|
783
|
+
_setReelsAmount(reelsAmount: number): void;
|
|
732
784
|
}
|
|
733
785
|
interface GameModeOpts {
|
|
734
786
|
/**
|
|
@@ -1528,6 +1580,10 @@ declare class StandaloneBoard {
|
|
|
1528
1580
|
* Sets the symbol at the specified reel and row index.
|
|
1529
1581
|
*/
|
|
1530
1582
|
setSymbol(reelIndex: number, rowIndex: number, symbol: GameSymbol): void;
|
|
1583
|
+
/**
|
|
1584
|
+
* Removes the symbol at the specified reel and row index.
|
|
1585
|
+
*/
|
|
1586
|
+
removeSymbol(reelIndex: number, rowIndex: number): void;
|
|
1531
1587
|
private resetReels;
|
|
1532
1588
|
/**
|
|
1533
1589
|
* Sets the anticipation value for a specific reel.
|
|
@@ -1578,11 +1634,15 @@ declare class StandaloneBoard {
|
|
|
1578
1634
|
reels: Reels;
|
|
1579
1635
|
forcedStops: Record<string, number>;
|
|
1580
1636
|
randomOffset?: boolean;
|
|
1581
|
-
}):
|
|
1637
|
+
}): {
|
|
1638
|
+
stopPositions: number[];
|
|
1639
|
+
};
|
|
1582
1640
|
/**
|
|
1583
1641
|
* Draws a board using random reel stops.
|
|
1584
1642
|
*/
|
|
1585
|
-
drawBoardWithRandomStops(reels: Reels):
|
|
1643
|
+
drawBoardWithRandomStops(reels: Reels): {
|
|
1644
|
+
stopPositions: number[];
|
|
1645
|
+
};
|
|
1586
1646
|
private drawBoardMixed;
|
|
1587
1647
|
/**
|
|
1588
1648
|
* Tumbles the board. All given symbols will be deleted and new symbols will fall from the top.
|
|
@@ -1594,6 +1654,24 @@ declare class StandaloneBoard {
|
|
|
1594
1654
|
newBoardSymbols: Record<string, GameSymbol[]>;
|
|
1595
1655
|
newPaddingTopSymbols: Record<string, GameSymbol[]>;
|
|
1596
1656
|
};
|
|
1657
|
+
/**
|
|
1658
|
+
* **Experimental - May be changed or replaced in the future**
|
|
1659
|
+
*
|
|
1660
|
+
* Tumbles the board normally like `tumbleBoard`, but allows specifying a different reel set to get symbols from.\
|
|
1661
|
+
* Also requires specifying the starting stops from where the symbols will be tumbled.\
|
|
1662
|
+
* **This method does not remember the last tumbled position. Use this if you need to do a singular one-off tumble.**
|
|
1663
|
+
*/
|
|
1664
|
+
tumbleBoardAndForget(opts: {
|
|
1665
|
+
symbolsToDelete: Array<{
|
|
1666
|
+
reelIdx: number;
|
|
1667
|
+
rowIdx: number;
|
|
1668
|
+
}>;
|
|
1669
|
+
reels: Reels;
|
|
1670
|
+
forcedStops: number[];
|
|
1671
|
+
}): {
|
|
1672
|
+
newBoardSymbols: Record<string, GameSymbol[]>;
|
|
1673
|
+
newPaddingTopSymbols: Record<string, GameSymbol[]>;
|
|
1674
|
+
};
|
|
1597
1675
|
/**
|
|
1598
1676
|
* Dedupes win symbols for tumble.\
|
|
1599
1677
|
* Returns a list of symbols to remove from the board based on the given win combinations.
|
|
@@ -1605,6 +1683,14 @@ declare class StandaloneBoard {
|
|
|
1605
1683
|
reelIdx: number;
|
|
1606
1684
|
rowIdx: number;
|
|
1607
1685
|
}[];
|
|
1686
|
+
/**
|
|
1687
|
+
* Sets symbolsPerReel.
|
|
1688
|
+
*/
|
|
1689
|
+
setSymbolsPerReel(symbolsPerReel: number[]): void;
|
|
1690
|
+
/**
|
|
1691
|
+
* Sets the reelsAmount.
|
|
1692
|
+
*/
|
|
1693
|
+
setReelsAmount(reelsAmount: number): void;
|
|
1608
1694
|
}
|
|
1609
1695
|
interface StandaloneBoardOptions {
|
|
1610
1696
|
ctx: GameContext;
|
package/dist/index.d.ts
CHANGED
|
@@ -452,6 +452,10 @@ declare class BoardService<TGameModes extends AnyGameModes = AnyGameModes, TSymb
|
|
|
452
452
|
* Sets the symbol at the specified reel and row index.
|
|
453
453
|
*/
|
|
454
454
|
setSymbol(reelIndex: number, rowIndex: number, symbol: GameSymbol): void;
|
|
455
|
+
/**
|
|
456
|
+
* Removes the symbol at the specified reel and row index.
|
|
457
|
+
*/
|
|
458
|
+
removeSymbol(reelIndex: number, rowIndex: number): void;
|
|
455
459
|
private resetReels;
|
|
456
460
|
/**
|
|
457
461
|
* Sets the anticipation value for a specific reel.
|
|
@@ -502,11 +506,15 @@ declare class BoardService<TGameModes extends AnyGameModes = AnyGameModes, TSymb
|
|
|
502
506
|
reels: Reels;
|
|
503
507
|
forcedStops: Record<string, number>;
|
|
504
508
|
randomOffset?: boolean;
|
|
505
|
-
}):
|
|
509
|
+
}): {
|
|
510
|
+
stopPositions: number[];
|
|
511
|
+
};
|
|
506
512
|
/**
|
|
507
513
|
* Draws a board using random reel stops.
|
|
508
514
|
*/
|
|
509
|
-
drawBoardWithRandomStops(reels: Reels):
|
|
515
|
+
drawBoardWithRandomStops(reels: Reels): {
|
|
516
|
+
stopPositions: number[];
|
|
517
|
+
};
|
|
510
518
|
private drawBoardMixed;
|
|
511
519
|
/**
|
|
512
520
|
* Tumbles the board. All given symbols will be deleted and new symbols will fall from the top.
|
|
@@ -518,6 +526,24 @@ declare class BoardService<TGameModes extends AnyGameModes = AnyGameModes, TSymb
|
|
|
518
526
|
newBoardSymbols: Record<string, GameSymbol[]>;
|
|
519
527
|
newPaddingTopSymbols: Record<string, GameSymbol[]>;
|
|
520
528
|
};
|
|
529
|
+
/**
|
|
530
|
+
* **Experimental - May be changed or replaced in the future**
|
|
531
|
+
*
|
|
532
|
+
* Tumbles the board normally like `tumbleBoard`, but allows specifying a different reel set to get symbols from.\
|
|
533
|
+
* Also requires specifying the starting stops from where the symbols will be tumbled.\
|
|
534
|
+
* **This method does not remember the last tumbled position. Use this if you need to do a singular one-off tumble.**
|
|
535
|
+
*/
|
|
536
|
+
tumbleBoardAndForget(opts: {
|
|
537
|
+
symbolsToDelete: Array<{
|
|
538
|
+
reelIdx: number;
|
|
539
|
+
rowIdx: number;
|
|
540
|
+
}>;
|
|
541
|
+
reels: Reels;
|
|
542
|
+
forcedStops: number[];
|
|
543
|
+
}): {
|
|
544
|
+
newBoardSymbols: Record<string, GameSymbol[]>;
|
|
545
|
+
newPaddingTopSymbols: Record<string, GameSymbol[]>;
|
|
546
|
+
};
|
|
521
547
|
/**
|
|
522
548
|
* Dedupes win symbols for tumble.\
|
|
523
549
|
* Returns a list of symbols to remove from the board based on the given win combinations.
|
|
@@ -529,6 +555,18 @@ declare class BoardService<TGameModes extends AnyGameModes = AnyGameModes, TSymb
|
|
|
529
555
|
reelIdx: number;
|
|
530
556
|
rowIdx: number;
|
|
531
557
|
}[];
|
|
558
|
+
/**
|
|
559
|
+
* Sets the symbolsPerReel for the current game mode.
|
|
560
|
+
*
|
|
561
|
+
* The value will be reset to the original value as set in the game mode config in the next simulation.
|
|
562
|
+
*/
|
|
563
|
+
setSymbolsPerReel(symbolsPerReel: number[]): void;
|
|
564
|
+
/**
|
|
565
|
+
* Sets the reelsAmount for the current game mode.
|
|
566
|
+
*
|
|
567
|
+
* The value will be reset to the original value as set in the game mode config in the next simulation.
|
|
568
|
+
*/
|
|
569
|
+
setReelsAmount(reelsAmount: number): void;
|
|
532
570
|
}
|
|
533
571
|
|
|
534
572
|
declare class Recorder {
|
|
@@ -721,14 +759,28 @@ interface ReelSetOptions {
|
|
|
721
759
|
|
|
722
760
|
declare class GameMode {
|
|
723
761
|
readonly name: string;
|
|
724
|
-
readonly
|
|
725
|
-
readonly
|
|
762
|
+
private readonly _reelsAmount;
|
|
763
|
+
private readonly _symbolsPerReel;
|
|
764
|
+
reelsAmount: number;
|
|
765
|
+
symbolsPerReel: number[];
|
|
726
766
|
readonly cost: number;
|
|
727
767
|
readonly rtp: number;
|
|
728
768
|
readonly reelSets: ReelSet[];
|
|
729
769
|
readonly resultSets: ResultSet<any>[];
|
|
730
770
|
readonly isBonusBuy: boolean;
|
|
731
771
|
constructor(opts: GameModeOpts);
|
|
772
|
+
/**
|
|
773
|
+
* Intended for internal use only.
|
|
774
|
+
*/
|
|
775
|
+
_resetTempValues(): void;
|
|
776
|
+
/**
|
|
777
|
+
* Intended for internal use only.
|
|
778
|
+
*/
|
|
779
|
+
_setSymbolsPerReel(symbolsPerReel: number[]): void;
|
|
780
|
+
/**
|
|
781
|
+
* Intended for internal use only.
|
|
782
|
+
*/
|
|
783
|
+
_setReelsAmount(reelsAmount: number): void;
|
|
732
784
|
}
|
|
733
785
|
interface GameModeOpts {
|
|
734
786
|
/**
|
|
@@ -1528,6 +1580,10 @@ declare class StandaloneBoard {
|
|
|
1528
1580
|
* Sets the symbol at the specified reel and row index.
|
|
1529
1581
|
*/
|
|
1530
1582
|
setSymbol(reelIndex: number, rowIndex: number, symbol: GameSymbol): void;
|
|
1583
|
+
/**
|
|
1584
|
+
* Removes the symbol at the specified reel and row index.
|
|
1585
|
+
*/
|
|
1586
|
+
removeSymbol(reelIndex: number, rowIndex: number): void;
|
|
1531
1587
|
private resetReels;
|
|
1532
1588
|
/**
|
|
1533
1589
|
* Sets the anticipation value for a specific reel.
|
|
@@ -1578,11 +1634,15 @@ declare class StandaloneBoard {
|
|
|
1578
1634
|
reels: Reels;
|
|
1579
1635
|
forcedStops: Record<string, number>;
|
|
1580
1636
|
randomOffset?: boolean;
|
|
1581
|
-
}):
|
|
1637
|
+
}): {
|
|
1638
|
+
stopPositions: number[];
|
|
1639
|
+
};
|
|
1582
1640
|
/**
|
|
1583
1641
|
* Draws a board using random reel stops.
|
|
1584
1642
|
*/
|
|
1585
|
-
drawBoardWithRandomStops(reels: Reels):
|
|
1643
|
+
drawBoardWithRandomStops(reels: Reels): {
|
|
1644
|
+
stopPositions: number[];
|
|
1645
|
+
};
|
|
1586
1646
|
private drawBoardMixed;
|
|
1587
1647
|
/**
|
|
1588
1648
|
* Tumbles the board. All given symbols will be deleted and new symbols will fall from the top.
|
|
@@ -1594,6 +1654,24 @@ declare class StandaloneBoard {
|
|
|
1594
1654
|
newBoardSymbols: Record<string, GameSymbol[]>;
|
|
1595
1655
|
newPaddingTopSymbols: Record<string, GameSymbol[]>;
|
|
1596
1656
|
};
|
|
1657
|
+
/**
|
|
1658
|
+
* **Experimental - May be changed or replaced in the future**
|
|
1659
|
+
*
|
|
1660
|
+
* Tumbles the board normally like `tumbleBoard`, but allows specifying a different reel set to get symbols from.\
|
|
1661
|
+
* Also requires specifying the starting stops from where the symbols will be tumbled.\
|
|
1662
|
+
* **This method does not remember the last tumbled position. Use this if you need to do a singular one-off tumble.**
|
|
1663
|
+
*/
|
|
1664
|
+
tumbleBoardAndForget(opts: {
|
|
1665
|
+
symbolsToDelete: Array<{
|
|
1666
|
+
reelIdx: number;
|
|
1667
|
+
rowIdx: number;
|
|
1668
|
+
}>;
|
|
1669
|
+
reels: Reels;
|
|
1670
|
+
forcedStops: number[];
|
|
1671
|
+
}): {
|
|
1672
|
+
newBoardSymbols: Record<string, GameSymbol[]>;
|
|
1673
|
+
newPaddingTopSymbols: Record<string, GameSymbol[]>;
|
|
1674
|
+
};
|
|
1597
1675
|
/**
|
|
1598
1676
|
* Dedupes win symbols for tumble.\
|
|
1599
1677
|
* Returns a list of symbols to remove from the board based on the given win combinations.
|
|
@@ -1605,6 +1683,14 @@ declare class StandaloneBoard {
|
|
|
1605
1683
|
reelIdx: number;
|
|
1606
1684
|
rowIdx: number;
|
|
1607
1685
|
}[];
|
|
1686
|
+
/**
|
|
1687
|
+
* Sets symbolsPerReel.
|
|
1688
|
+
*/
|
|
1689
|
+
setSymbolsPerReel(symbolsPerReel: number[]): void;
|
|
1690
|
+
/**
|
|
1691
|
+
* Sets the reelsAmount.
|
|
1692
|
+
*/
|
|
1693
|
+
setReelsAmount(reelsAmount: number): void;
|
|
1608
1694
|
}
|
|
1609
1695
|
interface StandaloneBoardOptions {
|
|
1610
1696
|
ctx: GameContext;
|
package/dist/index.js
CHANGED
|
@@ -523,6 +523,11 @@ var Board = class {
|
|
|
523
523
|
this.reels[reelIndex] = this.reels[reelIndex] || [];
|
|
524
524
|
this.reels[reelIndex][rowIndex] = symbol;
|
|
525
525
|
}
|
|
526
|
+
removeSymbol(reelIndex, rowIndex) {
|
|
527
|
+
if (this.reels[reelIndex]) {
|
|
528
|
+
this.reels[reelIndex].splice(rowIndex, 1);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
526
531
|
makeEmptyReels(opts) {
|
|
527
532
|
const length = opts.reelsAmount ?? opts.ctx.services.game.getCurrentGameMode().reelsAmount;
|
|
528
533
|
(0, import_assert3.default)(length, "Cannot make empty reels without context or reelsAmount.");
|
|
@@ -712,18 +717,35 @@ var Board = class {
|
|
|
712
717
|
this.reels[ridx][row] = symbol;
|
|
713
718
|
}
|
|
714
719
|
}
|
|
720
|
+
return {
|
|
721
|
+
stopPositions: this.lastDrawnReelStops
|
|
722
|
+
};
|
|
715
723
|
}
|
|
716
724
|
tumbleBoard(opts) {
|
|
717
725
|
(0, import_assert3.default)(this.lastDrawnReelStops.length > 0, "Cannot tumble board before drawing it.");
|
|
718
726
|
const reelsAmount = opts.reelsAmount ?? opts.ctx.services.game.getCurrentGameMode().reelsAmount;
|
|
719
727
|
const symbolsPerReel = opts.symbolsPerReel ?? opts.ctx.services.game.getCurrentGameMode().symbolsPerReel;
|
|
720
728
|
const padSymbols = opts.padSymbols ?? opts.ctx.config.padSymbols;
|
|
729
|
+
if (opts.startingStops) {
|
|
730
|
+
(0, import_assert3.default)(
|
|
731
|
+
opts.startingStops.length === reelsAmount,
|
|
732
|
+
"Starting stops length does not match reels amount."
|
|
733
|
+
);
|
|
734
|
+
(0, import_assert3.default)(opts.reels, "Reels must be provided when using startingStops.");
|
|
735
|
+
}
|
|
736
|
+
if (opts.reels) {
|
|
737
|
+
(0, import_assert3.default)(opts.startingStops, "Starting stops must be provided when using reels.");
|
|
738
|
+
}
|
|
721
739
|
if (!opts.ctx && !reelsAmount && !symbolsPerReel) {
|
|
722
740
|
throw new Error(
|
|
723
741
|
"If ctx is not provided, reelsAmount and symbolsPerReel must be given."
|
|
724
742
|
);
|
|
725
743
|
}
|
|
726
|
-
const reels = this.lastUsedReels;
|
|
744
|
+
const reels = opts.reels || this.lastUsedReels;
|
|
745
|
+
(0, import_assert3.default)(
|
|
746
|
+
reels.length === reelsAmount,
|
|
747
|
+
"Given reels length does not match reels amount."
|
|
748
|
+
);
|
|
727
749
|
const sortedDeletions = [...opts.symbolsToDelete].sort((a, b) => b.rowIdx - a.rowIdx);
|
|
728
750
|
sortedDeletions.forEach(({ reelIdx, rowIdx }) => {
|
|
729
751
|
this.reels[reelIdx].splice(rowIdx, 1);
|
|
@@ -733,7 +755,7 @@ var Board = class {
|
|
|
733
755
|
const newPaddingTopSymbols = {};
|
|
734
756
|
for (let ridx = 0; ridx < reelsAmount; ridx++) {
|
|
735
757
|
while (this.reels[ridx].length < symbolsPerReel[ridx]) {
|
|
736
|
-
const padSymbol = this.paddingTop[ridx]
|
|
758
|
+
const padSymbol = this.paddingTop[ridx]?.pop();
|
|
737
759
|
if (padSymbol) {
|
|
738
760
|
this.reels[ridx].unshift(padSymbol);
|
|
739
761
|
if (!newBoardSymbols[ridx]) {
|
|
@@ -749,7 +771,16 @@ var Board = class {
|
|
|
749
771
|
const symbolsNeeded = symbolsPerReel[ridx] - this.reels[ridx].length;
|
|
750
772
|
for (let s = 0; s < symbolsNeeded; s++) {
|
|
751
773
|
const symbolPos = (stopBeforePad - s + reels[ridx].length) % reels[ridx].length;
|
|
752
|
-
|
|
774
|
+
let newSymbol = reels[ridx][symbolPos];
|
|
775
|
+
const startStops = opts.startingStops;
|
|
776
|
+
if (startStops) {
|
|
777
|
+
const forcedSym = reels[ridx][startStops?.[ridx]];
|
|
778
|
+
(0, import_assert3.default)(
|
|
779
|
+
forcedSym,
|
|
780
|
+
`Failed to get forced symbol for tumbling. Tried to get symbol for position ${startStops?.[ridx]} on reel ${ridx}.`
|
|
781
|
+
);
|
|
782
|
+
newSymbol = forcedSym;
|
|
783
|
+
}
|
|
753
784
|
(0, import_assert3.default)(newSymbol, "Failed to get new symbol for tumbling.");
|
|
754
785
|
this.reels[ridx].unshift(newSymbol);
|
|
755
786
|
newFirstSymbolPositions[ridx] = symbolPos;
|
|
@@ -773,9 +804,11 @@ var Board = class {
|
|
|
773
804
|
newPaddingTopSymbols[ridx].unshift(padSymbol);
|
|
774
805
|
}
|
|
775
806
|
}
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
807
|
+
if (!opts.reels && !opts.startingStops) {
|
|
808
|
+
this.lastDrawnReelStops = this.lastDrawnReelStops.map((stop, ridx) => {
|
|
809
|
+
return newFirstSymbolPositions[ridx] ?? stop;
|
|
810
|
+
});
|
|
811
|
+
}
|
|
779
812
|
return {
|
|
780
813
|
newBoardSymbols,
|
|
781
814
|
newPaddingTopSymbols
|
|
@@ -838,6 +871,12 @@ var BoardService = class extends AbstractService {
|
|
|
838
871
|
setSymbol(reelIndex, rowIndex, symbol) {
|
|
839
872
|
this.board.setSymbol(reelIndex, rowIndex, symbol);
|
|
840
873
|
}
|
|
874
|
+
/**
|
|
875
|
+
* Removes the symbol at the specified reel and row index.
|
|
876
|
+
*/
|
|
877
|
+
removeSymbol(reelIndex, rowIndex) {
|
|
878
|
+
this.board.removeSymbol(reelIndex, rowIndex);
|
|
879
|
+
}
|
|
841
880
|
resetReels() {
|
|
842
881
|
this.board.resetReels({
|
|
843
882
|
ctx: this.ctx()
|
|
@@ -913,16 +952,16 @@ var BoardService = class extends AbstractService {
|
|
|
913
952
|
* Draws a board using specified reel stops.
|
|
914
953
|
*/
|
|
915
954
|
drawBoardWithForcedStops(opts) {
|
|
916
|
-
this.drawBoardMixed(opts.reels, opts.forcedStops, opts.randomOffset);
|
|
955
|
+
return this.drawBoardMixed(opts.reels, opts.forcedStops, opts.randomOffset);
|
|
917
956
|
}
|
|
918
957
|
/**
|
|
919
958
|
* Draws a board using random reel stops.
|
|
920
959
|
*/
|
|
921
960
|
drawBoardWithRandomStops(reels) {
|
|
922
|
-
this.drawBoardMixed(reels);
|
|
961
|
+
return this.drawBoardMixed(reels);
|
|
923
962
|
}
|
|
924
963
|
drawBoardMixed(reels, forcedStops, forcedStopsOffset) {
|
|
925
|
-
this.board.drawBoardMixed({
|
|
964
|
+
return this.board.drawBoardMixed({
|
|
926
965
|
ctx: this.ctx(),
|
|
927
966
|
reels,
|
|
928
967
|
forcedStops,
|
|
@@ -938,6 +977,21 @@ var BoardService = class extends AbstractService {
|
|
|
938
977
|
symbolsToDelete
|
|
939
978
|
});
|
|
940
979
|
}
|
|
980
|
+
/**
|
|
981
|
+
* **Experimental - May be changed or replaced in the future**
|
|
982
|
+
*
|
|
983
|
+
* Tumbles the board normally like `tumbleBoard`, but allows specifying a different reel set to get symbols from.\
|
|
984
|
+
* Also requires specifying the starting stops from where the symbols will be tumbled.\
|
|
985
|
+
* **This method does not remember the last tumbled position. Use this if you need to do a singular one-off tumble.**
|
|
986
|
+
*/
|
|
987
|
+
tumbleBoardAndForget(opts) {
|
|
988
|
+
return this.board.tumbleBoard({
|
|
989
|
+
ctx: this.ctx(),
|
|
990
|
+
symbolsToDelete: opts.symbolsToDelete,
|
|
991
|
+
reels: opts.reels,
|
|
992
|
+
startingStops: opts.forcedStops
|
|
993
|
+
});
|
|
994
|
+
}
|
|
941
995
|
/**
|
|
942
996
|
* Dedupes win symbols for tumble.\
|
|
943
997
|
* Returns a list of symbols to remove from the board based on the given win combinations.
|
|
@@ -948,6 +1002,26 @@ var BoardService = class extends AbstractService {
|
|
|
948
1002
|
dedupeWinSymbolsForTumble(winCombinations) {
|
|
949
1003
|
return this.board.dedupeWinSymbolsForTumble(winCombinations);
|
|
950
1004
|
}
|
|
1005
|
+
/**
|
|
1006
|
+
* Sets the symbolsPerReel for the current game mode.
|
|
1007
|
+
*
|
|
1008
|
+
* The value will be reset to the original value as set in the game mode config in the next simulation.
|
|
1009
|
+
*/
|
|
1010
|
+
setSymbolsPerReel(symbolsPerReel) {
|
|
1011
|
+
this.ctx().config.gameModes[this.ctx().state.currentGameMode]._setSymbolsPerReel(
|
|
1012
|
+
symbolsPerReel
|
|
1013
|
+
);
|
|
1014
|
+
}
|
|
1015
|
+
/**
|
|
1016
|
+
* Sets the reelsAmount for the current game mode.
|
|
1017
|
+
*
|
|
1018
|
+
* The value will be reset to the original value as set in the game mode config in the next simulation.
|
|
1019
|
+
*/
|
|
1020
|
+
setReelsAmount(reelsAmount) {
|
|
1021
|
+
this.ctx().config.gameModes[this.ctx().state.currentGameMode]._setReelsAmount(
|
|
1022
|
+
reelsAmount
|
|
1023
|
+
);
|
|
1024
|
+
}
|
|
951
1025
|
};
|
|
952
1026
|
|
|
953
1027
|
// src/service/data.ts
|
|
@@ -1852,6 +1926,9 @@ ${error.stack}
|
|
|
1852
1926
|
criteria: ctx.state.currentResultSet.criteria
|
|
1853
1927
|
})
|
|
1854
1928
|
);
|
|
1929
|
+
Object.values(ctx.config.gameModes).forEach((mode) => {
|
|
1930
|
+
mode._resetTempValues();
|
|
1931
|
+
});
|
|
1855
1932
|
}
|
|
1856
1933
|
resetState(ctx) {
|
|
1857
1934
|
ctx.services.rng.setSeedIfDifferent(ctx.state.currentSimulationId);
|
|
@@ -2800,6 +2877,8 @@ var defineGameModes = (gameModes) => gameModes;
|
|
|
2800
2877
|
var import_assert10 = __toESM(require("assert"));
|
|
2801
2878
|
var GameMode = class {
|
|
2802
2879
|
name;
|
|
2880
|
+
_reelsAmount;
|
|
2881
|
+
_symbolsPerReel;
|
|
2803
2882
|
reelsAmount;
|
|
2804
2883
|
symbolsPerReel;
|
|
2805
2884
|
cost;
|
|
@@ -2809,7 +2888,9 @@ var GameMode = class {
|
|
|
2809
2888
|
isBonusBuy;
|
|
2810
2889
|
constructor(opts) {
|
|
2811
2890
|
this.name = opts.name;
|
|
2891
|
+
this._reelsAmount = opts.reelsAmount;
|
|
2812
2892
|
this.reelsAmount = opts.reelsAmount;
|
|
2893
|
+
this._symbolsPerReel = opts.symbolsPerReel;
|
|
2813
2894
|
this.symbolsPerReel = opts.symbolsPerReel;
|
|
2814
2895
|
this.cost = opts.cost;
|
|
2815
2896
|
this.rtp = opts.rtp;
|
|
@@ -2823,6 +2904,29 @@ var GameMode = class {
|
|
|
2823
2904
|
);
|
|
2824
2905
|
(0, import_assert10.default)(this.reelSets.length > 0, "GameMode must have at least one ReelSet defined.");
|
|
2825
2906
|
}
|
|
2907
|
+
/**
|
|
2908
|
+
* Intended for internal use only.
|
|
2909
|
+
*/
|
|
2910
|
+
_resetTempValues() {
|
|
2911
|
+
this.reelsAmount = this._reelsAmount;
|
|
2912
|
+
this.symbolsPerReel = this._symbolsPerReel;
|
|
2913
|
+
}
|
|
2914
|
+
/**
|
|
2915
|
+
* Intended for internal use only.
|
|
2916
|
+
*/
|
|
2917
|
+
_setSymbolsPerReel(symbolsPerReel) {
|
|
2918
|
+
(0, import_assert10.default)(
|
|
2919
|
+
symbolsPerReel.length === this._reelsAmount,
|
|
2920
|
+
"symbolsPerReel length must match reelsAmount."
|
|
2921
|
+
);
|
|
2922
|
+
this.symbolsPerReel = symbolsPerReel;
|
|
2923
|
+
}
|
|
2924
|
+
/**
|
|
2925
|
+
* Intended for internal use only.
|
|
2926
|
+
*/
|
|
2927
|
+
_setReelsAmount(reelsAmount) {
|
|
2928
|
+
this.reelsAmount = reelsAmount;
|
|
2929
|
+
}
|
|
2826
2930
|
};
|
|
2827
2931
|
|
|
2828
2932
|
// src/win-types/index.ts
|
|
@@ -3705,6 +3809,12 @@ var StandaloneBoard = class {
|
|
|
3705
3809
|
setSymbol(reelIndex, rowIndex, symbol) {
|
|
3706
3810
|
this.board.setSymbol(reelIndex, rowIndex, symbol);
|
|
3707
3811
|
}
|
|
3812
|
+
/**
|
|
3813
|
+
* Removes the symbol at the specified reel and row index.
|
|
3814
|
+
*/
|
|
3815
|
+
removeSymbol(reelIndex, rowIndex) {
|
|
3816
|
+
this.board.removeSymbol(reelIndex, rowIndex);
|
|
3817
|
+
}
|
|
3708
3818
|
resetReels() {
|
|
3709
3819
|
this.board.resetReels({
|
|
3710
3820
|
ctx: this.ctx
|
|
@@ -3781,16 +3891,16 @@ var StandaloneBoard = class {
|
|
|
3781
3891
|
* Draws a board using specified reel stops.
|
|
3782
3892
|
*/
|
|
3783
3893
|
drawBoardWithForcedStops(opts) {
|
|
3784
|
-
this.drawBoardMixed(opts.reels, opts.forcedStops, opts.randomOffset);
|
|
3894
|
+
return this.drawBoardMixed(opts.reels, opts.forcedStops, opts.randomOffset);
|
|
3785
3895
|
}
|
|
3786
3896
|
/**
|
|
3787
3897
|
* Draws a board using random reel stops.
|
|
3788
3898
|
*/
|
|
3789
3899
|
drawBoardWithRandomStops(reels) {
|
|
3790
|
-
this.drawBoardMixed(reels);
|
|
3900
|
+
return this.drawBoardMixed(reels);
|
|
3791
3901
|
}
|
|
3792
3902
|
drawBoardMixed(reels, forcedStops, forcedStopsOffset) {
|
|
3793
|
-
this.board.drawBoardMixed({
|
|
3903
|
+
return this.board.drawBoardMixed({
|
|
3794
3904
|
ctx: this.ctx,
|
|
3795
3905
|
reels,
|
|
3796
3906
|
forcedStops,
|
|
@@ -3812,16 +3922,46 @@ var StandaloneBoard = class {
|
|
|
3812
3922
|
padSymbols: this.padSymbols
|
|
3813
3923
|
});
|
|
3814
3924
|
}
|
|
3925
|
+
/**
|
|
3926
|
+
* **Experimental - May be changed or replaced in the future**
|
|
3927
|
+
*
|
|
3928
|
+
* Tumbles the board normally like `tumbleBoard`, but allows specifying a different reel set to get symbols from.\
|
|
3929
|
+
* Also requires specifying the starting stops from where the symbols will be tumbled.\
|
|
3930
|
+
* **This method does not remember the last tumbled position. Use this if you need to do a singular one-off tumble.**
|
|
3931
|
+
*/
|
|
3932
|
+
tumbleBoardAndForget(opts) {
|
|
3933
|
+
return this.board.tumbleBoard({
|
|
3934
|
+
ctx: this.ctx,
|
|
3935
|
+
symbolsToDelete: opts.symbolsToDelete,
|
|
3936
|
+
reelsAmount: this.reelsAmount,
|
|
3937
|
+
symbolsPerReel: this.symbolsPerReel,
|
|
3938
|
+
padSymbols: this.padSymbols,
|
|
3939
|
+
reels: opts.reels,
|
|
3940
|
+
startingStops: opts.forcedStops
|
|
3941
|
+
});
|
|
3942
|
+
}
|
|
3815
3943
|
/**
|
|
3816
3944
|
* Dedupes win symbols for tumble.\
|
|
3817
3945
|
* Returns a list of symbols to remove from the board based on the given win combinations.
|
|
3818
|
-
*
|
|
3946
|
+
*
|
|
3819
3947
|
* Since it may be possible that multiple win combinations include the same symbol (e.g. Wilds),\
|
|
3820
3948
|
* this method ensures that each symbol is only listed once for removal. Otherwise tumbling may break.
|
|
3821
3949
|
*/
|
|
3822
3950
|
dedupeWinSymbolsForTumble(winCombinations) {
|
|
3823
3951
|
return this.board.dedupeWinSymbolsForTumble(winCombinations);
|
|
3824
3952
|
}
|
|
3953
|
+
/**
|
|
3954
|
+
* Sets symbolsPerReel.
|
|
3955
|
+
*/
|
|
3956
|
+
setSymbolsPerReel(symbolsPerReel) {
|
|
3957
|
+
this.symbolsPerReel = symbolsPerReel;
|
|
3958
|
+
}
|
|
3959
|
+
/**
|
|
3960
|
+
* Sets the reelsAmount.
|
|
3961
|
+
*/
|
|
3962
|
+
setReelsAmount(reelsAmount) {
|
|
3963
|
+
this.reelsAmount = reelsAmount;
|
|
3964
|
+
}
|
|
3825
3965
|
};
|
|
3826
3966
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3827
3967
|
0 && (module.exports = {
|