@omnitronix/bonnys-fortune-game-engine 1.2.0 → 1.2.2
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/__tests__/comprehensive.test.js +741 -0
- package/dist/__tests__/comprehensive.test.js.map +1 -0
- package/dist/bonnys-fortune-v1.game-engine.js +12 -7
- package/dist/bonnys-fortune-v1.game-engine.js.map +1 -1
- package/dist/domain/types/{cheat-trigger-bonus-command.js → debug-trigger-bonus-command.js} +1 -1
- package/dist/domain/types/debug-trigger-bonus-command.js.map +1 -0
- package/dist/domain/types/{cheat-trigger-bonus-request.dto.js → debug-trigger-bonus-request.dto.js} +1 -1
- package/dist/domain/types/debug-trigger-bonus-request.dto.js.map +1 -0
- package/dist/domain/types/{cheat-update-bonus-meter-progress-command.js → debug-update-bonus-meter-progress-command.js} +1 -1
- package/dist/domain/types/debug-update-bonus-meter-progress-command.js.map +1 -0
- package/dist/domain/types/{cheat-update-bonus-meter-progress-request.dto.js → debug-update-bonus-meter-progress-request.dto.js} +1 -1
- package/dist/domain/types/debug-update-bonus-meter-progress-request.dto.js.map +1 -0
- package/dist/logic/bonnys-fortune.game-logic.js +4 -2
- package/dist/logic/bonnys-fortune.game-logic.js.map +1 -1
- package/dist/rng/DummyRngClient.js +8 -1
- package/dist/rng/DummyRngClient.js.map +1 -1
- package/dist/rng/rng-client.factory.js +1 -2
- package/dist/rng/rng-client.factory.js.map +1 -1
- package/package.json +3 -4
- package/dist/__tests__/bonnys-fortune-v1.game-engine.test.d.ts +0 -1
- package/dist/bonnys-fortune-v1.game-engine.d.ts +0 -32
- package/dist/config/game-logic-config/file-system.game-logic-config-loader.d.ts +0 -4
- package/dist/config/game-logic-config/game-logic-config-loader.d.ts +0 -3
- package/dist/config/game-logic-config/game-logic-config.d.ts +0 -2
- package/dist/config/reel-strips-config/file-system.reel-strips-config-loader.d.ts +0 -4
- package/dist/config/reel-strips-config/reel-strip-option.dto.d.ts +0 -4
- package/dist/config/reel-strips-config/reel-strips-config-loader.d.ts +0 -3
- package/dist/config/reel-strips-config/reel-strips-config.dto.d.ts +0 -5
- package/dist/config/reel-strips-config/reel.dto.d.ts +0 -5
- package/dist/domain/game-round.types.d.ts +0 -9
- package/dist/domain/mappers/reel-strips-config.mapper.d.ts +0 -4
- package/dist/domain/reel-strip-option.d.ts +0 -7
- package/dist/domain/reel-strips-config.d.ts +0 -9
- package/dist/domain/reel.d.ts +0 -8
- package/dist/domain/types/cheat-trigger-bonus-command.d.ts +0 -5
- package/dist/domain/types/cheat-trigger-bonus-command.js.map +0 -1
- package/dist/domain/types/cheat-trigger-bonus-request.dto.d.ts +0 -5
- package/dist/domain/types/cheat-trigger-bonus-request.dto.js.map +0 -1
- package/dist/domain/types/cheat-update-bonus-meter-progress-command.d.ts +0 -5
- package/dist/domain/types/cheat-update-bonus-meter-progress-command.js.map +0 -1
- package/dist/domain/types/cheat-update-bonus-meter-progress-request.dto.d.ts +0 -5
- package/dist/domain/types/cheat-update-bonus-meter-progress-request.dto.js.map +0 -1
- package/dist/domain/types/game-spin-command.d.ts +0 -8
- package/dist/domain/types/game-spin-input.dto.d.ts +0 -8
- package/dist/domain/types/game-spin-output.dto.d.ts +0 -119
- package/dist/domain/types/game-symbols.response.dto.d.ts +0 -10
- package/dist/domain/types/reel-strip-option.dto.d.ts +0 -4
- package/dist/domain/types/reel-strips-config.dto.d.ts +0 -5
- package/dist/domain/types/reel.dto.d.ts +0 -5
- package/dist/domain/types/start-bonus-round-command.d.ts +0 -8
- package/dist/domain/types/start-bonus-round-input.dto.d.ts +0 -10
- package/dist/game-engine.interface.d.ts +0 -41
- package/dist/helpers/generate-hash.d.ts +0 -1
- package/dist/helpers/number-helper.d.ts +0 -23
- package/dist/helpers/optional-boolean-mapper.d.ts +0 -1
- package/dist/helpers/uuid-helper.d.ts +0 -3
- package/dist/helpers/validation-helper.d.ts +0 -14
- package/dist/index.d.ts +0 -2
- package/dist/logger/logger.d.ts +0 -22
- package/dist/logic/bonnys-fortune.game-logic.d.ts +0 -32
- package/dist/logic/bonnys-fortune.spin-generator.d.ts +0 -19
- package/dist/logic/bonnys-fortune.types.d.ts +0 -170
- package/dist/logic/bonnys-fortune.win-calculator.d.ts +0 -10
- package/dist/logic/game-logic-config.interface.d.ts +0 -178
- package/dist/logic/handlers/base-game.handler.d.ts +0 -15
- package/dist/logic/handlers/collect-feature-bonus.handler.d.ts +0 -13
- package/dist/logic/handlers/free-spins-bonus.handler.d.ts +0 -11
- package/dist/logic/handlers/steering-to-the-fortune-bonus.handler.d.ts +0 -11
- package/dist/logic/handlers/treasure-hunt-bonus.handler.d.ts +0 -15
- package/dist/rng/DummyRngClient.d.ts +0 -18
- package/dist/rng/rng-client.factory.d.ts +0 -7
- package/dist/rng/rng-client.interface.d.ts +0 -16
- package/dist/rng/rng-service.d.ts +0 -26
- package/dist/validation/abstract-game-logic-config.validator.d.ts +0 -4
- package/dist/validation/bonnys-fortune/bonnys-fortune-config.dto.d.ts +0 -129
- package/dist/validation/bonnys-fortune/bonnys-fortune-config.validator.d.ts +0 -5
- package/dist/validation/custom-decorators/IsNestedIntArray.d.ts +0 -2
- package/dist/validation/game-logic-config-validation.service.d.ts +0 -8
- package/dist/validation/reel-strips-config-validation.service.d.ts +0 -5
- package/src/__tests__/bonnys-fortune-v1.game-engine.test.ts +0 -80
- package/src/bonnys-fortune-v1.game-engine.ts +0 -285
- package/src/config/game-logic-config/file-system.game-logic-config-loader.ts +0 -27
- package/src/config/game-logic-config/game-logic-config-loader.ts +0 -3
- package/src/config/game-logic-config/game-logic-config.ts +0 -380
- package/src/config/reel-strips-config/file-system.reel-strips-config-loader.ts +0 -43
- package/src/config/reel-strips-config/reel-strip-option.dto.ts +0 -13
- package/src/config/reel-strips-config/reel-strips-config-loader.ts +0 -9
- package/src/config/reel-strips-config/reel-strips-config.dto.ts +0 -16
- package/src/config/reel-strips-config/reel.dto.ts +0 -16
- package/src/config/reel-strips-config/reels-BASE.csv +0 -52
- package/src/config/reel-strips-config/reels-BONUS.csv +0 -52
- package/src/domain/game-round.types.ts +0 -10
- package/src/domain/mappers/reel-strips-config.mapper.ts +0 -16
- package/src/domain/reel-strip-option.ts +0 -15
- package/src/domain/reel-strips-config.ts +0 -21
- package/src/domain/reel.ts +0 -17
- package/src/domain/types/cheat-trigger-bonus-command.ts +0 -5
- package/src/domain/types/cheat-trigger-bonus-request.dto.ts +0 -5
- package/src/domain/types/cheat-update-bonus-meter-progress-command.ts +0 -6
- package/src/domain/types/cheat-update-bonus-meter-progress-request.dto.ts +0 -5
- package/src/domain/types/game-spin-command.ts +0 -8
- package/src/domain/types/game-spin-input.dto.ts +0 -8
- package/src/domain/types/game-spin-output.dto.ts +0 -142
- package/src/domain/types/game-symbols.response.dto.ts +0 -11
- package/src/domain/types/reel-strip-option.dto.ts +0 -13
- package/src/domain/types/reel-strips-config.dto.ts +0 -15
- package/src/domain/types/reel.dto.ts +0 -15
- package/src/domain/types/start-bonus-round-command.ts +0 -8
- package/src/domain/types/start-bonus-round-input.dto.ts +0 -10
- package/src/game-engine.interface.ts +0 -59
- package/src/helpers/generate-hash.ts +0 -5
- package/src/helpers/number-helper.ts +0 -41
- package/src/helpers/optional-boolean-mapper.ts +0 -5
- package/src/helpers/uuid-helper.ts +0 -7
- package/src/helpers/validation-helper.ts +0 -27
- package/src/index.ts +0 -3
- package/src/logger/logger.ts +0 -178
- package/src/logic/bonnys-fortune.game-logic.ts +0 -480
- package/src/logic/bonnys-fortune.spin-generator.ts +0 -277
- package/src/logic/bonnys-fortune.types.ts +0 -223
- package/src/logic/bonnys-fortune.win-calculator.ts +0 -210
- package/src/logic/game-logic-config.interface.ts +0 -174
- package/src/logic/handlers/base-game.handler.ts +0 -213
- package/src/logic/handlers/collect-feature-bonus.handler.ts +0 -301
- package/src/logic/handlers/free-spins-bonus.handler.ts +0 -119
- package/src/logic/handlers/steering-to-the-fortune-bonus.handler.ts +0 -118
- package/src/logic/handlers/treasure-hunt-bonus.handler.ts +0 -232
- package/src/rng/DummyRngClient.ts +0 -108
- package/src/rng/rng-client.factory.ts +0 -27
- package/src/rng/rng-client.interface.ts +0 -38
- package/src/rng/rng-service.ts +0 -130
- package/src/validation/abstract-game-logic-config.validator.ts +0 -20
- package/src/validation/bonnys-fortune/bonnys-fortune-config.dto.ts +0 -371
- package/src/validation/bonnys-fortune/bonnys-fortune-config.validator.ts +0 -8
- package/src/validation/custom-decorators/IsNestedIntArray.ts +0 -29
- package/src/validation/game-logic-config-validation.service.ts +0 -28
- package/src/validation/reel-strips-config-validation.service.ts +0 -29
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { ReelStripsConfigLoader } from './reel-strips-config-loader';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { readFileSync } from 'fs';
|
|
4
|
-
|
|
5
|
-
export class FileSystemReelStripsConfigLoader
|
|
6
|
-
implements ReelStripsConfigLoader
|
|
7
|
-
{
|
|
8
|
-
public async loadConfig(
|
|
9
|
-
gameId: string,
|
|
10
|
-
variantId: string,
|
|
11
|
-
reelSetName: string,
|
|
12
|
-
reelsCount: number,
|
|
13
|
-
optionsCount: number,
|
|
14
|
-
): Promise<number[][][]> {
|
|
15
|
-
const filePath = path.resolve(__dirname, `./reels-${reelSetName}.csv`);
|
|
16
|
-
|
|
17
|
-
const content = readFileSync(filePath, 'utf-8');
|
|
18
|
-
const lines = content
|
|
19
|
-
.split('\n')
|
|
20
|
-
.map((line) => line.trim())
|
|
21
|
-
.filter((line) => line.length > 0)
|
|
22
|
-
.slice(2); // skip headers
|
|
23
|
-
|
|
24
|
-
const result: number[][][] = Array.from({ length: reelsCount }, () =>
|
|
25
|
-
Array.from({ length: optionsCount }, () => []),
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
for (const line of lines) {
|
|
29
|
-
const values = line.split(';').map((v) => v.trim());
|
|
30
|
-
|
|
31
|
-
for (let reel = 0; reel < reelsCount; reel++) {
|
|
32
|
-
for (let opt = 0; opt < optionsCount; opt++) {
|
|
33
|
-
const val = values[reel * optionsCount + opt];
|
|
34
|
-
if (val !== '') {
|
|
35
|
-
result[reel][opt].push(Number(val));
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return result;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ArrayNotEmpty, IsArray, IsInt, Min } from 'class-validator';
|
|
2
|
-
|
|
3
|
-
export class ReelStripOptionDto {
|
|
4
|
-
@IsArray()
|
|
5
|
-
@ArrayNotEmpty()
|
|
6
|
-
@IsInt({ each: true })
|
|
7
|
-
@Min(0, { each: true })
|
|
8
|
-
public symbols: number[];
|
|
9
|
-
|
|
10
|
-
constructor(symbols: number[]) {
|
|
11
|
-
this.symbols = symbols;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ArrayNotEmpty, IsArray, ValidateNested } from 'class-validator';
|
|
2
|
-
|
|
3
|
-
import { ReelDto } from './reel.dto';
|
|
4
|
-
import { Type } from 'class-transformer';
|
|
5
|
-
|
|
6
|
-
export class ReelStripsConfigDto {
|
|
7
|
-
@IsArray()
|
|
8
|
-
@ArrayNotEmpty()
|
|
9
|
-
@ValidateNested({ each: true })
|
|
10
|
-
@Type(() => ReelDto)
|
|
11
|
-
public reels: ReelDto[];
|
|
12
|
-
|
|
13
|
-
constructor(reels: ReelDto[]) {
|
|
14
|
-
this.reels = reels;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ArrayNotEmpty, IsArray, ValidateNested } from 'class-validator';
|
|
2
|
-
|
|
3
|
-
import { ReelStripOptionDto } from './reel-strip-option.dto';
|
|
4
|
-
import { Type } from 'class-transformer';
|
|
5
|
-
|
|
6
|
-
export class ReelDto {
|
|
7
|
-
@IsArray()
|
|
8
|
-
@ArrayNotEmpty()
|
|
9
|
-
@ValidateNested({ each: true })
|
|
10
|
-
@Type(() => ReelStripOptionDto)
|
|
11
|
-
public options: ReelStripOptionDto[];
|
|
12
|
-
|
|
13
|
-
constructor(options: ReelStripOptionDto[]) {
|
|
14
|
-
this.options = options;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
Reel 1;;;;Reel 2;;;;Reel 3;;;;Reel 4;;;;Reel 5;;;
|
|
2
|
-
option 0;option 1;option 2;option 3;option 0;option 1;option 2;option 3;option 0;option 1;option 2;option 3;option 0;option 1;option 2;option 3;option 0;option 1;option 2;option 3
|
|
3
|
-
9;8;9;8;8;9;8;9;9;8;9;9;9;9;9;9;9;9;9;8
|
|
4
|
-
9;8;9;8;8;9;8;9;9;8;9;9;9;9;9;9;9;9;9;8
|
|
5
|
-
9;8;9;9;8;9;9;10;10;8;10;8;9;8;8;10;8;9;9;9
|
|
6
|
-
7;6;7;6;6;7;6;7;7;6;7;6;6;7;6;7;7;6;7;6
|
|
7
|
-
7;6;7;7;6;7;10;7;7;6;7;10;10;7;10;7;7;6;7;7
|
|
8
|
-
7;4;6;4;4;7;4;6;7;4;6;4;4;7;4;6;7;4;6;4
|
|
9
|
-
9;8;8;8;8;9;8;8;9;8;8;8;5;8;8;8;8;5;8;8
|
|
10
|
-
5;8;5;3;8;5;3;5;5;10;5;3;8;10;3;3;5;8;5;3
|
|
11
|
-
5;4;5;5;4;5;5;5;5;4;5;5;4;4;5;3;4;4;5;5
|
|
12
|
-
7;6;7;6;6;7;6;7;7;6;7;7;6;6;7;7;6;6;7;6
|
|
13
|
-
9;8;9;9;8;9;9;9;9;8;9;8;8;9;7;9;9;8;9;9
|
|
14
|
-
3;8;3;9;8;3;9;3;3;8;3;9;3;10;9;5;3;3;3;9
|
|
15
|
-
3;6;3;3;6;3;3;3;3;6;3;3;10;4;3;5;4;7;3;3
|
|
16
|
-
5;6;5;7;6;5;7;5;5;6;5;6;6;5;6;5;5;6;5;7
|
|
17
|
-
9;6;8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;8;9;6;8;6
|
|
38
|
-
9;6;8;6;6;9;6;8;9;6;8;6;6;9;6;8;9;6;8;6
|
|
39
|
-
5;6;5;3;6;5;3;5;10;6;5;3;6;10;3;3;5;6;5;3
|
|
40
|
-
5;8;5;9;8;5;10;5;5;8;5;10;10;5;10;5;5;8;5;9
|
|
41
|
-
7;8;7;9;8;7;9;7;7;8;7;9;8;6;9;9;6;8;7;9
|
|
42
|
-
7;8;7;8;8;7;8;7;7;8;7;9;8;7;9;9;7;8;7;8
|
|
43
|
-
9;6;9;6;6;9;6;9;9;6;9;6;6;9;5;7;9;6;9;6
|
|
44
|
-
9;6;9;6;6;9;6;9;9;6;9;6;6;9;5;7;9;6;9;6
|
|
45
|
-
9;6;9;6;6;9;6;10;10;6;10;6;6;9;5;10;9;6;9;6
|
|
46
|
-
5;8;4;8;8;5;8;4;5;8;4;8;9;4;8;4;4;9;4;8
|
|
47
|
-
3;4;4;5;4;3;5;4;3;4;4;5;4;4;6;4;4;4;4;5
|
|
48
|
-
3;4;8;5;4;3;5;8;3;4;8;5;4;10;6;8;4;4;8;5
|
|
49
|
-
9;4;9;4;4;9;4;9;9;10;9;4;10;9;4;9;9;5;9;4
|
|
50
|
-
5;6;5;7;6;5;7;5;5;6;5;6;7;5;6;5;5;7;5;7
|
|
51
|
-
7;6;6;7;6;7;7;6;7;6;6;6;7;7;6;6;7;7;6;7
|
|
52
|
-
7;6;6;7;6;7;7;6;7;6;6;7;7;7;8;6;7;7;6;7
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
Reel 1;;;;Reel 2;;;;Reel 3;;;;Reel 4;;;;Reel 5;;;
|
|
2
|
-
option 0;option 1;option 2;option 3;option 0;option 1;option 2;option 3;option 0;option 1;option 2;option 3;option 0;option 1;option 2;option 3;option 0;option 1;option 2;option 3
|
|
3
|
-
9;8;9;8;8;9;8;9;5;8;9;8;6;9;8;9;9;8;9;8
|
|
4
|
-
9;8;9;8;8;9;10;10;5;8;10;10;6;9;10;10;9;8;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6;6;6
|
|
46
|
-
7;6;6;7;6;7;9;6;7;6;6;9;6;7;7;6;7;6;6;7
|
|
47
|
-
9;8;8;8;8;9;8;9;9;8;9;8;8;9;8;8;9;8;8;8
|
|
48
|
-
9;8;8;8;8;9;8;9;9;8;9;8;8;9;8;8;9;8;8;8
|
|
49
|
-
3;2;3;3;2;3;3;3;10;10;3;3;10;10;3;3;3;2;3;3
|
|
50
|
-
5;4;4;4;4;5;4;4;5;4;4;4;4;5;4;4;5;4;4;4
|
|
51
|
-
7;6;7;6;6;7;6;7;1;6;7;6;8;7;6;7;7;6;7;6
|
|
52
|
-
7;6;7;7;6;7;1;7;1;6;7;8;8;7;7;7;7;6;7;7
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Reel } from '../reel';
|
|
2
|
-
import { ReelStripOption } from '../reel-strip-option';
|
|
3
|
-
import { ReelStripsConfig } from '../reel-strips-config';
|
|
4
|
-
|
|
5
|
-
export class ReelStripsConfigMapper {
|
|
6
|
-
public mapRawToDomain(rawReels: number[][][]): ReelStripsConfig {
|
|
7
|
-
const reels: Reel[] = rawReels.map((reelOptions) => {
|
|
8
|
-
const options: ReelStripOption[] = reelOptions.map(
|
|
9
|
-
(symbols) => new ReelStripOption(symbols),
|
|
10
|
-
);
|
|
11
|
-
return new Reel(options);
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
return new ReelStripsConfig(reels);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export class ReelStripOption {
|
|
2
|
-
constructor(public readonly symbols: number[]) {}
|
|
3
|
-
|
|
4
|
-
public getSymbols(): number[] {
|
|
5
|
-
return this.symbols;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
public get length(): number {
|
|
9
|
-
return this.symbols.length;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
public getSymbolAt(position: number): number {
|
|
13
|
-
return this.symbols[position % this.length];
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Reel } from './reel';
|
|
2
|
-
|
|
3
|
-
export class ReelStripsConfig {
|
|
4
|
-
constructor(public readonly reels: Reel[]) {}
|
|
5
|
-
|
|
6
|
-
public getReels(): Reel[] {
|
|
7
|
-
return this.reels;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
public getReel(index: number): Reel {
|
|
11
|
-
return this.reels[index];
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
public get reelsCount(): number {
|
|
15
|
-
return this.reels.length;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
public get optionsCount(): number {
|
|
19
|
-
return this.reels[0]?.numberOfOptions ?? 0;
|
|
20
|
-
}
|
|
21
|
-
}
|
package/src/domain/reel.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ReelStripOption } from './reel-strip-option';
|
|
2
|
-
|
|
3
|
-
export class Reel {
|
|
4
|
-
constructor(public readonly options: ReelStripOption[]) {}
|
|
5
|
-
|
|
6
|
-
public getOptions(): ReelStripOption[] {
|
|
7
|
-
return this.options;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
public getOption(index: number): ReelStripOption {
|
|
11
|
-
return this.options[index];
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
public get numberOfOptions(): number {
|
|
15
|
-
return this.options.length;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
export enum SpinType {
|
|
2
|
-
BASE_GAME_SPIN = 'BASE_GAME_SPIN',
|
|
3
|
-
BONUS_GAME_1_SPIN = 'BONUS_GAME_1_SPIN',
|
|
4
|
-
BONUS_GAME_2_SPIN = 'BONUS_GAME_2_SPIN',
|
|
5
|
-
BONUS_GAME_3_SPIN = 'BONUS_GAME_3_SPIN',
|
|
6
|
-
COLLECT_FEATURE_SPIN = 'COLLECT_FEATURE_SPIN',
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export enum PrizeType {
|
|
10
|
-
MULTIPLIER = 'MULTIPLIER',
|
|
11
|
-
BONUS = 'BONUS',
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/** Triggered bonus */
|
|
15
|
-
export interface TriggeredBonusDto {
|
|
16
|
-
bonusId: string;
|
|
17
|
-
bonusType: string;
|
|
18
|
-
betAmount: number;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/** Winning line */
|
|
22
|
-
export interface WinningLineDto {
|
|
23
|
-
win: number;
|
|
24
|
-
ways: number;
|
|
25
|
-
symbol: number;
|
|
26
|
-
positions: number[][];
|
|
27
|
-
multiplier: number;
|
|
28
|
-
consecutiveReels: number;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/** Win result */
|
|
32
|
-
export interface WinResultDto {
|
|
33
|
-
totalWin: number;
|
|
34
|
-
winningLines: WinningLineDto[];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/** Bonus meter */
|
|
38
|
-
export interface BonusMeterDto {
|
|
39
|
-
progress: number;
|
|
40
|
-
symbolId: number;
|
|
41
|
-
threshold: number;
|
|
42
|
-
symbolName: string;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/** Public state */
|
|
46
|
-
export interface PublicStateDto {
|
|
47
|
-
bonusMeters: Record<string, BonusMeterDto>;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/** Base Game Spin */
|
|
51
|
-
export interface BaseGameSpinResultDto {
|
|
52
|
-
spinType: SpinType;
|
|
53
|
-
screen: number[][];
|
|
54
|
-
winResult: WinResultDto;
|
|
55
|
-
playerWinning: number;
|
|
56
|
-
nextSpinType: SpinType;
|
|
57
|
-
triggeredBonus?: TriggeredBonusDto;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/** Treasure Hunt (Bonus Game 1) */
|
|
61
|
-
export interface TreasureHuntSpinResultDto {
|
|
62
|
-
spinType: SpinType;
|
|
63
|
-
selection: string;
|
|
64
|
-
multiplier: number;
|
|
65
|
-
multiplierCounts: Record<string, number>;
|
|
66
|
-
winningMultiplier: number | null;
|
|
67
|
-
winningCount: number;
|
|
68
|
-
totalMultiplier: number;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/** Free Spin (Bonus Game 2) */
|
|
72
|
-
export interface FreeSpinResultDto {
|
|
73
|
-
spinType: SpinType;
|
|
74
|
-
screen: number[][];
|
|
75
|
-
playerWinning: number;
|
|
76
|
-
nextSpinType: SpinType;
|
|
77
|
-
multiplier: number;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/** Steering to the Fortune (Bonus Game 3) */
|
|
81
|
-
export interface SteeringToTheFortuneResultDto {
|
|
82
|
-
spinType: SpinType;
|
|
83
|
-
playerWinning: number;
|
|
84
|
-
nextSpinType: SpinType;
|
|
85
|
-
prizeType: PrizeType;
|
|
86
|
-
prizeValue?: number | string;
|
|
87
|
-
totalMultiplier: number;
|
|
88
|
-
triggeredBonus?: TriggeredBonusDto;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/** Collect Feature Spin */
|
|
92
|
-
export interface CollectFeatureSpinResultDto {
|
|
93
|
-
spinIndex?: number;
|
|
94
|
-
spinType: SpinType;
|
|
95
|
-
symbols?: string[];
|
|
96
|
-
slashed?: boolean[];
|
|
97
|
-
currentValues?: number;
|
|
98
|
-
currentMultipliers?: number;
|
|
99
|
-
totalValues?: number;
|
|
100
|
-
totalMultipliers?: number;
|
|
101
|
-
playerWinning: number;
|
|
102
|
-
totalWin?: number;
|
|
103
|
-
spinsLeft?: number;
|
|
104
|
-
nextSpinType: SpinType;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export interface BaseGameSpinResultWrapperDto {
|
|
108
|
-
result: BaseGameSpinResultDto;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export interface FreeSpinResultWrapperDto {
|
|
112
|
-
result: FreeSpinResultDto;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export interface TreasureHuntSpinResultWrapperDto {
|
|
116
|
-
result: TreasureHuntSpinResultDto;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export interface SteeringToTheFortuneResultWrapperDto {
|
|
120
|
-
result: SteeringToTheFortuneResultDto;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export interface CollectFeatureSpinResultWrapperDto {
|
|
124
|
-
result: CollectFeatureSpinResultDto;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/** Game Spin Output DTO */
|
|
128
|
-
export interface GameSpinOutputDto {
|
|
129
|
-
sessionId: string;
|
|
130
|
-
balance: number;
|
|
131
|
-
betAmount: number;
|
|
132
|
-
balanceBeforeSpin: number;
|
|
133
|
-
outcome: BaseGameSpinResultWrapperDto;
|
|
134
|
-
publicState: PublicStateDto;
|
|
135
|
-
lastSpin:
|
|
136
|
-
| BaseGameSpinResultWrapperDto
|
|
137
|
-
| FreeSpinResultWrapperDto
|
|
138
|
-
| TreasureHuntSpinResultWrapperDto
|
|
139
|
-
| SteeringToTheFortuneResultWrapperDto
|
|
140
|
-
| CollectFeatureSpinResultWrapperDto
|
|
141
|
-
| null;
|
|
142
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ArrayNotEmpty, IsArray, IsInt, Min } from 'class-validator';
|
|
2
|
-
|
|
3
|
-
export class ReelStripOptionDto {
|
|
4
|
-
@IsArray()
|
|
5
|
-
@ArrayNotEmpty()
|
|
6
|
-
@IsInt({ each: true })
|
|
7
|
-
@Min(0, { each: true })
|
|
8
|
-
public symbols: number[];
|
|
9
|
-
|
|
10
|
-
constructor(symbols: number[]) {
|
|
11
|
-
this.symbols = symbols;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ArrayNotEmpty, IsArray } from 'class-validator';
|
|
2
|
-
|
|
3
|
-
import { ReelDto } from './reel.dto';
|
|
4
|
-
import { Type } from 'class-transformer';
|
|
5
|
-
|
|
6
|
-
export class ReelStripsConfigDto {
|
|
7
|
-
@IsArray()
|
|
8
|
-
@ArrayNotEmpty()
|
|
9
|
-
@Type(() => ReelDto)
|
|
10
|
-
public reels: ReelDto[];
|
|
11
|
-
|
|
12
|
-
constructor(reels: ReelDto[]) {
|
|
13
|
-
this.reels = reels;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ArrayNotEmpty, IsArray } from 'class-validator';
|
|
2
|
-
|
|
3
|
-
import { ReelStripOptionDto } from './reel-strip-option.dto';
|
|
4
|
-
import { Type } from 'class-transformer';
|
|
5
|
-
|
|
6
|
-
export class ReelDto {
|
|
7
|
-
@IsArray()
|
|
8
|
-
@ArrayNotEmpty()
|
|
9
|
-
@Type(() => ReelStripOptionDto)
|
|
10
|
-
public options: ReelStripOptionDto[];
|
|
11
|
-
|
|
12
|
-
constructor(options: ReelStripOptionDto[]) {
|
|
13
|
-
this.options = options;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { RngClientConfig } from '@omnitronix/rng-client-core';
|
|
2
|
-
|
|
3
|
-
export type GameEngineMetricsHandlers = RngClientConfig['metrics']['handlers'];
|
|
4
|
-
export interface GameEngineConfig {
|
|
5
|
-
metrics?: {
|
|
6
|
-
handlers: GameEngineMetricsHandlers;
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface GameEngineInfo {
|
|
11
|
-
gameCode: string;
|
|
12
|
-
version: string;
|
|
13
|
-
rtp: number;
|
|
14
|
-
gameType: string;
|
|
15
|
-
gameName: string;
|
|
16
|
-
provider: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface RngOutcomeRecord {
|
|
20
|
-
result: number;
|
|
21
|
-
seed: number;
|
|
22
|
-
min: number;
|
|
23
|
-
max: number;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export type RngOutcome = { [actionId: string]: RngOutcomeRecord };
|
|
27
|
-
|
|
28
|
-
export interface CommandProcessingResult<
|
|
29
|
-
TPublicState = any,
|
|
30
|
-
TPrivateState = any,
|
|
31
|
-
TOutcome = any,
|
|
32
|
-
> {
|
|
33
|
-
success: boolean;
|
|
34
|
-
publicState: TPublicState;
|
|
35
|
-
privateState: TPrivateState;
|
|
36
|
-
outcome?: TOutcome;
|
|
37
|
-
message?: string;
|
|
38
|
-
rngOutcome?: RngOutcome;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface GameActionCommand<TPayload = any> {
|
|
42
|
-
id: string;
|
|
43
|
-
type: string;
|
|
44
|
-
payload?: TPayload;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface GameEngine<
|
|
48
|
-
TPublicState = any,
|
|
49
|
-
TPrivateState = any,
|
|
50
|
-
TOutcome = any,
|
|
51
|
-
> {
|
|
52
|
-
processCommand(
|
|
53
|
-
publicState: TPublicState,
|
|
54
|
-
privateState: TPrivateState,
|
|
55
|
-
command: GameActionCommand,
|
|
56
|
-
): Promise<CommandProcessingResult<TPublicState, TPrivateState, TOutcome>>;
|
|
57
|
-
|
|
58
|
-
getGameEngineInfo(): GameEngineInfo;
|
|
59
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export class NumberHelper {
|
|
2
|
-
/**
|
|
3
|
-
* Safely formats a number to the specified decimal places,
|
|
4
|
-
* minimizing floating-point issues.
|
|
5
|
-
*/
|
|
6
|
-
public static toFixedNumber(value: number, decimals: number): number {
|
|
7
|
-
const factor = Math.pow(10, decimals);
|
|
8
|
-
return Math.round((value + Number.EPSILON) * factor) / factor;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Safely adds two numbers and formats result.
|
|
13
|
-
*/
|
|
14
|
-
public static safeSum(a: number, b: number, decimals: number): number {
|
|
15
|
-
const result = a * Math.pow(10, decimals) + b * Math.pow(10, decimals);
|
|
16
|
-
return result / Math.pow(10, decimals);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Safely multiplies two numbers and formats result.
|
|
21
|
-
*/
|
|
22
|
-
public static safeMultiply(a: number, b: number, decimals: number): number {
|
|
23
|
-
const result = a * Math.pow(10, decimals) * (b * Math.pow(10, decimals));
|
|
24
|
-
return result / Math.pow(10, decimals * 2);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Clamps a number between min and max.
|
|
29
|
-
*/
|
|
30
|
-
public static clamp(value: number, min: number, max: number): number {
|
|
31
|
-
return Math.min(Math.max(value, min), max);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Safely divides two numbers.
|
|
36
|
-
*/
|
|
37
|
-
public static safeDivide(a: number, b: number, decimals: number): number {
|
|
38
|
-
if (b === 0) throw new Error('Division by zero');
|
|
39
|
-
return this.toFixedNumber(a / b, decimals);
|
|
40
|
-
}
|
|
41
|
-
}
|