@@ -106,14 +106,16 @@ module.exports = { | |||||
key: this.charname, | key: this.charname, | ||||
table: 'character', | table: 'character', | ||||
value: simple, | value: simple, | ||||
clean: true | |||||
clean: true, | |||||
serialize: true | |||||
}); | }); | ||||
await io.setAsync({ | await io.setAsync({ | ||||
key: this.username, | key: this.username, | ||||
table: 'stash', | table: 'stash', | ||||
value: this.obj.stash.serialize(), | value: this.obj.stash.serialize(), | ||||
clean: true | |||||
clean: true, | |||||
serialize: true | |||||
}); | }); | ||||
if (callback) | if (callback) | ||||
@@ -590,7 +590,8 @@ module.exports = { | |||||
await io.setAsync({ | await io.setAsync({ | ||||
key: username, | key: username, | ||||
table: 'skins', | table: 'skins', | ||||
value: JSON.stringify(skins) | |||||
value: skins, | |||||
serialize: true | |||||
}); | }); | ||||
}, | }, | ||||
@@ -3,9 +3,5 @@ module.exports = { | |||||
tickTime: 350, | tickTime: 350, | ||||
//The maximum level a player can reach | //The maximum level a player can reach | ||||
maxLevel: 20, | |||||
//Which DB engine to use | |||||
// Options: sqlite, rethinkdb | |||||
db: 'rethinkdb' | |||||
maxLevel: 20 | |||||
}; | }; |
@@ -7,7 +7,7 @@ module.exports = { | |||||
//Options: | //Options: | ||||
// sqlite | // sqlite | ||||
// rethink | // rethink | ||||
db: 'rethink', | |||||
db: 'sqlite', | |||||
dbHost: 'localhost', | dbHost: 'localhost', | ||||
dbPort: 28015 | dbPort: 28015 | ||||
}; | }; |
@@ -56,7 +56,8 @@ module.exports = { | |||||
}); | }); | ||||
this.list = list.map(l => ({ | this.list = list.map(l => ({ | ||||
name: l.id, | |||||
//This is a bit of a hack. RethinkDB uses 'id' whereas Sqlite uses 'key' | |||||
name: l.key || l.id, | |||||
level: l.value.level, | level: l.value.level, | ||||
prophecies: l.value.prophecies | prophecies: l.value.prophecies | ||||
})); | })); | ||||
@@ -1,7 +1,11 @@ | |||||
let serverConfig = require('../config/serverConfig'); | |||||
const useDb = process.env.db || serverConfig.db; | |||||
const moduleMap = { | const moduleMap = { | ||||
sqlite: 'Sqlite', | sqlite: 'Sqlite', | ||||
rethinkdb: 'RethinkDb' | rethinkdb: 'RethinkDb' | ||||
}; | }; | ||||
const modulePath = `./mail${moduleMap[consts.db]}`; | |||||
const modulePath = `./mail${moduleMap[useDb]}`; | |||||
module.exports = require(modulePath); | module.exports = require(modulePath); |
@@ -1,8 +1,8 @@ | |||||
let fs = require('fs'); | |||||
let util = require('util'); | let util = require('util'); | ||||
let serverConfig = require('../config/serverConfig'); | let serverConfig = require('../config/serverConfig'); | ||||
if (serverConfig.db === 'rethink') { | |||||
//eslint-disable-next-line no-process-env | |||||
if ((process.env.db || serverConfig.db) === 'rethink') { | |||||
module.exports = require('./ioRethink'); | module.exports = require('./ioRethink'); | ||||
return; | return; | ||||
} | } | ||||