UNPKG

pokie

Version:

A server-side video slot game logic framework for JavaScript and TypeScript.

89 lines 2.98 kB
import { GameSession, SymbolsCombination, SymbolsCombinationsGenerator, VideoSlotConfig, VideoSlotWinCalculator, } from "pokie"; export class VideoSlotSession { constructor(config = new VideoSlotConfig(), combinationsGenerator = new SymbolsCombinationsGenerator(config), winCalculator = new VideoSlotWinCalculator(config), baseSession = new GameSession(config)) { this.winAmount = 0; this.symbolsCombination = new SymbolsCombination(); this.config = config; this.combinationsGenerator = combinationsGenerator; this.winCalculator = winCalculator; this.baseSession = baseSession; this.symbolsCombination = this.combinationsGenerator.generateSymbolsCombination(); } getPaytable() { return this.config.getPaytable(); } getSymbolsCombination() { return this.symbolsCombination; } getWinningLines() { return this.winCalculator.getWinningLines(); } getWinningScatters() { return this.winCalculator.getWinningScatters(); } getSymbolsSequences() { return this.config.getSymbolsSequences(); } getReelsSymbolsNumber() { return this.config.getReelsSymbolsNumber(); } getReelsNumber() { return this.config.getReelsNumber(); } getAvailableSymbols() { return [...this.config.getAvailableSymbols()]; } getCreditsAmount() { return this.baseSession.getCreditsAmount(); } setCreditsAmount(creditsAmount) { this.baseSession.setCreditsAmount(creditsAmount); } getWinAmount() { return this.winAmount; } getLinesWinning() { return this.winCalculator.getLinesWinning(); } getScattersWinning() { return this.winCalculator.getScattersWinning(); } getAvailableBets() { return [...this.config.getAvailableBets()]; } getBet() { return this.baseSession.getBet(); } setBet(bet) { this.baseSession.setBet(bet); } canPlayNextGame() { return this.baseSession.canPlayNextGame(); } play() { this.baseSession.play(); this.symbolsCombination = this.combinationsGenerator.generateSymbolsCombination(); this.winCalculator.calculateWin(this.getBet(), this.symbolsCombination); this.winAmount = this.winCalculator.getWinAmount(); this.setCreditsAmount(this.getCreditsAmount() + this.winAmount); } isSymbolWild(symbolId) { return this.config.isSymbolWild(symbolId); } isSymbolScatter(symbolId) { return this.config.isSymbolScatter(symbolId); } getWildSymbols() { return this.config.getWildSymbols(); } getScatterSymbols() { return this.config.getScatterSymbols(); } getLinesDefinitions() { return this.config.getLinesDefinitions(); } getLinesPatterns() { return this.config.getLinesPatterns(); } } //# sourceMappingURL=VideoSlotSession.js.map