@slot-engine/core 0.2.4 → 0.2.6
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 +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +26 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -480,7 +480,7 @@ declare class WinType {
|
|
|
480
480
|
/**
|
|
481
481
|
* Custom post-processing of wins, e.g. for handling multipliers.
|
|
482
482
|
*/
|
|
483
|
-
postProcess(func:
|
|
483
|
+
postProcess(func: WinPostProcessFn<typeof this.winCombinations>): this;
|
|
484
484
|
/**
|
|
485
485
|
* Returns the total payout and detailed win combinations.
|
|
486
486
|
*/
|
|
@@ -526,7 +526,7 @@ type WinCombination = {
|
|
|
526
526
|
posIndex: number;
|
|
527
527
|
}>;
|
|
528
528
|
};
|
|
529
|
-
type
|
|
529
|
+
type WinPostProcessFn<TWinCombs extends WinCombination[]> = (wins: TWinCombs, ctx: GameContext) => {
|
|
530
530
|
winCombinations: TWinCombs;
|
|
531
531
|
};
|
|
532
532
|
type WildSymbol = GameSymbol | Record<string, any>;
|
|
@@ -1910,4 +1910,4 @@ interface StandaloneBoardOptions {
|
|
|
1910
1910
|
padSymbols: number;
|
|
1911
1911
|
}
|
|
1912
1912
|
|
|
1913
|
-
export { type AnyGameModes, type AnySymbols, type AnyUserData, ClusterWinType, type GameContext, type GameHooks, GameMode, GameSymbol, GeneratedReelSet, type InferGameType, LinesWinType, type LookupTable, type LookupTableSegmented, ManywaysWinType, OptimizationConditions, OptimizationParameters, OptimizationScaling, type PayoutStatistics, RandomNumberGenerator, type RecordItem, type Reels, ResultSet, SPIN_TYPE, type SimulationSummary, type SlotGameType as SlotGame, type SpinType, StandaloneBoard, StaticReelSet, type Statistics, type WinCombination, type WrittenBook, createSlotGame, defineGameModes, defineSymbols, defineUserState, parseLookupTable, parseLookupTableSegmented };
|
|
1913
|
+
export { type AnyGameModes, type AnySymbols, type AnyUserData, ClusterWinType, type GameContext, type GameHooks, GameMode, GameSymbol, GeneratedReelSet, type InferGameType, LinesWinType, type LookupTable, type LookupTableSegmented, ManywaysWinType, OptimizationConditions, OptimizationParameters, OptimizationScaling, type PayoutStatistics, RandomNumberGenerator, type RecordItem, type Reels, ResultSet, SPIN_TYPE, type SimulationSummary, type SlotGameType as SlotGame, type SpinType, StandaloneBoard, StaticReelSet, type Statistics, type WinCombination, type WinPostProcessFn, WinType, type WinTypeOpts, type WrittenBook, createSlotGame, defineGameModes, defineSymbols, defineUserState, parseLookupTable, parseLookupTableSegmented };
|
package/dist/index.d.ts
CHANGED
|
@@ -480,7 +480,7 @@ declare class WinType {
|
|
|
480
480
|
/**
|
|
481
481
|
* Custom post-processing of wins, e.g. for handling multipliers.
|
|
482
482
|
*/
|
|
483
|
-
postProcess(func:
|
|
483
|
+
postProcess(func: WinPostProcessFn<typeof this.winCombinations>): this;
|
|
484
484
|
/**
|
|
485
485
|
* Returns the total payout and detailed win combinations.
|
|
486
486
|
*/
|
|
@@ -526,7 +526,7 @@ type WinCombination = {
|
|
|
526
526
|
posIndex: number;
|
|
527
527
|
}>;
|
|
528
528
|
};
|
|
529
|
-
type
|
|
529
|
+
type WinPostProcessFn<TWinCombs extends WinCombination[]> = (wins: TWinCombs, ctx: GameContext) => {
|
|
530
530
|
winCombinations: TWinCombs;
|
|
531
531
|
};
|
|
532
532
|
type WildSymbol = GameSymbol | Record<string, any>;
|
|
@@ -1910,4 +1910,4 @@ interface StandaloneBoardOptions {
|
|
|
1910
1910
|
padSymbols: number;
|
|
1911
1911
|
}
|
|
1912
1912
|
|
|
1913
|
-
export { type AnyGameModes, type AnySymbols, type AnyUserData, ClusterWinType, type GameContext, type GameHooks, GameMode, GameSymbol, GeneratedReelSet, type InferGameType, LinesWinType, type LookupTable, type LookupTableSegmented, ManywaysWinType, OptimizationConditions, OptimizationParameters, OptimizationScaling, type PayoutStatistics, RandomNumberGenerator, type RecordItem, type Reels, ResultSet, SPIN_TYPE, type SimulationSummary, type SlotGameType as SlotGame, type SpinType, StandaloneBoard, StaticReelSet, type Statistics, type WinCombination, type WrittenBook, createSlotGame, defineGameModes, defineSymbols, defineUserState, parseLookupTable, parseLookupTableSegmented };
|
|
1913
|
+
export { type AnyGameModes, type AnySymbols, type AnyUserData, ClusterWinType, type GameContext, type GameHooks, GameMode, GameSymbol, GeneratedReelSet, type InferGameType, LinesWinType, type LookupTable, type LookupTableSegmented, ManywaysWinType, OptimizationConditions, OptimizationParameters, OptimizationScaling, type PayoutStatistics, RandomNumberGenerator, type RecordItem, type Reels, ResultSet, SPIN_TYPE, type SimulationSummary, type SlotGameType as SlotGame, type SpinType, StandaloneBoard, StaticReelSet, type Statistics, type WinCombination, type WinPostProcessFn, WinType, type WinTypeOpts, type WrittenBook, createSlotGame, defineGameModes, defineSymbols, defineUserState, parseLookupTable, parseLookupTableSegmented };
|
package/dist/index.js
CHANGED
|
@@ -44,6 +44,7 @@ __export(index_exports, {
|
|
|
44
44
|
SPIN_TYPE: () => SPIN_TYPE,
|
|
45
45
|
StandaloneBoard: () => StandaloneBoard,
|
|
46
46
|
StaticReelSet: () => StaticReelSet,
|
|
47
|
+
WinType: () => WinType,
|
|
47
48
|
createSlotGame: () => createSlotGame,
|
|
48
49
|
defineGameModes: () => defineGameModes,
|
|
49
50
|
defineSymbols: () => defineSymbols,
|
|
@@ -448,11 +449,11 @@ var GameSymbol = class _GameSymbol {
|
|
|
448
449
|
* Creates a clone of this GameSymbol.
|
|
449
450
|
*/
|
|
450
451
|
clone() {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
452
|
+
const cloned = Object.create(_GameSymbol.prototype);
|
|
453
|
+
cloned.id = this.id;
|
|
454
|
+
cloned.pays = this.pays;
|
|
455
|
+
cloned.properties = this.properties.size > 0 ? new Map(this.properties) : /* @__PURE__ */ new Map();
|
|
456
|
+
return cloned;
|
|
456
457
|
}
|
|
457
458
|
};
|
|
458
459
|
|
|
@@ -505,6 +506,9 @@ var Board = class {
|
|
|
505
506
|
setSymbol(reelIndex, rowIndex, symbol) {
|
|
506
507
|
this.reels[reelIndex] = this.reels[reelIndex] || [];
|
|
507
508
|
this.reels[reelIndex][rowIndex] = symbol;
|
|
509
|
+
this.updateSymbol(reelIndex, rowIndex, {
|
|
510
|
+
position: [reelIndex, rowIndex]
|
|
511
|
+
});
|
|
508
512
|
}
|
|
509
513
|
removeSymbol(reelIndex, rowIndex) {
|
|
510
514
|
if (this.reels[reelIndex]) {
|
|
@@ -713,16 +717,19 @@ var Board = class {
|
|
|
713
717
|
const reelLength = opts.reels[ridx].length;
|
|
714
718
|
for (let p = padSymbols - 1; p >= 0; p--) {
|
|
715
719
|
const topPos = ((reelPos - (p + 1)) % reelLength + reelLength) % reelLength;
|
|
716
|
-
this.paddingTop[ridx].push(opts.reels[ridx][topPos]);
|
|
720
|
+
this.paddingTop[ridx].push(opts.reels[ridx][topPos].clone());
|
|
717
721
|
const bottomPos = (reelPos + symbolsPerReel[ridx] + p) % reelLength;
|
|
718
|
-
this.paddingBottom[ridx].unshift(opts.reels[ridx][bottomPos]);
|
|
722
|
+
this.paddingBottom[ridx].unshift(opts.reels[ridx][bottomPos].clone());
|
|
719
723
|
}
|
|
720
724
|
for (let row = 0; row < symbolsPerReel[ridx]; row++) {
|
|
721
725
|
const symbol = opts.reels[ridx][(reelPos + row) % reelLength];
|
|
722
726
|
if (!symbol) {
|
|
723
727
|
throw new Error(`Failed to get symbol at pos ${reelPos + row} on reel ${ridx}`);
|
|
724
728
|
}
|
|
725
|
-
this.reels[ridx][row] = symbol;
|
|
729
|
+
this.reels[ridx][row] = symbol.clone();
|
|
730
|
+
this.updateSymbol(ridx, row, {
|
|
731
|
+
position: [ridx, row]
|
|
732
|
+
});
|
|
726
733
|
}
|
|
727
734
|
}
|
|
728
735
|
return {
|
|
@@ -790,6 +797,7 @@ var Board = class {
|
|
|
790
797
|
newSymbol = forcedSym;
|
|
791
798
|
}
|
|
792
799
|
(0, import_assert3.default)(newSymbol, "Failed to get new symbol for tumbling.");
|
|
800
|
+
newSymbol = newSymbol.clone();
|
|
793
801
|
this.reels[ridx].unshift(newSymbol);
|
|
794
802
|
newFirstSymbolPositions[ridx] = symbolPos;
|
|
795
803
|
if (!newBoardSymbols[ridx]) {
|
|
@@ -803,7 +811,7 @@ var Board = class {
|
|
|
803
811
|
if (firstSymbolPos === void 0) continue;
|
|
804
812
|
for (let p = 1; p <= padSymbols; p++) {
|
|
805
813
|
const topPos = (firstSymbolPos - p + reels[ridx].length) % reels[ridx].length;
|
|
806
|
-
const padSymbol = reels[ridx][topPos];
|
|
814
|
+
const padSymbol = reels[ridx][topPos]?.clone();
|
|
807
815
|
(0, import_assert3.default)(padSymbol, "Failed to get new padding symbol for tumbling.");
|
|
808
816
|
this.paddingTop[ridx].unshift(padSymbol);
|
|
809
817
|
if (!newPaddingTopSymbols[ridx]) {
|
|
@@ -817,6 +825,14 @@ var Board = class {
|
|
|
817
825
|
return newFirstSymbolPositions[ridx] ?? stop;
|
|
818
826
|
});
|
|
819
827
|
}
|
|
828
|
+
for (let ridx = 0; ridx < reelsAmount; ridx++) {
|
|
829
|
+
const reel = this.reels[ridx];
|
|
830
|
+
for (let rowIdx = 0; rowIdx < reel.length; rowIdx++) {
|
|
831
|
+
this.updateSymbol(ridx, rowIdx, {
|
|
832
|
+
position: [ridx, rowIdx]
|
|
833
|
+
});
|
|
834
|
+
}
|
|
835
|
+
}
|
|
820
836
|
return {
|
|
821
837
|
newBoardSymbols,
|
|
822
838
|
newPaddingTopSymbols
|
|
@@ -4940,6 +4956,7 @@ var StandaloneBoard = class {
|
|
|
4940
4956
|
SPIN_TYPE,
|
|
4941
4957
|
StandaloneBoard,
|
|
4942
4958
|
StaticReelSet,
|
|
4959
|
+
WinType,
|
|
4943
4960
|
createSlotGame,
|
|
4944
4961
|
defineGameModes,
|
|
4945
4962
|
defineSymbols,
|