UNPKG

pokie

Version:

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

55 lines 1.81 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.WinningLinesAnalyzer = void 0; const pokie_1 = require("pokie"); class WinningLinesAnalyzer { static allLinesHaveSameSymbolId(lines) { let id = null; let result = true; for (const line of lines) { if (id === null) { id = line.getSymbolId(); } else if (lines.length > 1 && id !== line.getSymbolId()) { result = false; break; } } return result; } static getLinesWithSymbol(lines, symbolsCombination, symbolId) { const result = []; for (const line of lines) { const lineSymbols = pokie_1.SymbolsCombinationsAnalyzer.getSymbolsForDefinition(symbolsCombination, line.getDefinition()); for (const lineSymbol of lineSymbols) { if (lineSymbol === symbolId) { result.push(line); break; } } } return result; } static getLinesWithWinningSymbol(lines, symbolId) { const result = []; for (const line of lines) { if (line.getSymbolId() === symbolId) { result.push(line); } } return result; } static getLinesWithDifferentWinningSymbols(lines) { const symbols = []; const result = []; for (const line of lines) { if (symbols.indexOf(line.getSymbolId()) < 0) { symbols.push(line.getSymbolId()); result.push(line); } } return result.length > 1 ? result : []; } } exports.WinningLinesAnalyzer = WinningLinesAnalyzer; //# sourceMappingURL=WinningLinesAnalyzer.js.map