@slot-engine/core 0.2.2 → 0.2.3

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 CHANGED
@@ -558,6 +558,10 @@ declare class BoardService<TGameModes extends AnyGameModes = AnyGameModes, TSymb
558
558
  * Removes the symbol at the specified reel and row index.
559
559
  */
560
560
  removeSymbol(reelIndex: number, rowIndex: number): void;
561
+ /**
562
+ * Updates properties of the symbol at the specified reel and row index.
563
+ */
564
+ updateSymbol(reelIndex: number, rowIndex: number, properties: Record<string, any>): void;
561
565
  private resetReels;
562
566
  /**
563
567
  * Sets the anticipation value for a specific reel.
@@ -1554,7 +1558,9 @@ declare class ManywaysWinType extends WinType {
1554
1558
  * Calculates wins based on the defined paylines and provided board state.\
1555
1559
  * Retrieve the results using `getWins()` after.
1556
1560
  */
1557
- evaluateWins(board: Reels): this;
1561
+ evaluateWins(board: Reels, opts?: {
1562
+ jumpGaps?: boolean;
1563
+ }): this;
1558
1564
  private getWayLength;
1559
1565
  }
1560
1566
  interface ManywaysWinTypeOpts extends WinTypeOpts {
@@ -1748,6 +1754,10 @@ declare class StandaloneBoard {
1748
1754
  * Removes the symbol at the specified reel and row index.
1749
1755
  */
1750
1756
  removeSymbol(reelIndex: number, rowIndex: number): void;
1757
+ /**
1758
+ * Updates properties of the symbol at the specified reel and row index.
1759
+ */
1760
+ updateSymbol(reelIndex: number, rowIndex: number, properties: Record<string, any>): void;
1751
1761
  private resetReels;
1752
1762
  /**
1753
1763
  * Sets the anticipation value for a specific reel.
package/dist/index.d.ts CHANGED
@@ -558,6 +558,10 @@ declare class BoardService<TGameModes extends AnyGameModes = AnyGameModes, TSymb
558
558
  * Removes the symbol at the specified reel and row index.
559
559
  */
560
560
  removeSymbol(reelIndex: number, rowIndex: number): void;
561
+ /**
562
+ * Updates properties of the symbol at the specified reel and row index.
563
+ */
564
+ updateSymbol(reelIndex: number, rowIndex: number, properties: Record<string, any>): void;
561
565
  private resetReels;
562
566
  /**
563
567
  * Sets the anticipation value for a specific reel.
@@ -1554,7 +1558,9 @@ declare class ManywaysWinType extends WinType {
1554
1558
  * Calculates wins based on the defined paylines and provided board state.\
1555
1559
  * Retrieve the results using `getWins()` after.
1556
1560
  */
1557
- evaluateWins(board: Reels): this;
1561
+ evaluateWins(board: Reels, opts?: {
1562
+ jumpGaps?: boolean;
1563
+ }): this;
1558
1564
  private getWayLength;
1559
1565
  }
1560
1566
  interface ManywaysWinTypeOpts extends WinTypeOpts {
@@ -1748,6 +1754,10 @@ declare class StandaloneBoard {
1748
1754
  * Removes the symbol at the specified reel and row index.
1749
1755
  */
1750
1756
  removeSymbol(reelIndex: number, rowIndex: number): void;
1757
+ /**
1758
+ * Updates properties of the symbol at the specified reel and row index.
1759
+ */
1760
+ updateSymbol(reelIndex: number, rowIndex: number, properties: Record<string, any>): void;
1751
1761
  private resetReels;
1752
1762
  /**
1753
1763
  * Sets the anticipation value for a specific reel.
package/dist/index.js CHANGED
@@ -510,6 +510,14 @@ var Board = class {
510
510
  this.reels[reelIndex].splice(rowIndex, 1);
511
511
  }
512
512
  }
513
+ updateSymbol(reelIndex, rowIndex, properties) {
514
+ const symbol = this.getSymbol(reelIndex, rowIndex);
515
+ if (symbol) {
516
+ for (const [key, value] of Object.entries(properties)) {
517
+ symbol.properties.set(key, value);
518
+ }
519
+ }
520
+ }
513
521
  makeEmptyReels(opts) {
514
522
  const length = opts.reelsAmount ?? opts.ctx.services.game.getCurrentGameMode().reelsAmount;
515
523
  (0, import_assert3.default)(length, "Cannot make empty reels without context or reelsAmount.");
@@ -879,6 +887,12 @@ var BoardService = class extends AbstractService {
879
887
  removeSymbol(reelIndex, rowIndex) {
880
888
  this.board.removeSymbol(reelIndex, rowIndex);
881
889
  }
890
+ /**
891
+ * Updates properties of the symbol at the specified reel and row index.
892
+ */
893
+ updateSymbol(reelIndex, rowIndex, properties) {
894
+ this.board.updateSymbol(reelIndex, rowIndex, properties);
895
+ }
882
896
  resetReels() {
883
897
  this.board.resetReels({
884
898
  ctx: this.ctx()
@@ -4104,27 +4118,36 @@ var ManywaysWinType = class extends WinType {
4104
4118
  * Calculates wins based on the defined paylines and provided board state.\
4105
4119
  * Retrieve the results using `getWins()` after.
4106
4120
  */
4107
- evaluateWins(board) {
4121
+ evaluateWins(board, opts = {}) {
4108
4122
  this.validateConfig();
4123
+ const { jumpGaps = false } = opts;
4109
4124
  const waysWins = [];
4110
4125
  const reels = board;
4111
4126
  const possibleWaysWins = /* @__PURE__ */ new Map();
4112
4127
  const candidateSymbols = /* @__PURE__ */ new Map();
4113
- let searchReelIdx = 0;
4114
- let searchActive = true;
4115
- while (searchActive && searchReelIdx < reels.length) {
4116
- const reel = reels[searchReelIdx];
4117
- let hasWild = false;
4118
- for (const symbol of reel) {
4119
- candidateSymbols.set(symbol.id, symbol);
4120
- if (this.isWild(symbol)) {
4121
- hasWild = true;
4128
+ if (jumpGaps) {
4129
+ for (const reel of reels) {
4130
+ for (const symbol of reel) {
4131
+ candidateSymbols.set(symbol.id, symbol);
4122
4132
  }
4123
4133
  }
4124
- if (!hasWild) {
4125
- searchActive = false;
4134
+ } else {
4135
+ let searchReelIdx = 0;
4136
+ let searchActive = true;
4137
+ while (searchActive && searchReelIdx < reels.length) {
4138
+ const reel = reels[searchReelIdx];
4139
+ let hasWild = false;
4140
+ for (const symbol of reel) {
4141
+ candidateSymbols.set(symbol.id, symbol);
4142
+ if (this.isWild(symbol)) {
4143
+ hasWild = true;
4144
+ }
4145
+ }
4146
+ if (!hasWild) {
4147
+ searchActive = false;
4148
+ }
4149
+ searchReelIdx++;
4126
4150
  }
4127
- searchReelIdx++;
4128
4151
  }
4129
4152
  for (const baseSymbol of candidateSymbols.values()) {
4130
4153
  let symbolList = {};
@@ -4140,7 +4163,7 @@ var ManywaysWinType = class extends WinType {
4140
4163
  symbolList[ridx].push({ reel: ridx, row: sidx, symbol });
4141
4164
  }
4142
4165
  }
4143
- if (!symbolList[ridx]) {
4166
+ if (!symbolList[ridx] && !jumpGaps) {
4144
4167
  isInterrupted = true;
4145
4168
  break;
4146
4169
  }
@@ -4156,7 +4179,7 @@ var ManywaysWinType = class extends WinType {
4156
4179
  for (const [baseSymbolId, symbolList] of possibleWaysWins.entries()) {
4157
4180
  const wayLength = this.getWayLength(symbolList);
4158
4181
  let baseSymbol = Object.values(symbolList).flatMap((l) => l.map((s) => s)).find((s) => !this.isWild(s.symbol))?.symbol;
4159
- if (!baseSymbol) baseSymbol = symbolList[0][0].symbol;
4182
+ if (!baseSymbol) baseSymbol = symbolList[Object.keys(symbolList)[0]][0].symbol;
4160
4183
  const singleWayPayout = this.getSymbolPayout(baseSymbol, wayLength);
4161
4184
  const totalWays = Object.values(symbolList).reduce(
4162
4185
  (ways, syms) => ways * syms.length,
@@ -4190,7 +4213,7 @@ var ManywaysWinType = class extends WinType {
4190
4213
  return this;
4191
4214
  }
4192
4215
  getWayLength(symbolList) {
4193
- return Math.max(...Object.keys(symbolList).map((k) => parseInt(k, 10))) + 1;
4216
+ return Object.keys(symbolList).length;
4194
4217
  }
4195
4218
  };
4196
4219
 
@@ -4652,6 +4675,12 @@ var StandaloneBoard = class {
4652
4675
  removeSymbol(reelIndex, rowIndex) {
4653
4676
  this.board.removeSymbol(reelIndex, rowIndex);
4654
4677
  }
4678
+ /**
4679
+ * Updates properties of the symbol at the specified reel and row index.
4680
+ */
4681
+ updateSymbol(reelIndex, rowIndex, properties) {
4682
+ this.board.updateSymbol(reelIndex, rowIndex, properties);
4683
+ }
4655
4684
  resetReels() {
4656
4685
  this.board.resetReels({
4657
4686
  ctx: this.ctx