diff --git a/.gitignore b/.gitignore index 3763473..c9937f5 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ logs/ cfg.js .save npm-debug.* +.idea \ No newline at end of file diff --git a/cfg.js.example b/cfg.js.example index 9022b4e..98dbe0f 100644 --- a/cfg.js.example +++ b/cfg.js.example @@ -36,6 +36,13 @@ export default { DEBUG_DUMP_TRAFFIC: true, DEBUG_LOG_REQUESTS: true, + //Populate map with Pokemon + RANDOM_SPAWNS_AT_PLAYERS: true, + RADIUS: 2, //In kilometers + RARITY_RATE: 1.5, //The higher, the less likely rare Pokemon will appear + NUMBER_SPAWNs: 500, + POKEMON_PER_SPAWN: 1, + // Choose a database type DATABASE_TYPE: "MYSQL", diff --git a/package.json b/package.json index bc47872..9a60179 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,9 @@ "node-pogo-protos": "^1.4.0", "pcrypt": "git+https://github.com/laverdet/pcrypt.git", "pogo-asset-downloader": "^0.3.1", - "pokerare": "^0.1.1", + "pogo-populate": "^0.0.8", "pokemongo-protobuf": "^1.11.0", + "pokerare": "^0.1.1", "prompt": "^1.0.0", "s2-geometry": "^1.2.9", "url": "^0.11.0" diff --git a/src/commands.js b/src/commands.js index cde59bb..5e3be8d 100644 --- a/src/commands.js +++ b/src/commands.js @@ -1,9 +1,19 @@ import print from "./print"; import CFG from "../cfg"; +import Populate from "pogo-populate"; +let populate = new Populate(CFG); export function saveAllPlayers() { + + if (this.world.players.length > 0) { for (let player of this.world.players) { + CFG.RANDOM_SPAWNS_AT_PLAYERS && populate.createRandomPokemon(player.latitude, player.longitude).then((res, rej)=>{ + if(rej){print(rej, 31)} + else { + print(`(${player.username})` + res, 33) + } + }) this.savePlayer(player); }; }