@slot-engine/core 0.2.5 → 0.2.7
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 +32 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -12
- 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,
|
|
@@ -2470,6 +2471,24 @@ var Simulation = class {
|
|
|
2470
2471
|
const lookupSegmentedStream = import_fs3.default.createWriteStream(tempLookupSegPath, {
|
|
2471
2472
|
highWaterMark: this.maxHighWaterMark
|
|
2472
2473
|
});
|
|
2474
|
+
const WRITE_BATCH_SIZE = 200;
|
|
2475
|
+
let booksIndexBatch = [];
|
|
2476
|
+
let lookupBatch = [];
|
|
2477
|
+
let lookupSegBatch = [];
|
|
2478
|
+
const flushWriteBatches = async () => {
|
|
2479
|
+
if (booksIndexBatch.length === 0) return;
|
|
2480
|
+
const booksIndexData = booksIndexBatch.join("");
|
|
2481
|
+
const lookupData = lookupBatch.join("");
|
|
2482
|
+
const lookupSegData = lookupSegBatch.join("");
|
|
2483
|
+
booksIndexBatch = [];
|
|
2484
|
+
lookupBatch = [];
|
|
2485
|
+
lookupSegBatch = [];
|
|
2486
|
+
await Promise.all([
|
|
2487
|
+
write(booksIndexStream, booksIndexData),
|
|
2488
|
+
write(lookupStream, lookupData),
|
|
2489
|
+
write(lookupSegmentedStream, lookupSegData)
|
|
2490
|
+
]);
|
|
2491
|
+
};
|
|
2473
2492
|
let writeChain = Promise.resolve();
|
|
2474
2493
|
worker.on("message", (msg) => {
|
|
2475
2494
|
if (msg.type === "log" || msg.type === "user-log") {
|
|
@@ -2549,20 +2568,19 @@ var Simulation = class {
|
|
|
2549
2568
|
if (!this.tempBookIndexPaths.includes(booksIndexPath)) {
|
|
2550
2569
|
this.tempBookIndexPaths.push(booksIndexPath);
|
|
2551
2570
|
}
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
booksIndexStream,
|
|
2555
|
-
`${book.id},${index},${this.bookChunkIndexes.get(index) || 0}
|
|
2571
|
+
booksIndexBatch.push(
|
|
2572
|
+
`${book.id},${index},${this.bookChunkIndexes.get(index) || 0}
|
|
2556
2573
|
`
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
`)
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
`${book.id},${book.criteria},${book.basegameWins},${book.freespinsWins}
|
|
2574
|
+
);
|
|
2575
|
+
lookupBatch.push(`${book.id},1,${Math.round(book.payout)}
|
|
2576
|
+
`);
|
|
2577
|
+
lookupSegBatch.push(
|
|
2578
|
+
`${book.id},${book.criteria},${book.basegameWins},${book.freespinsWins}
|
|
2563
2579
|
`
|
|
2564
|
-
|
|
2565
|
-
|
|
2580
|
+
);
|
|
2581
|
+
if (booksIndexBatch.length >= WRITE_BATCH_SIZE) {
|
|
2582
|
+
await flushWriteBatches();
|
|
2583
|
+
}
|
|
2566
2584
|
if (this.bookBufferSizes.get(index) >= 10 * 1024 * 1024) {
|
|
2567
2585
|
await flushBookChunk();
|
|
2568
2586
|
}
|
|
@@ -2583,6 +2601,7 @@ var Simulation = class {
|
|
|
2583
2601
|
}
|
|
2584
2602
|
if (msg.type === "done") {
|
|
2585
2603
|
writeChain.then(async () => {
|
|
2604
|
+
await flushWriteBatches();
|
|
2586
2605
|
await flushBookChunk();
|
|
2587
2606
|
lookupStream.end();
|
|
2588
2607
|
lookupSegmentedStream.end();
|
|
@@ -4955,6 +4974,7 @@ var StandaloneBoard = class {
|
|
|
4955
4974
|
SPIN_TYPE,
|
|
4956
4975
|
StandaloneBoard,
|
|
4957
4976
|
StaticReelSet,
|
|
4977
|
+
WinType,
|
|
4958
4978
|
createSlotGame,
|
|
4959
4979
|
defineGameModes,
|
|
4960
4980
|
defineSymbols,
|