-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
36 lines (29 loc) · 1.01 KB
/
index.js
File metadata and controls
36 lines (29 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const fs = require('fs');
const FileSync = require('lowdb/adapters/FileSync');
const Seraph = require('./services/seraph.js');
const Fate = require('./services/fate.js');
const Sheba = require('./services/sheba.js');
const seraph = new Seraph(new FileSync('docs/json/akasha.json'));
const fate = new Fate(seraph);
const sheba = new Sheba('docs/img/');
module.exports.summon = fate.summon.bind(fate);
module.exports.search = seraph.search.bind(seraph);
module.exports.getDetails = id => {
const svt = seraph.findById(id);
if (!svt) {
return svt;
}
const details = JSON.parse(JSON.stringify(svt));
details.actives = seraph.findActivesBySvtId(id);
details.passives = seraph.findPassivesBySvtId(id);
details.np = seraph.findNoblePhantasmById(id);
details.splashes = [];
try {
for (let asc = 1; asc <= Number.MAX_SAFE_INTEGER; asc++) {
const path = sheba.getImgPath(id, asc.toString());
fs.statSync(path).isFile();
details.splashes.push(path);
}
} catch (error) {}
return details;
};