2021-03-08 19:42:32 +01:00
|
|
|
const db = require("../db.json");
|
|
|
|
|
|
|
|
const types = {
|
|
|
|
"execCommand": require("./ExecCommand"),
|
2021-03-09 09:26:53 +01:00
|
|
|
"deck": require("./Deck"),
|
2021-03-09 17:18:39 +01:00
|
|
|
"keys": require("./Keys"),
|
|
|
|
"obs": require("./OBS")
|
2021-03-08 19:42:32 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports.types = types;
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param name
|
|
|
|
* @param x
|
|
|
|
* @param y
|
|
|
|
* @returns {null|Base}
|
|
|
|
*/
|
|
|
|
module.exports.getSlot = (name, x, y) => {
|
|
|
|
if (name in db.decks)
|
|
|
|
if (x in db.decks[name].rows)
|
|
|
|
if (y in db.decks[name].rows[x]) {
|
|
|
|
let d = db.decks[name].rows[x][y];
|
|
|
|
return new types[d.type](d.text, d.image, d.options);
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
};
|