2023-11-19 01:59:31 +01:00
|
|
|
import { games } from './games.js'
|
|
|
|
|
2024-01-22 21:16:58 +01:00
|
|
|
export const lookup = (options) => {
|
|
|
|
const type = options.type
|
|
|
|
|
2023-11-19 01:59:31 +01:00
|
|
|
if (!type) { throw Error('No game specified') }
|
|
|
|
|
|
|
|
if (type.startsWith('protocol-')) {
|
|
|
|
return {
|
|
|
|
protocol: type.substring(9)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-22 21:16:58 +01:00
|
|
|
let game = games[type]
|
2024-01-22 22:05:52 +01:00
|
|
|
|
2024-01-22 21:16:58 +01:00
|
|
|
if (options.checkOldIDs) {
|
|
|
|
Object.keys(games).forEach((id) => {
|
2024-01-22 22:05:52 +01:00
|
|
|
if (games[id]?.extra?.old_id === type) {
|
2024-01-22 21:16:58 +01:00
|
|
|
game = games[id]
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
2023-11-19 01:59:31 +01:00
|
|
|
|
|
|
|
if (!game) { throw Error('Invalid game: ' + type) }
|
|
|
|
|
|
|
|
return game.options
|
|
|
|
}
|