Flask of Rum - Slot Game
pragma Singleton
import Felgo 4.0
import QtQuick 2.0
SlotMachineModel {
symbols: {
"rum": {
frequency: 1,
data: {
source: "SymbolRum.png",
winFactor: [1, 20, 200]
}
},
"ten": {
frequency: 5,
data: {
source: "Symbol10.png",
winFactor: [1, 5, 20]
}
},
"J": {
frequency: 5,
data: {
source: "SymbolJ.png",
winFactor: [1, 5, 20]
}
},
"Q": {
frequency: 5,
data: {
source: "SymbolQ.png",
winFactor: [1, 5, 20]
}
},
"K": {
frequency: 4,
data: {
source: "SymbolK.png",
winFactor: [1, 8, 30]
}
},
"A": {
frequency: 4,
data: {
source: "SymbolA.png",
winFactor: [1, 8, 30]
}
},
"parrot": {
frequency: 3,
data: {
source: "SymbolParrot.png",
winFactor: [6, 20, 150]
}
},
"skull": {
frequency: 3,
data: {
source: "SymbolSkull.png",
winFactor: [6, 20, 150]
}
},
"treasure": {
frequency: 2,
data: {
source: "SymbolTreasure.png",
winFactor: [8, 80, 400]
}
},
"captain": {
frequency: 1,
data: {
source: "SymbolCaptain.png",
winFactor: [20, 200, 1000]
}
}
}
function getSymbolData(symbol) {
if(symbols[symbol] === undefined)
return null
else
return symbols[symbol].data
}
function getWinFactor(symbol, length) {
var symbolData = getSymbolData(symbol)
if(symbolData === null)
return 0
var index = length - 3
if(symbolData.winFactor === undefined || symbolData.winFactor[index] === undefined)
return 0