@slot-engine/core 0.0.3 → 0.0.5
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 +51 -65
- package/dist/index.d.ts +51 -65
- package/dist/index.js +58 -70
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +58 -70
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -82,7 +82,6 @@ declare class ReelGenerator {
|
|
|
82
82
|
max?: number | Record<string, number>;
|
|
83
83
|
}>;
|
|
84
84
|
protected readonly symbolQuotas?: Record<string, number | Record<string, number>>;
|
|
85
|
-
outputDir: string;
|
|
86
85
|
csvPath: string;
|
|
87
86
|
overrideExisting: boolean;
|
|
88
87
|
rng: RandomNumberGenerator;
|
|
@@ -117,11 +116,6 @@ interface ReelGeneratorOpts {
|
|
|
117
116
|
* Default is 250, but can be adjusted as needed.
|
|
118
117
|
*/
|
|
119
118
|
rowsAmount?: number;
|
|
120
|
-
/**
|
|
121
|
-
* The directory where the generated reelset files will be saved.\
|
|
122
|
-
* **It's recommended to just use `__dirname`**!
|
|
123
|
-
*/
|
|
124
|
-
outputDir: string;
|
|
125
119
|
/**
|
|
126
120
|
* Prevent the same symbol from appearing directly above or below itself.\
|
|
127
121
|
* This can be a single number for all symbols, or a mapping of symbol IDs to
|
|
@@ -603,12 +597,6 @@ declare class GameState<TGameModes extends AnyGameModes, TSymbols extends AnySym
|
|
|
603
597
|
*/
|
|
604
598
|
getCurrentGameMode(): GameMode;
|
|
605
599
|
resetState(): void;
|
|
606
|
-
/**
|
|
607
|
-
* Checks if a max win is reached by comparing `wallet.currentWin` to `config.maxWin`.
|
|
608
|
-
*
|
|
609
|
-
* Should be called after `wallet.confirmSpinWin()`.
|
|
610
|
-
*/
|
|
611
|
-
isMaxWinTriggered(): void;
|
|
612
600
|
/**
|
|
613
601
|
* Empties the list of pending records in the recorder.
|
|
614
602
|
*/
|
|
@@ -769,7 +757,7 @@ declare class Board<TGameModes extends AnyGameModes, TSymbols extends AnySymbols
|
|
|
769
757
|
*/
|
|
770
758
|
getRandomReelStops(reels: Reels, reelStops: number[][], amount: number): Record<string, number>;
|
|
771
759
|
/**
|
|
772
|
-
* Selects a random
|
|
760
|
+
* Selects a random reel set based on the configured weights of the current result set.\
|
|
773
761
|
* Returns the reels as arrays of GameSymbols.
|
|
774
762
|
*/
|
|
775
763
|
getRandomReelset(): Reels;
|
|
@@ -896,7 +884,7 @@ declare class GameConfig<TGameModes extends AnyGameModes = AnyGameModes, TSymbol
|
|
|
896
884
|
/**
|
|
897
885
|
* Retrieves a reel set by its ID within a specific game mode.
|
|
898
886
|
*/
|
|
899
|
-
getReelsetById(gameMode: string, id: string):
|
|
887
|
+
getReelsetById(gameMode: string, id: string): Reels;
|
|
900
888
|
/**
|
|
901
889
|
* Retrieves the number of free spins awarded for a given spin type and scatter count.
|
|
902
890
|
*/
|
|
@@ -904,7 +892,7 @@ declare class GameConfig<TGameModes extends AnyGameModes = AnyGameModes, TSymbol
|
|
|
904
892
|
/**
|
|
905
893
|
* Retrieves a result set by its criteria within a specific game mode.
|
|
906
894
|
*/
|
|
907
|
-
|
|
895
|
+
getResultSetByCriteria(mode: string, criteria: string): ResultSet<any>;
|
|
908
896
|
/**
|
|
909
897
|
* Returns all configured symbols as an array.
|
|
910
898
|
*/
|
|
@@ -1175,64 +1163,14 @@ declare class SlotGame<TGameModes extends AnyGameModes = AnyGameModes, TSymbols
|
|
|
1175
1163
|
* @internal
|
|
1176
1164
|
*/
|
|
1177
1165
|
interface CommonGameOptions<TGameModes extends AnyGameModes = AnyGameModes, TSymbols extends AnySymbols = AnySymbols, TUserState extends AnyUserData = AnyUserData> {
|
|
1178
|
-
/**
|
|
1179
|
-
* The unique identifier of the game, used for configuration and identification.
|
|
1180
|
-
*/
|
|
1181
1166
|
id: string;
|
|
1182
|
-
/**
|
|
1183
|
-
* The name of the game, used for display purposes.
|
|
1184
|
-
*/
|
|
1185
1167
|
name: string;
|
|
1186
|
-
/**
|
|
1187
|
-
* A GameMode is the core structure of a slot, defining the board,\
|
|
1188
|
-
* bet cost, win type, and other properties.
|
|
1189
|
-
*
|
|
1190
|
-
* One-off mechanisms can also be injected into the core game logic from here.
|
|
1191
|
-
*/
|
|
1192
1168
|
gameModes: Record<GameModeName, GameMode>;
|
|
1193
|
-
/**
|
|
1194
|
-
* A list of all symbols that will appear on the reels.
|
|
1195
|
-
*/
|
|
1196
1169
|
symbols: TSymbols;
|
|
1197
|
-
/**
|
|
1198
|
-
* A mapping from spin type to scatter counts to the number of free spins awarded.
|
|
1199
|
-
*
|
|
1200
|
-
* @example
|
|
1201
|
-
* ```ts
|
|
1202
|
-
* scatterToFreespins: {
|
|
1203
|
-
* [GameConfig.CONSTANTS.BASE_GAME]: {
|
|
1204
|
-
* 3: 10,
|
|
1205
|
-
* 4: 12,
|
|
1206
|
-
* 5: 15,
|
|
1207
|
-
* },
|
|
1208
|
-
* [GameConfig.CONSTANTS.FREE_SPINS]: {
|
|
1209
|
-
* 3: 6,
|
|
1210
|
-
* 4: 8,
|
|
1211
|
-
* 5: 10,
|
|
1212
|
-
* },
|
|
1213
|
-
* },
|
|
1214
|
-
* ```
|
|
1215
|
-
*/
|
|
1216
1170
|
scatterToFreespins: Record<string, Record<number, number>>;
|
|
1217
|
-
/**
|
|
1218
|
-
* If set, this will pad the board with symbols on the top and bottom of the reels.\
|
|
1219
|
-
* Useful for teasing symbols right above or below the active board.
|
|
1220
|
-
*
|
|
1221
|
-
* Default: 1
|
|
1222
|
-
*/
|
|
1223
1171
|
padSymbols?: number;
|
|
1224
|
-
/**
|
|
1225
|
-
* The maximum win multiplier of the game, e.g. 5000 for a 5000x max win.
|
|
1226
|
-
*/
|
|
1227
1172
|
maxWinX: number;
|
|
1228
|
-
/**
|
|
1229
|
-
* Hooks are used to inject custom logic at specific points in the game flow.\
|
|
1230
|
-
* Some required hooks must be implemented for certain features to work.
|
|
1231
|
-
*/
|
|
1232
1173
|
hooks: GameHooks<TGameModes, TSymbols, TUserState>;
|
|
1233
|
-
/**
|
|
1234
|
-
* Custom additional state that can be used in game flow logic.
|
|
1235
|
-
*/
|
|
1236
1174
|
userState?: TUserState;
|
|
1237
1175
|
}
|
|
1238
1176
|
/**
|
|
@@ -1280,14 +1218,62 @@ type HookContext<T> = T extends SlotGame<infer G, infer S, infer U> ? Simulation
|
|
|
1280
1218
|
|
|
1281
1219
|
type InferGameType<TGameModes extends AnyGameModes, TSymbols extends AnySymbols, TUserState extends AnyUserData> = SlotGame<TGameModes, TSymbols, TUserState>;
|
|
1282
1220
|
interface CreateSlotGameOpts<TGameModes extends AnyGameModes = AnyGameModes, TSymbols extends AnySymbols = AnySymbols, TUserState extends AnyUserData = AnyUserData> {
|
|
1221
|
+
/**
|
|
1222
|
+
* The unique identifier of the game, used for configuration and identification.
|
|
1223
|
+
*/
|
|
1283
1224
|
id: CommonGameOptions["id"];
|
|
1225
|
+
/**
|
|
1226
|
+
* The name of the game, used for display purposes.
|
|
1227
|
+
*/
|
|
1284
1228
|
name: CommonGameOptions["name"];
|
|
1229
|
+
/**
|
|
1230
|
+
* A GameMode is the core structure of a slot, defining the board,\
|
|
1231
|
+
* bet cost, win type, and other properties.
|
|
1232
|
+
*/
|
|
1285
1233
|
gameModes: TGameModes;
|
|
1234
|
+
/**
|
|
1235
|
+
* A list of all symbols that will appear on the reels.
|
|
1236
|
+
*/
|
|
1286
1237
|
symbols: TSymbols;
|
|
1238
|
+
/**
|
|
1239
|
+
* A mapping from spin type to scatter counts to the number of free spins awarded.
|
|
1240
|
+
*
|
|
1241
|
+
* @example
|
|
1242
|
+
* ```ts
|
|
1243
|
+
* scatterToFreespins: {
|
|
1244
|
+
* [GameConfig.SPIN_TYPE.BASE_GAME]: {
|
|
1245
|
+
* 3: 10,
|
|
1246
|
+
* 4: 12,
|
|
1247
|
+
* 5: 15,
|
|
1248
|
+
* },
|
|
1249
|
+
* [GameConfig.SPIN_TYPE.FREE_SPINS]: {
|
|
1250
|
+
* 3: 6,
|
|
1251
|
+
* 4: 8,
|
|
1252
|
+
* 5: 10,
|
|
1253
|
+
* },
|
|
1254
|
+
* },
|
|
1255
|
+
* ```
|
|
1256
|
+
*/
|
|
1287
1257
|
scatterToFreespins: CommonGameOptions["scatterToFreespins"];
|
|
1258
|
+
/**
|
|
1259
|
+
* If set, this will pad the board with symbols on the top and bottom of the reels.\
|
|
1260
|
+
* Useful for teasing symbols right above or below the active board.
|
|
1261
|
+
*
|
|
1262
|
+
* Default: 1
|
|
1263
|
+
*/
|
|
1288
1264
|
padSymbols?: CommonGameOptions["padSymbols"];
|
|
1265
|
+
/**
|
|
1266
|
+
* The maximum win multiplier of the game, e.g. 5000 for a 5000x max win.
|
|
1267
|
+
*/
|
|
1289
1268
|
maxWinX: CommonGameOptions["maxWinX"];
|
|
1269
|
+
/**
|
|
1270
|
+
* Custom additional state that can be used in game flow logic.
|
|
1271
|
+
*/
|
|
1290
1272
|
userState?: TUserState;
|
|
1273
|
+
/**
|
|
1274
|
+
* Hooks are used to inject custom logic at specific points in the game flow.\
|
|
1275
|
+
* Some required hooks must be implemented for certain features to work.
|
|
1276
|
+
*/
|
|
1291
1277
|
hooks: CommonGameOptions<TGameModes, TSymbols, TUserState>["hooks"];
|
|
1292
1278
|
}
|
|
1293
1279
|
declare function createSlotGame<TGame>(opts: TGame extends InferGameType<infer G, infer S, infer U> ? CreateSlotGameOpts<G, S, U> : never): TGame;
|
package/dist/index.d.ts
CHANGED
|
@@ -82,7 +82,6 @@ declare class ReelGenerator {
|
|
|
82
82
|
max?: number | Record<string, number>;
|
|
83
83
|
}>;
|
|
84
84
|
protected readonly symbolQuotas?: Record<string, number | Record<string, number>>;
|
|
85
|
-
outputDir: string;
|
|
86
85
|
csvPath: string;
|
|
87
86
|
overrideExisting: boolean;
|
|
88
87
|
rng: RandomNumberGenerator;
|
|
@@ -117,11 +116,6 @@ interface ReelGeneratorOpts {
|
|
|
117
116
|
* Default is 250, but can be adjusted as needed.
|
|
118
117
|
*/
|
|
119
118
|
rowsAmount?: number;
|
|
120
|
-
/**
|
|
121
|
-
* The directory where the generated reelset files will be saved.\
|
|
122
|
-
* **It's recommended to just use `__dirname`**!
|
|
123
|
-
*/
|
|
124
|
-
outputDir: string;
|
|
125
119
|
/**
|
|
126
120
|
* Prevent the same symbol from appearing directly above or below itself.\
|
|
127
121
|
* This can be a single number for all symbols, or a mapping of symbol IDs to
|
|
@@ -603,12 +597,6 @@ declare class GameState<TGameModes extends AnyGameModes, TSymbols extends AnySym
|
|
|
603
597
|
*/
|
|
604
598
|
getCurrentGameMode(): GameMode;
|
|
605
599
|
resetState(): void;
|
|
606
|
-
/**
|
|
607
|
-
* Checks if a max win is reached by comparing `wallet.currentWin` to `config.maxWin`.
|
|
608
|
-
*
|
|
609
|
-
* Should be called after `wallet.confirmSpinWin()`.
|
|
610
|
-
*/
|
|
611
|
-
isMaxWinTriggered(): void;
|
|
612
600
|
/**
|
|
613
601
|
* Empties the list of pending records in the recorder.
|
|
614
602
|
*/
|
|
@@ -769,7 +757,7 @@ declare class Board<TGameModes extends AnyGameModes, TSymbols extends AnySymbols
|
|
|
769
757
|
*/
|
|
770
758
|
getRandomReelStops(reels: Reels, reelStops: number[][], amount: number): Record<string, number>;
|
|
771
759
|
/**
|
|
772
|
-
* Selects a random
|
|
760
|
+
* Selects a random reel set based on the configured weights of the current result set.\
|
|
773
761
|
* Returns the reels as arrays of GameSymbols.
|
|
774
762
|
*/
|
|
775
763
|
getRandomReelset(): Reels;
|
|
@@ -896,7 +884,7 @@ declare class GameConfig<TGameModes extends AnyGameModes = AnyGameModes, TSymbol
|
|
|
896
884
|
/**
|
|
897
885
|
* Retrieves a reel set by its ID within a specific game mode.
|
|
898
886
|
*/
|
|
899
|
-
getReelsetById(gameMode: string, id: string):
|
|
887
|
+
getReelsetById(gameMode: string, id: string): Reels;
|
|
900
888
|
/**
|
|
901
889
|
* Retrieves the number of free spins awarded for a given spin type and scatter count.
|
|
902
890
|
*/
|
|
@@ -904,7 +892,7 @@ declare class GameConfig<TGameModes extends AnyGameModes = AnyGameModes, TSymbol
|
|
|
904
892
|
/**
|
|
905
893
|
* Retrieves a result set by its criteria within a specific game mode.
|
|
906
894
|
*/
|
|
907
|
-
|
|
895
|
+
getResultSetByCriteria(mode: string, criteria: string): ResultSet<any>;
|
|
908
896
|
/**
|
|
909
897
|
* Returns all configured symbols as an array.
|
|
910
898
|
*/
|
|
@@ -1175,64 +1163,14 @@ declare class SlotGame<TGameModes extends AnyGameModes = AnyGameModes, TSymbols
|
|
|
1175
1163
|
* @internal
|
|
1176
1164
|
*/
|
|
1177
1165
|
interface CommonGameOptions<TGameModes extends AnyGameModes = AnyGameModes, TSymbols extends AnySymbols = AnySymbols, TUserState extends AnyUserData = AnyUserData> {
|
|
1178
|
-
/**
|
|
1179
|
-
* The unique identifier of the game, used for configuration and identification.
|
|
1180
|
-
*/
|
|
1181
1166
|
id: string;
|
|
1182
|
-
/**
|
|
1183
|
-
* The name of the game, used for display purposes.
|
|
1184
|
-
*/
|
|
1185
1167
|
name: string;
|
|
1186
|
-
/**
|
|
1187
|
-
* A GameMode is the core structure of a slot, defining the board,\
|
|
1188
|
-
* bet cost, win type, and other properties.
|
|
1189
|
-
*
|
|
1190
|
-
* One-off mechanisms can also be injected into the core game logic from here.
|
|
1191
|
-
*/
|
|
1192
1168
|
gameModes: Record<GameModeName, GameMode>;
|
|
1193
|
-
/**
|
|
1194
|
-
* A list of all symbols that will appear on the reels.
|
|
1195
|
-
*/
|
|
1196
1169
|
symbols: TSymbols;
|
|
1197
|
-
/**
|
|
1198
|
-
* A mapping from spin type to scatter counts to the number of free spins awarded.
|
|
1199
|
-
*
|
|
1200
|
-
* @example
|
|
1201
|
-
* ```ts
|
|
1202
|
-
* scatterToFreespins: {
|
|
1203
|
-
* [GameConfig.CONSTANTS.BASE_GAME]: {
|
|
1204
|
-
* 3: 10,
|
|
1205
|
-
* 4: 12,
|
|
1206
|
-
* 5: 15,
|
|
1207
|
-
* },
|
|
1208
|
-
* [GameConfig.CONSTANTS.FREE_SPINS]: {
|
|
1209
|
-
* 3: 6,
|
|
1210
|
-
* 4: 8,
|
|
1211
|
-
* 5: 10,
|
|
1212
|
-
* },
|
|
1213
|
-
* },
|
|
1214
|
-
* ```
|
|
1215
|
-
*/
|
|
1216
1170
|
scatterToFreespins: Record<string, Record<number, number>>;
|
|
1217
|
-
/**
|
|
1218
|
-
* If set, this will pad the board with symbols on the top and bottom of the reels.\
|
|
1219
|
-
* Useful for teasing symbols right above or below the active board.
|
|
1220
|
-
*
|
|
1221
|
-
* Default: 1
|
|
1222
|
-
*/
|
|
1223
1171
|
padSymbols?: number;
|
|
1224
|
-
/**
|
|
1225
|
-
* The maximum win multiplier of the game, e.g. 5000 for a 5000x max win.
|
|
1226
|
-
*/
|
|
1227
1172
|
maxWinX: number;
|
|
1228
|
-
/**
|
|
1229
|
-
* Hooks are used to inject custom logic at specific points in the game flow.\
|
|
1230
|
-
* Some required hooks must be implemented for certain features to work.
|
|
1231
|
-
*/
|
|
1232
1173
|
hooks: GameHooks<TGameModes, TSymbols, TUserState>;
|
|
1233
|
-
/**
|
|
1234
|
-
* Custom additional state that can be used in game flow logic.
|
|
1235
|
-
*/
|
|
1236
1174
|
userState?: TUserState;
|
|
1237
1175
|
}
|
|
1238
1176
|
/**
|
|
@@ -1280,14 +1218,62 @@ type HookContext<T> = T extends SlotGame<infer G, infer S, infer U> ? Simulation
|
|
|
1280
1218
|
|
|
1281
1219
|
type InferGameType<TGameModes extends AnyGameModes, TSymbols extends AnySymbols, TUserState extends AnyUserData> = SlotGame<TGameModes, TSymbols, TUserState>;
|
|
1282
1220
|
interface CreateSlotGameOpts<TGameModes extends AnyGameModes = AnyGameModes, TSymbols extends AnySymbols = AnySymbols, TUserState extends AnyUserData = AnyUserData> {
|
|
1221
|
+
/**
|
|
1222
|
+
* The unique identifier of the game, used for configuration and identification.
|
|
1223
|
+
*/
|
|
1283
1224
|
id: CommonGameOptions["id"];
|
|
1225
|
+
/**
|
|
1226
|
+
* The name of the game, used for display purposes.
|
|
1227
|
+
*/
|
|
1284
1228
|
name: CommonGameOptions["name"];
|
|
1229
|
+
/**
|
|
1230
|
+
* A GameMode is the core structure of a slot, defining the board,\
|
|
1231
|
+
* bet cost, win type, and other properties.
|
|
1232
|
+
*/
|
|
1285
1233
|
gameModes: TGameModes;
|
|
1234
|
+
/**
|
|
1235
|
+
* A list of all symbols that will appear on the reels.
|
|
1236
|
+
*/
|
|
1286
1237
|
symbols: TSymbols;
|
|
1238
|
+
/**
|
|
1239
|
+
* A mapping from spin type to scatter counts to the number of free spins awarded.
|
|
1240
|
+
*
|
|
1241
|
+
* @example
|
|
1242
|
+
* ```ts
|
|
1243
|
+
* scatterToFreespins: {
|
|
1244
|
+
* [GameConfig.SPIN_TYPE.BASE_GAME]: {
|
|
1245
|
+
* 3: 10,
|
|
1246
|
+
* 4: 12,
|
|
1247
|
+
* 5: 15,
|
|
1248
|
+
* },
|
|
1249
|
+
* [GameConfig.SPIN_TYPE.FREE_SPINS]: {
|
|
1250
|
+
* 3: 6,
|
|
1251
|
+
* 4: 8,
|
|
1252
|
+
* 5: 10,
|
|
1253
|
+
* },
|
|
1254
|
+
* },
|
|
1255
|
+
* ```
|
|
1256
|
+
*/
|
|
1287
1257
|
scatterToFreespins: CommonGameOptions["scatterToFreespins"];
|
|
1258
|
+
/**
|
|
1259
|
+
* If set, this will pad the board with symbols on the top and bottom of the reels.\
|
|
1260
|
+
* Useful for teasing symbols right above or below the active board.
|
|
1261
|
+
*
|
|
1262
|
+
* Default: 1
|
|
1263
|
+
*/
|
|
1288
1264
|
padSymbols?: CommonGameOptions["padSymbols"];
|
|
1265
|
+
/**
|
|
1266
|
+
* The maximum win multiplier of the game, e.g. 5000 for a 5000x max win.
|
|
1267
|
+
*/
|
|
1289
1268
|
maxWinX: CommonGameOptions["maxWinX"];
|
|
1269
|
+
/**
|
|
1270
|
+
* Custom additional state that can be used in game flow logic.
|
|
1271
|
+
*/
|
|
1290
1272
|
userState?: TUserState;
|
|
1273
|
+
/**
|
|
1274
|
+
* Hooks are used to inject custom logic at specific points in the game flow.\
|
|
1275
|
+
* Some required hooks must be implemented for certain features to work.
|
|
1276
|
+
*/
|
|
1291
1277
|
hooks: CommonGameOptions<TGameModes, TSymbols, TUserState>["hooks"];
|
|
1292
1278
|
}
|
|
1293
1279
|
declare function createSlotGame<TGame>(opts: TGame extends InferGameType<infer G, infer S, infer U> ? CreateSlotGameOpts<G, S, U> : never): TGame;
|