@slot-engine/core 0.0.11 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,3 @@
1
- > [!NOTE]
2
- > This software **is work in progress** and may currently miss features or contain bugs. Feel free to contribute to help improve this project. Breaking changes may occur at any time.
3
-
4
1
  # Slot Engine Core
5
2
 
6
3
  Library for configuring and simulating slot games. Produces output compatible with Stake Engine / Stake RGS.
package/dist/index.d.mts CHANGED
@@ -444,7 +444,10 @@ declare class BoardService<TGameModes extends AnyGameModes = AnyGameModes, TSymb
444
444
  tumbleBoard(symbolsToDelete: Array<{
445
445
  reelIdx: number;
446
446
  rowIdx: number;
447
- }>): void;
447
+ }>): {
448
+ newBoardSymbols: Record<string, GameSymbol[]>;
449
+ newPaddingTopSymbols: Record<string, GameSymbol[]>;
450
+ };
448
451
  }
449
452
 
450
453
  declare class Recorder {
@@ -1229,8 +1232,7 @@ type WinCombination = {
1229
1232
  posIndex: number;
1230
1233
  }>;
1231
1234
  };
1232
- type PostProcessFn<TWinCombs extends WinCombination[]> = (winType: WinType, ctx: GameContext) => {
1233
- payout: number;
1235
+ type PostProcessFn<TWinCombs extends WinCombination[]> = (wins: TWinCombs, ctx: GameContext) => {
1234
1236
  winCombinations: TWinCombs;
1235
1237
  };
1236
1238
  type WildSymbol = GameSymbol | Record<string, any>;
@@ -1562,7 +1564,10 @@ declare class StandaloneBoard {
1562
1564
  tumbleBoard(symbolsToDelete: Array<{
1563
1565
  reelIdx: number;
1564
1566
  rowIdx: number;
1565
- }>): void;
1567
+ }>): {
1568
+ newBoardSymbols: Record<string, GameSymbol[]>;
1569
+ newPaddingTopSymbols: Record<string, GameSymbol[]>;
1570
+ };
1566
1571
  }
1567
1572
  interface StandaloneBoardOptions {
1568
1573
  ctx: GameContext;
package/dist/index.d.ts CHANGED
@@ -444,7 +444,10 @@ declare class BoardService<TGameModes extends AnyGameModes = AnyGameModes, TSymb
444
444
  tumbleBoard(symbolsToDelete: Array<{
445
445
  reelIdx: number;
446
446
  rowIdx: number;
447
- }>): void;
447
+ }>): {
448
+ newBoardSymbols: Record<string, GameSymbol[]>;
449
+ newPaddingTopSymbols: Record<string, GameSymbol[]>;
450
+ };
448
451
  }
449
452
 
450
453
  declare class Recorder {
@@ -1229,8 +1232,7 @@ type WinCombination = {
1229
1232
  posIndex: number;
1230
1233
  }>;
1231
1234
  };
1232
- type PostProcessFn<TWinCombs extends WinCombination[]> = (winType: WinType, ctx: GameContext) => {
1233
- payout: number;
1235
+ type PostProcessFn<TWinCombs extends WinCombination[]> = (wins: TWinCombs, ctx: GameContext) => {
1234
1236
  winCombinations: TWinCombs;
1235
1237
  };
1236
1238
  type WildSymbol = GameSymbol | Record<string, any>;
@@ -1562,7 +1564,10 @@ declare class StandaloneBoard {
1562
1564
  tumbleBoard(symbolsToDelete: Array<{
1563
1565
  reelIdx: number;
1564
1566
  rowIdx: number;
1565
- }>): void;
1567
+ }>): {
1568
+ newBoardSymbols: Record<string, GameSymbol[]>;
1569
+ newPaddingTopSymbols: Record<string, GameSymbol[]>;
1570
+ };
1566
1571
  }
1567
1572
  interface StandaloneBoardOptions {
1568
1573
  ctx: GameContext;
package/dist/index.js CHANGED
@@ -702,11 +702,17 @@ var Board = class {
702
702
  this.reels[reelIdx].splice(rowIdx, 1);
703
703
  });
704
704
  const newFirstSymbolPositions = {};
705
+ const newBoardSymbols = {};
706
+ const newPaddingTopSymbols = {};
705
707
  for (let ridx = 0; ridx < reelsAmount; ridx++) {
706
708
  while (this.reels[ridx].length < symbolsPerReel[ridx]) {
707
709
  const padSymbol = this.paddingTop[ridx].pop();
708
710
  if (padSymbol) {
709
711
  this.reels[ridx].unshift(padSymbol);
712
+ if (!newBoardSymbols[ridx]) {
713
+ newBoardSymbols[ridx] = [];
714
+ }
715
+ newBoardSymbols[ridx].unshift(padSymbol);
710
716
  } else {
711
717
  break;
712
718
  }
@@ -720,6 +726,10 @@ var Board = class {
720
726
  (0, import_assert3.default)(newSymbol, "Failed to get new symbol for tumbling.");
721
727
  this.reels[ridx].unshift(newSymbol);
722
728
  newFirstSymbolPositions[ridx] = symbolPos;
729
+ if (!newBoardSymbols[ridx]) {
730
+ newBoardSymbols[ridx] = [];
731
+ }
732
+ newBoardSymbols[ridx].unshift(newSymbol);
723
733
  }
724
734
  }
725
735
  for (let ridx = 0; ridx < reelsAmount; ridx++) {
@@ -730,8 +740,16 @@ var Board = class {
730
740
  const padSymbol = reels[ridx][topPos];
731
741
  (0, import_assert3.default)(padSymbol, "Failed to get new padding symbol for tumbling.");
732
742
  this.paddingTop[ridx].unshift(padSymbol);
743
+ if (!newPaddingTopSymbols[ridx]) {
744
+ newPaddingTopSymbols[ridx] = [];
745
+ }
746
+ newPaddingTopSymbols[ridx].unshift(padSymbol);
733
747
  }
734
748
  }
749
+ return {
750
+ newBoardSymbols,
751
+ newPaddingTopSymbols
752
+ };
735
753
  }
736
754
  };
737
755
 
@@ -872,7 +890,7 @@ var BoardService = class extends AbstractService {
872
890
  * Tumbles the board. All given symbols will be deleted and new symbols will fall from the top.
873
891
  */
874
892
  tumbleBoard(symbolsToDelete) {
875
- this.board.tumbleBoard({
893
+ return this.board.tumbleBoard({
876
894
  ctx: this.ctx(),
877
895
  symbolsToDelete
878
896
  });
@@ -2617,9 +2635,9 @@ var WinType = class {
2617
2635
  * Custom post-processing of wins, e.g. for handling multipliers.
2618
2636
  */
2619
2637
  postProcess(func) {
2620
- const result = func(this, this.ctx);
2621
- this.payout = result.payout;
2638
+ const result = func(this.winCombinations, this.ctx);
2622
2639
  this.winCombinations = result.winCombinations;
2640
+ this.payout = result.winCombinations.reduce((sum, w) => sum + w.payout, 0);
2623
2641
  return this;
2624
2642
  }
2625
2643
  /**
@@ -3576,7 +3594,7 @@ var StandaloneBoard = class {
3576
3594
  * Tumbles the board. All given symbols will be deleted and new symbols will fall from the top.
3577
3595
  */
3578
3596
  tumbleBoard(symbolsToDelete) {
3579
- this.board.tumbleBoard({
3597
+ return this.board.tumbleBoard({
3580
3598
  ctx: this.ctx,
3581
3599
  symbolsToDelete,
3582
3600
  reelsAmount: this.reelsAmount,