-
Notifications
You must be signed in to change notification settings - Fork 21
/
po-read-learnsets.js
47 lines (38 loc) · 1.42 KB
/
po-read-learnsets.js
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
37
38
39
40
41
42
43
44
45
46
47
var fs = require("fs");
var POMoves = require('./po-moves.js');
var POPokemon = require('./po-pokemon.js');
console.log('read level-up moves');
var LearnsetsG6 = {};
(function() {
var data = String(fs.readFileSync('db/pokes/6G/level_moves.txt')).split('\n');
for (var i=0; i<data.length; i++) {
var line = data[i].split(' ');
if (!line) continue;
var speciesid = POPokemon[line[0]];
if (!LearnsetsG6[speciesid]) LearnsetsG6[speciesid] = {};
LearnsetsG6[speciesid].level = line.slice(1).map(function(k){return POMoves[k]});
}
})();
console.log('read egg moves');
(function() {
var data = String(fs.readFileSync('db/pokes/6G/egg_moves.txt')).split('\n');
for (var i=0; i<data.length; i++) {
var line = data[i].split(' ');
if (!line) continue;
var speciesid = POPokemon[line[0]];
if (!LearnsetsG6[speciesid]) LearnsetsG6[speciesid] = {};
LearnsetsG6[speciesid].egg = line.slice(1).map(function(k){return POMoves[k]});
}
})();
console.log('read tm moves');
(function() {
var data = String(fs.readFileSync('db/pokes/6G/tm_and_hm_moves.txt')).split('\n');
for (var i=0; i<data.length; i++) {
var line = data[i].split(' ');
if (!line) continue;
var speciesid = POPokemon[line[0]];
if (!LearnsetsG6[speciesid]) LearnsetsG6[speciesid] = {};
LearnsetsG6[speciesid].tm = line.slice(1).map(function(k){return POMoves[k]});
}
})();
fs.writeFileSync('learnsets-g6.js', "module.exports = "+JSON.stringify(LearnsetsG6)+";\n");