diff --git a/package.json b/package.json index 0d0182d..0c65cb5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "POGOServer", - "version": "0.4.0", + "version": "0.4.2", "description": "", "repository": { "type": "git", @@ -33,7 +33,7 @@ "directory-tree": "^1.1.0", "nodegit": "^0.14.1", "fs-extra": "^0.30.0", - "pokemongo-protobuf": "^1.10.0", + "pokemongo-protobuf": "git+https://github.com/maierfelix/pokemon-go-protobuf-node.git", "pcrypt": "git+https://github.com/laverdet/pcrypt.git" }, "devDependencies": {} diff --git a/src/db/get.js b/src/db/get.js index bd84334..9512574 100644 --- a/src/db/get.js +++ b/src/db/get.js @@ -7,9 +7,9 @@ import CFG from "../../cfg"; */ export function getQueryByColumnFromTable(column, value, table) { return new Promise((resolve) => { - this.db.instance.query(`SELECT * FROM ${table} WHERE ${column}=? LIMIT 1`, [value], (e, rows) => { + this.db.instance.query(`SELECT * FROM ${table} WHERE ${column}=?`, [value], (e, rows) => { if (e) console.log(e); - if (rows && rows.length) resolve(rows[0]); + if (rows && rows.length) resolve(rows); else resolve(void 0); }); }); diff --git a/src/db/index.js b/src/db/index.js index 217132b..48fbd5b 100644 --- a/src/db/index.js +++ b/src/db/index.js @@ -59,6 +59,20 @@ export function createUser(obj) { } +/** + * @param {Object} obj + */ +export function createOwnedPokemon(obj) { + + let query = this.getOwnedPkmnQuery("INSERT INTO", ""); + let data = this.getOwnedPkmnQueryData(obj); + + return new Promise((resolve) => { + this.db.instance.query(query, data, resolve); + }); + +} + /** * @param {Object} obj */ @@ -71,4 +85,18 @@ export function updateUser(obj) { this.db.instance.query(query, data, resolve); }); +} + +/** + * @param {Object} obj + */ +export function updateUserItems(obj) { + + let query = this.getUserItemQuery("UPDATE", "WHERE email=? LIMIT 1"); + let data = this.getUserItemQueryData(obj); + + return new Promise((resolve) => { + this.db.instance.query(query, data, resolve); + }); + } \ No newline at end of file diff --git a/src/db/query.js b/src/db/query.js index 1df5f98..336552a 100644 --- a/src/db/query.js +++ b/src/db/query.js @@ -10,6 +10,7 @@ export function getUserQuery(cmd, after) { username=?, email=?, exp=?, + level=?, stardust=?, pokecoins=?, team=?, @@ -31,61 +32,16 @@ export function getUserQuery(cmd, after) { `); } -export function getUserItemQuery(cmd, after) { - return (` - ${cmd} ${CFG.MYSQL_USERS_TABLE} - SET - item_poke_ball=?, - item_great_ball=?, - item_ultra_ball=?, - item_master_ball=?, - item_potion=?, - item_super_potion=?, - item_hyper_potion=?, - item_max_potion=?, - item_revive=?, - item_max_revive=?, - item_lucky_egg=?, - item_incense_ordinary=?, - item_incense_spicy=?, - item_incense_cool=?, - item_incense_floral=?, - item_troy_disk=?, - item_razz_berry=?, - item_bluk_berry=?, - item_nanab_berry=?, - item_wepar_berry=?, - item_pinap_berry=?, - item_incubator_basic=?, - item_incubator_basic_unlimited=?, - item_pokemon_storage_upgrade=?, - item_item_storage_upgrade=? - ${after} - `); -} - -/** - * @param {Object} obj - * @return {Array} - */ -export function getUserItemQueryData(obj) { - - console.log(obj); - - return ([]); - -} - /** * @param {Object} obj * @return {Array} */ export function getUserQueryData(obj) { - return ([ obj.username, obj.email, obj.exp, + obj.level, obj.stardust, obj.pokecoins, obj.team, @@ -106,8 +62,166 @@ export function getUserQueryData(obj) { obj.eyes, obj.gender, obj.backpack, - // where + // WHERE obj.email ]); +} + +/** + * @return {String} + */ +export function getOwnedPkmnQuery(cmd, after) { + return (` + ${cmd} ${CFG.MYSQL_OWNED_PKMN_TABLE} + SET + owner_id=?, + pokemon_id=?, + cp=?, + stamina=?, + stamina_max=?, + move_1=?, + move_2=?, + deployed_fort_id=?, + is_egg=?, + egg_km_walked_target=?, + egg_km_walked_start=?, + origin=?, + height_m=?, + weight_kg=?, + individual_attack=?, + individual_defense=?, + individual_stamina=?, + cp_multiplier=?, + pokeball=?, + captured_cell_id=?, + battles_attacked=?, + battles_defended=?, + egg_incubator_id=?, + creation_time_ms=?, + num_upgrades=?, + additional_cp_multiplier=?, + favorite=?, + nickname=?, + from_fort=? + ${after} + `); +} + +/** + * @param {Object} obj + * @return {Array} + */ +export function getOwnedPkmnQueryData(obj) { + return ([ + obj.owner_id, + obj.pokemon_id, + obj.cp, + obj.stamina, + obj.stamina_max, + obj.move_1, + obj.move_2, + obj.deployed_fort_id || "", + obj.is_egg || 0, + obj.egg_km_walked_target || 0, + obj.egg_km_walked_start || 0, + obj.origin || 0, + obj.height_m, + obj.weight_kg, + obj.individual_attack, + obj.individual_defense, + obj.individual_stamina, + obj.cp_multiplier, + obj.pokeball, + obj.captured_cell_id || 0, + obj.battles_attacked || 0, + obj.battles_defended || 0, + obj.egg_incubator_id || "", + obj.creation_time_ms, + obj.num_upgrades || 0, + obj.additional_cp_multiplier || 0, + obj.favorite || 0, + obj.nickname || "", + obj.from_fort || 0 + ]); +} + +export function getUserItemQuery(cmd, after) { + return (` + ${cmd} ${CFG.MYSQL_USERS_TABLE} + SET + item_poke_ball=?, + item_great_ball=?, + item_ultra_ball=?, + item_master_ball=?, + item_potion=?, + item_super_potion=?, + item_hyper_potion=?, + item_max_potion=?, + item_revive=?, + item_max_revive=?, + item_lucky_egg=?, + item_incense_ordinary=?, + item_incense_spicy=?, + item_incense_cool=?, + item_incense_floral=?, + item_troy_disk=?, + item_razz_berry=?, + item_bluk_berry=?, + item_nanab_berry=?, + item_wepar_berry=?, + item_pinap_berry=?, + item_incubator_basic=?, + item_incubator_basic_unlimited=?, + item_pokemon_storage_upgrade=?, + item_storage_upgrade=? + ${after} + `); +} + +/** + * @param {Object} obj + * @return {Array} + */ +export function getUserItemQueryData(obj) { + + let items = []; + + for (let key in obj.items) { + items.push(obj.items[key]); + }; + + let email = obj.email; + + obj = obj.items; + + return ([ + obj.poke_ball, + obj.great_ball, + obj.ultra_ball, + obj.master_ball, + obj.potion, + obj.super_potion, + obj.hyper_potion, + obj.max_potion, + obj.revive, + obj.max_revive, + obj.lucky_egg, + obj.incense_ordinary, + obj.incense_spicy, + obj.incense_cool, + obj.incense_floral, + obj.troy_disk, + obj.razz_berry, + obj.bluk_berry, + obj.nanab_berry, + obj.wepar_berry, + obj.pinap_berry, + obj.incubator_basic, + obj.incubator_basic_unlimited, + obj.pokemon_storage_upgrade, + obj.storage_upgrade, + // WHERE + email + ]); } \ No newline at end of file diff --git a/src/db/tables/candy.table b/src/db/tables/candy.table new file mode 100644 index 0000000..ece6f75 --- /dev/null +++ b/src/db/tables/candy.table @@ -0,0 +1,8 @@ +id int(15) NOT NULL AUTO_INCREMENT, +fort_id varchar(42) NOT NULL, +latitude double NOT NULL, +longitude double NOT NULL, +enabled tinyint(1) NOT NULL, +items_awarded varchar(42) NOT NULL, +experience_awarded int(10) NOT NULL +PRIMARY KEY (id) \ No newline at end of file diff --git a/src/db/tables/forts.table b/src/db/tables/forts.table new file mode 100644 index 0000000..ece6f75 --- /dev/null +++ b/src/db/tables/forts.table @@ -0,0 +1,8 @@ +id int(15) NOT NULL AUTO_INCREMENT, +fort_id varchar(42) NOT NULL, +latitude double NOT NULL, +longitude double NOT NULL, +enabled tinyint(1) NOT NULL, +items_awarded varchar(42) NOT NULL, +experience_awarded int(10) NOT NULL +PRIMARY KEY (id) \ No newline at end of file diff --git a/src/db/tables/users.table b/src/db/tables/users.table index d787437..639d48a 100644 --- a/src/db/tables/users.table +++ b/src/db/tables/users.table @@ -1,47 +1,48 @@ -id int(11) NOT NULL AUTO_INCREMENT, -username longtext NOT NULL, -email longtext NOT NULL, -exp int(255) NOT NULL, -stardust int(255) NOT NULL, -pokecoins int(255) NOT NULL, -team int(11) NOT NULL, -latitude double NOT NULL, -longitude double NOT NULL, -altitude int(255) NOT NULL, -send_marketing_emails tinyint(1) NOT NULL, -send_push_notifications tinyint(1) NOT NULL, -skin int(11) NOT NULL, -hair int(11) NOT NULL, -shirt int(11) NOT NULL, -pants int(11) NOT NULL, -hat int(11) NOT NULL, -shoes int(11) NOT NULL, -eyes int(11) NOT NULL, -gender int(11) NOT NULL, -backpack int(11) NOT NULL, -item_poke_ball int(11) NOT NULL, -item_great_ball int(11) NOT NULL, -item_ultra_ball int(11) NOT NULL, -item_master_ball int(11) NOT NULL, -item_potion int(11) NOT NULL, -item_super_potion int(11) NOT NULL, -item_hyper_potion int(11) NOT NULL, -item_max_potion int(11) NOT NULL, -item_revive int(11) NOT NULL, -item_max_revive int(11) NOT NULL, -item_lucky_egg int(11) NOT NULL, -item_incense_ordinary int(11) NOT NULL, -item_incense_spicy int(11) NOT NULL, -item_incense_cool int(11) NOT NULL, -item_incense_floral int(11) NOT NULL, -item_troy_disk int(11) NOT NULL, -item_razz_berry int(11) NOT NULL, -item_bluk_berry int(11) NOT NULL, -item_nanab_berry int(11) NOT NULL, -item_wepar_berry int(11) NOT NULL, -item_pinap_berry int(11) NOT NULL, -item_incubator_basic int(11) NOT NULL, -item_incubator_basic_unlimited int(11) NOT NULL, -item_pokemon_storage_upgrade int(11) NOT NULL, -item_item_storage_upgrade int(11) NOT NULL, +`id` int(11) NOT NULL, +`username` longtext NOT NULL, +`email` longtext NOT NULL, +`exp` int(255) NOT NULL, +`level` int(11) NOT NULL, +`stardust` int(255) NOT NULL, +`pokecoins` int(255) NOT NULL, +`team` int(11) NOT NULL, +`latitude` double NOT NULL, +`longitude` double NOT NULL, +`altitude` int(255) NOT NULL, +`send_marketing_emails` tinyint(1) NOT NULL, +`send_push_notifications` tinyint(1) NOT NULL, +`skin` int(11) NOT NULL, +`hair` int(11) NOT NULL, +`shirt` int(11) NOT NULL, +`pants` int(11) NOT NULL, +`hat` int(11) NOT NULL, +`shoes` int(11) NOT NULL, +`eyes` int(11) NOT NULL, +`gender` int(11) NOT NULL, +`backpack` int(11) NOT NULL, +`item_poke_ball` int(11) NOT NULL, +`item_great_ball` int(11) NOT NULL, +`item_ultra_ball` int(11) NOT NULL, +`item_master_ball` int(11) NOT NULL, +`item_potion` int(11) NOT NULL, +`item_super_potion` int(11) NOT NULL, +`item_hyper_potion` int(11) NOT NULL, +`item_max_potion` int(11) NOT NULL, +`item_revive` int(11) NOT NULL, +`item_max_revive` int(11) NOT NULL, +`item_lucky_egg` int(11) NOT NULL, +`item_incense_ordinary` int(11) NOT NULL, +`item_incense_spicy` int(11) NOT NULL, +`item_incense_cool` int(11) NOT NULL, +`item_incense_floral` int(11) NOT NULL, +`item_troy_disk` int(11) NOT NULL, +`item_razz_berry` int(11) NOT NULL, +`item_bluk_berry` int(11) NOT NULL, +`item_nanab_berry` int(11) NOT NULL, +`item_wepar_berry` int(11) NOT NULL, +`item_pinap_berry` int(11) NOT NULL, +`item_incubator_basic` int(11) NOT NULL, +`item_incubator_basic_unlimited` int(11) NOT NULL, +`item_pokemon_storage_upgrade` int(11) NOT NULL, +`item_storage_upgrade` int(11) NOT NULL, PRIMARY KEY (id) \ No newline at end of file diff --git a/src/index.js b/src/index.js index d83b781..6c215cc 100644 --- a/src/index.js +++ b/src/index.js @@ -59,6 +59,7 @@ class GameServer { this.passedTicks = 0; this.clients = []; + this.wild_pokemons = []; this.greet(); diff --git a/src/modes/global_settings.json b/src/modes/global_settings.json index e69de29..993e9dc 100644 --- a/src/modes/global_settings.json +++ b/src/modes/global_settings.json @@ -0,0 +1,28 @@ +{ + "fort_settings": { + "interaction_range_meters": 40, + "max_total_deployed_pokemon": 10, + "max_player_deployed_pokemon": 1, + "deploy_stamina_multiplier": 8, + "deploy_attack_multiplier": 0, + "far_interaction_range_meters": 1000 + }, + "map_settings": { + "pokemon_visible_range": 70, + "poke_nav_range_meters": 751, + "encounter_range_meters": 50, + "get_map_objects_min_refresh_seconds": 10, + "get_map_objects_max_refresh_seconds": 30, + "get_map_objects_min_distance_meters": 10 + }, + "inventory_settings": { + "max_pokemon": 1000, + "max_bag_items": 1000, + "base_pokemon": 250, + "base_bag_items": 350, + "base_eggs": 9 + }, + "pokemon_settings": { + + } +} \ No newline at end of file diff --git a/src/packets/Envelopes.AuthTicket.js b/src/packets/Envelopes.AuthTicket.js index bab1458..27b6732 100644 --- a/src/packets/Envelopes.AuthTicket.js +++ b/src/packets/Envelopes.AuthTicket.js @@ -1,6 +1,8 @@ import proto from "../proto"; import POGOProtos from "pokemongo-protobuf"; +import CFG from "../../cfg"; + /** * @return {Object} */ @@ -8,7 +10,7 @@ export default function AuthTicket() { let buffer = ({ start: new Buffer(""), - "expire_timestamp_ms": new Date.getTime(), + "expire_timestamp_ms": new Date().getTime() + CFG.PLAYER_CONNECTION_TIMEOUT, end: new Buffer("") }); diff --git a/src/packets/Responses.CatchPokemon.js b/src/packets/Responses.CatchPokemon.js new file mode 100644 index 0000000..5c5caab --- /dev/null +++ b/src/packets/Responses.CatchPokemon.js @@ -0,0 +1,52 @@ +import CFG from "../../cfg"; + +import POGOProtos from "pokemongo-protobuf"; + +/** + * @param {Request} req + * @return {Object} + */ +export default function CatchPokemon(encounter, player, req) { + + let obj = { + "owner_id": -1, + "encounter_id": encounter.encounter_id, + "spawn_point_id": "87bdcd88cb5", + "captured_cell_id": "9781199952939057152", + pokemon_id: encounter.pokemon_id, + cp: encounter.cp, + "move_1": "BUG_BITE_FAST", + "move_2": "STRUGGLE", + "stamina": 10, + "stamina_max": 10, + height_m: 0.30962005257606506, + weight_kg: 3.3212273120880127, + "pokeball": "ITEM_POKE_BALL", + "creation_time_ms": new Date().getTime(), + "cp_multiplier": 0.16639786958694458, + individual_attack: 7, + individual_defense: 13, + individual_stamina: 3 + }; + + if (!req.hit_pokemon) { + return ({ + status: 'CATCH_MISSED' + }); + } else { + return ({ + pkmn: obj, + buffer: { + status: 'CATCH_SUCCESS', + captured_pokemon_id: encounter.encounter_id, + capture_award: { + activity_type: ['ACTIVITY_CATCH_POKEMON'], + xp: [100], + candy: [3], + stardust: [100] + } + } + }); + } + +} \ No newline at end of file diff --git a/src/packets/Responses.CheckChallenge.js b/src/packets/Responses.CheckChallenge.js new file mode 100644 index 0000000..7aeecb0 --- /dev/null +++ b/src/packets/Responses.CheckChallenge.js @@ -0,0 +1,17 @@ +import CFG from "../../cfg"; + +import POGOProtos from "pokemongo-protobuf"; + +/** + * @param {Request} req + * @return {Object} + */ +export default function CheckChallenge(req) { + + let buffer = ({ + challenge_url: " " + }); + + return POGOProtos.serialize(buffer, "POGOProtos.Networking.Responses.CheckChallengeResponse"); + +} \ No newline at end of file diff --git a/src/packets/Responses.DownloadSettings.js b/src/packets/Responses.DownloadSettings.js index 44675a3..4f18c65 100644 --- a/src/packets/Responses.DownloadSettings.js +++ b/src/packets/Responses.DownloadSettings.js @@ -24,7 +24,7 @@ export default function DownloadSettings() { "poke_nav_range_meters": 751.0156862745098, "encounter_range_meters": 50.25098039215686, "get_map_objects_min_refresh_seconds": 10.007843017578125, - "get_map_objects_max_refresh_seconds": 30.01568603515625, + "get_map_objects_max_refresh_seconds": 11.01568603515625, "get_map_objects_min_distance_meters": 10.007843017578125, "google_maps_api_key": CFG.GMAPS_KEY }, diff --git a/src/packets/Responses.Encounter.js b/src/packets/Responses.Encounter.js index 01099e4..156199f 100644 --- a/src/packets/Responses.Encounter.js +++ b/src/packets/Responses.Encounter.js @@ -9,43 +9,35 @@ import { decodeLong } from "../utils"; * @param {Request} req * @return {Object} */ -export default function Encounter(req) { -console.log(req.encounter_id, req.player_latitude, req.player_longitude); +export default function Encounter(encounter, req) { + let buffer = ({ - "wild_pokemon": { - "encounter_id": req.encounter_id, - "last_modified_timestamp_ms": new Date().getTime(), - "latitude": req.player_latitude, - "longitude": req.player_longitude, - "spawn_point_id": "87bdcd8ec57", - "pokemon_data": { - "pokemon_id": "MEWTWO", - "cp": 164, - "stamina": 38, - "stamina_max": 38, - "move_1": "TACKLE_FAST", - "move_2": "BODY_SLAM", - "height_m": 0.36679142713546753, - "weight_kg": 9.639217376708984, - "individual_attack": 15, - "individual_defense": 1, - "individual_stamina": 9, - "cp_multiplier": 0.3210875988006592 + wild_pokemon: { + encounter_id: encounter.encounter_id, + last_modified_timestamp_ms: '1471852141657', + latitude: encounter.latitude, + longitude: encounter.longitude, + spawn_point_id: '87bdcd8f2e9', + pokemon_data: { + pokemon_id: encounter.pokemon_id, + cp: encounter.cp, + stamina: 10, + stamina_max: 10, + move_1: "BUG_BITE_FAST", + move_2: "STRUGGLE", + height_m: 0.30962005257606506, + weight_kg: 3.3212273120880127, + individual_attack: 7, + individual_defense: 13, + individual_stamina: 3, + cp_multiplier: 0.16639786958694458 }, - "time_till_hidden_ms": 857876 + time_till_hidden_ms: 860075 }, - "status": "ENCOUNTER_SUCCESS", - "capture_probability": { - "pokeball_type": [ - "ITEM_POKE_BALL", - "ITEM_GREAT_BALL", - "ITEM_ULTRA_BALL" - ], - "capture_probability": { - "0": 0.49830639362335205, - "1": 0.6446487903594971, - "2": 0.7483035326004028 - } + status: 'ENCOUNTER_SUCCESS', + capture_probability: { + pokeball_type: ['ITEM_POKE_BALL', 'ITEM_GREAT_BALL', 'ITEM_ULTRA_BALL'], + capture_probability: [1, 1, 1] } }); diff --git a/src/packets/Responses.FortDetails.js b/src/packets/Responses.FortDetails.js index 8c3e41d..0435f98 100644 --- a/src/packets/Responses.FortDetails.js +++ b/src/packets/Responses.FortDetails.js @@ -11,7 +11,7 @@ export default function FortDetails(req) { let buffer = ({ "fort_id": req.fort_id, - "name": "POGOserver v0.3.5", + "name": `POGOserver v${CFG.VERSION}`, "image_urls": [ "http://thecatapi.com/api/images/get?format=src&type=png" ], diff --git a/src/packets/Responses.FortSearch.js b/src/packets/Responses.FortSearch.js index 5865059..6b6a7ca 100644 --- a/src/packets/Responses.FortSearch.js +++ b/src/packets/Responses.FortSearch.js @@ -4,26 +4,34 @@ import proto from "../proto"; import POGOProtos from "pokemongo-protobuf"; /** - * @param {Object} obj - * @return {Object} + * @param {Player} player + * @return {Buffer} */ -export default function FortSearch(obj) { +export default function FortSearch(player) { let ii = 0; - let amount = 5; let items = []; + let name = "ultra_ball"; + let amount = 5; + let exp = 50; + while (++ii < amount) { items.push({ - "item_id": "ITEM_MASTER_BALL", + "item_id": "ITEM_" + name.toUpperCase(), "item_count": 1 - }) + }); }; + player.items[name] += amount; + player.exp += exp; + + console.log(player.items[name]); + let buffer = ({ "result": "SUCCESS", "items_awarded": items, - "experience_awarded": 50, + "experience_awarded": exp, "cooldown_complete_timestamp_ms": "1471780158665", "chain_hack_sequence_number": 2, "$unknownFields": [] diff --git a/src/packets/Responses.GetInventory.js b/src/packets/Responses.GetInventory.js index 9ec4f11..14cf414 100644 --- a/src/packets/Responses.GetInventory.js +++ b/src/packets/Responses.GetInventory.js @@ -4,1230 +4,107 @@ import POGOProtos from "pokemongo-protobuf"; let isFirst = false; /** - * @param {Object} obj + * @param {Object} data * @return {Object} */ -export default function GetInventoryData(obj) { +export default function GetInventoryData(player) { - let buffer = ({ - "success": true, - "inventory_delta": { - "new_timestamp_ms": new Date().getTime(), - "inventory_items": [ - { - "modified_timestamp_ms": "1471712450083", - "inventory_item_data": { - "pokemon_data": { - "id": "18084643178451338494", - "pokemon_id": "JIGGLYPUFF", - "cp": 132, - "stamina": 74, - "stamina_max": 74, - "move_1": "FEINT_ATTACK_FAST", - "move_2": "BODY_SLAM", - "height_m": 0.4980907142162323, - "weight_kg": 5.8239665031433105, - "individual_attack": 9, - "individual_defense": 8, - "individual_stamina": 1, - "cp_multiplier": 0.3210875988006592, - "pokeball": "ITEM_POKE_BALL", - "captured_cell_id": "9926768108050055168", - "creation_time_ms": "1471692765854" - } - } - }, - { - "inventory_item_data": { - "pokedex_entry": { - "pokemon_id": "FEAROW", - "times_encountered": 1, - "times_captured": 1 - } - } - }, - { - "inventory_item_data": { - "pokemon_data": { - "id": "15921933050191214559", - "pokemon_id": "RATTATA", - "cp": 37, - "stamina": 14, - "stamina_max": 14, - "move_1": "QUICK_ATTACK_FAST", - "move_2": "BODY_SLAM", - "height_m": 0.335340678691864, - "weight_kg": 3.9603395462036133, - "individual_attack": 15, - "individual_defense": 2, - "individual_stamina": 6, - "cp_multiplier": 0.21573247015476227, - "pokeball": "ITEM_POKE_BALL", - "captured_cell_id": "9926768108050055168", - "creation_time_ms": "1471689904105" - } - } - }, - { - "inventory_item_data": { - "candy": { - "family_id": "FAMILY_SLOWPOKE", - "candy": 3 - } - } - }, - { - "inventory_item_data": { - "pokedex_entry": { - "pokemon_id": "EKANS", - "times_encountered": 2, - "times_captured": 2 - } - } - }, - { - "inventory_item_data": { - "pokemon_data": { - "id": "10181525078482818464", - "is_egg": true, - "egg_km_walked_target": 5, - "captured_cell_id": "9926767136558022656", - "creation_time_ms": "1471691580646" - } - } - }, - { - "inventory_item_data": { - "item": { - "item_id": "ITEM_REVIVE", - "count": 20 - } - } - }, - { - "inventory_item_data": { - "pokemon_data": { - "id": "3728701318451962436", - "pokemon_id": "STARYU", - "cp": 13, - "stamina": 10, - "stamina_max": 10, - "move_1": "WATER_GUN_FAST", - "move_2": "BUBBLE_BEAM", - "height_m": 0.861968457698822, - "weight_kg": 41.78410720825195, - "individual_attack": 14, - "individual_defense": 15, - "individual_stamina": 15, - "cp_multiplier": 0.09399999678134918, - "pokeball": "ITEM_POKE_BALL", - "captured_cell_id": "9926768108050055168", - "creation_time_ms": "1471692483936" - } - } - }, - { - "inventory_item_data": { - "pokedex_entry": { - "pokemon_id": "NIDORAN_FEMALE", - "times_encountered": 2, - "times_captured": 2 - } - } - }, - { - "inventory_item_data": { - "pokemon_data": { - "id": "12449080423906283031", - "pokemon_id": "PIDGEOTTO", - "cp": 80, - "stamina": 28, - "stamina_max": 28, - "move_1": "WING_ATTACK_FAST", - "move_2": "TWISTER", - "height_m": 1.24424409866333, - "weight_kg": 38.75220489501953, - "individual_attack": 10, - "individual_defense": 3, - "individual_stamina": 5, - "cp_multiplier": 0.21573247015476227, - "pokeball": "ITEM_POKE_BALL", - "captured_cell_id": "9926768108050055168", - "creation_time_ms": "1471691535997" - } - } - }, - { - "inventory_item_data": { - "pokedex_entry": { - "pokemon_id": "NIDORINO", - "times_encountered": 1, - "times_captured": 1 - } - } - }, - { - "inventory_item_data": { - "pokedex_entry": { - "pokemon_id": "CLEFAIRY", - "times_encountered": 2, - "times_captured": 2 - } - } - }, - { - "inventory_item_data": { - "candy": { - "family_id": "FAMILY_MAGIKARP", - "candy": 19 - } - } - }, - { - "inventory_item_data": { - "pokedex_entry": { - "pokemon_id": "JIGGLYPUFF", - "times_encountered": 1, - "times_captured": 1 - } - } - }, - { - "inventory_item_data": { - "pokemon_data": { - "id": "14072353163410837297", - "pokemon_id": "MAGIKARP", - "cp": 26, - "stamina": 13, - "stamina_max": 13, - "move_1": "SPLASH_FAST", - "move_2": "STRUGGLE", - "height_m": 0.797365128993988, - "weight_kg": 7.1520256996154785, - "individual_attack": 13, - "individual_defense": 13, - "individual_stamina": 14, - "cp_multiplier": 0.2557200491428375, - "pokeball": "ITEM_POKE_BALL", - "captured_cell_id": "9926593976904712192", - "creation_time_ms": "1471695195481", - "from_fort": 1 - } - } - }, - { - "inventory_item_data": { - "pokedex_entry": { - "pokemon_id": "ZUBAT", - "times_encountered": 8, - "times_captured": 8 - } - } - }, - { - "inventory_item_data": { - "item": { - "item_id": "ITEM_RAZZ_BERRY", - "count": 21 - } - } - }, - { - "inventory_item_data": { - "candy": { - "family_id": "FAMILY_KRABBY", - "candy": 7 - } - } - }, - { - "inventory_item_data": { - "pokedex_entry": { - "pokemon_id": "GOLBAT", - "times_encountered": 2, - "times_captured": 2 - } - } - }, - { - "modified_timestamp_ms": "1471712450083", - "inventory_item_data": { - "pokemon_data": { - "id": "9506392224876742817", - "pokemon_id": "FEAROW", - "cp": 311, - "stamina": 22, - "stamina_max": 49, - "move_1": "STEEL_WING_FAST", - "move_2": "TWISTER", - "height_m": 1.0706182718276978, - "weight_kg": 35.038177490234375, - "individual_attack": 4, - "individual_defense": 10, - "individual_stamina": 11, - "cp_multiplier": 0.3492126762866974, - "pokeball": "ITEM_POKE_BALL", - "captured_cell_id": "9926768108050055168", - "creation_time_ms": "1471693184039" - } - } - }, - { - "inventory_item_data": { - "pokedex_entry": { - "pokemon_id": "PARAS", - "times_encountered": 3, - "times_captured": 3 - } - } - }, - { - "inventory_item_data": { - "candy": { - "family_id": "FAMILY_CUBONE", - "candy": 3 - } - } - }, - { - "inventory_item_data": { - "pokedex_entry": { - "pokemon_id": "VENONAT", - "times_encountered": 1 - } - } - }, - { - "modified_timestamp_ms": "1471712450083", - "inventory_item_data": { - "pokemon_data": { - "id": "18365393771243280355", - "pokemon_id": "NIDORINO", - "cp": 170, - "stamina": 38, - "stamina_max": 38, - "move_1": "POISON_STING_FAST", - "move_2": "HORN_ATTACK", - "height_m": 0.8500931262969971, - "weight_kg": 15.523972511291504, - "individual_attack": 11, - "individual_defense": 4, - "individual_stamina": 11, - "cp_multiplier": 0.29024988412857056, - "pokeball": "ITEM_POKE_BALL", - "captured_cell_id": "9926768108050055168", - "creation_time_ms": "1471693450255" - } - } - }, - { - "inventory_item_data": { - "pokemon_data": { - "id": "17518952308967699010", - "pokemon_id": "GROWLITHE", - "cp": 128, - "stamina": 28, - "stamina_max": 28, - "move_1": "BITE_FAST", - "move_2": "FLAMETHROWER", - "height_m": 0.7787603735923767, - "weight_kg": 28.37158966064453, - "individual_attack": 12, - "individual_defense": 14, - "individual_stamina": 1, - "cp_multiplier": 0.2557200491428375, - "pokeball": "ITEM_POKE_BALL", - "captured_cell_id": "9926594385212866560", - "creation_time_ms": "1471691371843" - } - } - }, - { - "inventory_item_data": { - "pokedex_entry": { - "pokemon_id": "GROWLITHE", - "times_encountered": 1, - "times_captured": 1 - } - } - }, - { - "inventory_item_data": { - "candy": { - "family_id": "FAMILY_HORSEA", - "candy": 11 - } - } - }, - { - "modified_timestamp_ms": "1471712450083", - "inventory_item_data": { - "pokemon_data": { - "id": "15271685633708968048", - "pokemon_id": "GOLBAT", - "cp": 191, - "stamina": 41, - "stamina_max": 41, - "move_1": "BITE_FAST", - "move_2": "AIR_CUTTER", - "height_m": 1.7463443279266357, - "weight_kg": 65.05073547363281, - "individual_attack": 11, - "individual_defense": 10, - "individual_stamina": 11, - "cp_multiplier": 0.2557200491428375, - "pokeball": "ITEM_POKE_BALL", - "captured_cell_id": "9926768108050055168", - "creation_time_ms": "1471692231329", - "from_fort": 1 - } - } - }, - { - "inventory_item_data": { - "candy": { - "family_id": "FAMILY_GOLDEEN", - "candy": 7 - } - } - }, - { - "inventory_item_data": { - "pokemon_data": { - "id": "796318518081224862", - "pokemon_id": "KRABBY", - "cp": 100, - "stamina": 21, - "stamina_max": 21, - "move_1": "MUD_SHOT_FAST", - "move_2": "VICE_GRIP", - "height_m": 0.26345697045326233, - "weight_kg": 2.924619197845459, - "individual_attack": 10, - "individual_defense": 14, - "individual_stamina": 13, - "cp_multiplier": 0.29024988412857056, - "pokeball": "ITEM_POKE_BALL", - "captured_cell_id": "9926768108050055168", - "creation_time_ms": "1471694904167" - } - } - }, - { - "inventory_item_data": { - "pokemon_data": { - "id": "12036095042499738126", - "pokemon_id": "NIDORAN_FEMALE", - "cp": 103, - "stamina": 36, - "stamina_max": 36, - "move_1": "POISON_STING_FAST", - "move_2": "POISON_FANG", - "height_m": 0.3868274390697479, - "weight_kg": 8.206711769104004, - "individual_attack": 2, - "individual_defense": 13, - "individual_stamina": 15, - "cp_multiplier": 0.29024988412857056, - "pokeball": "ITEM_POKE_BALL", - "captured_cell_id": "9926768108050055168", - "creation_time_ms": "1471691674295" - } - } - }, - { - "inventory_item_data": { - "candy": { - "family_id": "FAMILY_STARYU", - "candy": 7 - } - } - }, - { - "inventory_item_data": { - "pokemon_data": { - "id": "10747118668044541405", - "pokemon_id": "WEEDLE", - "cp": 29, - "stamina": 17, - "stamina_max": 17, - "move_1": "POISON_STING_FAST", - "move_2": "STRUGGLE", - "height_m": 0.3058975636959076, - "weight_kg": 3.337272882461548, - "individual_attack": 14, - "individual_defense": 12, - "individual_stamina": 1, - "cp_multiplier": 0.21573247015476227, - "pokeball": "ITEM_POKE_BALL", - "captured_cell_id": "9926768108050055168", - "creation_time_ms": "1471693994993" - } - } - }, - { - "inventory_item_data": { - "candy": { - "family_id": "FAMILY_PINSIR", - "candy": 3 - } - } - }, - { - "inventory_item_data": { - "candy": { - "family_id": "FAMILY_CHARMANDER", - "candy": 3 - } - } - }, - { - "inventory_item_data": { - "pokedex_entry": { - "pokemon_id": "SLOWPOKE", - "times_encountered": 1, - "times_captured": 1 - } - } - }, - { - "modified_timestamp_ms": "1471712450083", - "inventory_item_data": { - "pokemon_data": { - "id": "9152935995874346712", - "pokemon_id": "SLOWPOKE", - "cp": 191, - "stamina": 59, - "stamina_max": 59, - "move_1": "WATER_GUN_FAST", - "move_2": "WATER_PULSE", - "height_m": 1.570439338684082, - "weight_kg": 60.640960693359375, - "individual_attack": 14, - "individual_defense": 11, - "individual_stamina": 5, - "cp_multiplier": 0.3210875988006592, - "pokeball": "ITEM_POKE_BALL", - "captured_cell_id": "9926768108050055168", - "creation_time_ms": "1471692254852" - } - } - }, - { - "inventory_item_data": { - "egg_incubators": { - "egg_incubator": [ - { - "id": "EggIncubatorProto-1762299759591784113", - "item_id": "ITEM_INCUBATOR_BASIC_UNLIMITED", - "incubator_type": "INCUBATOR_DISTANCE" - }, - { - "id": "EggIncubatorProto-2555040734197054659", - "item_id": "ITEM_INCUBATOR_BASIC", - "incubator_type": "INCUBATOR_DISTANCE", - "uses_remaining": 3, - "pokemon_id": "11744424908786525656", - "start_km_walked": 2.1090078353881836, - "target_km_walked": 12.109007835388184 - } - ] - } - } - }, - { - "inventory_item_data": { - "candy": { - "family_id": "FAMILY_CATERPIE", - "candy": 19 - } - } - }, - { - "inventory_item_data": { - "item": { - "item_id": "ITEM_INCENSE_ORDINARY", - "count": 4 - } - } - }, - { - "inventory_item_data": { - "candy": { - "family_id": "FAMILY_WEEDLE", - "candy": 19 - } - } - }, - { - "inventory_item_data": { - "pokemon_data": { - "id": "6139375183589489982", - "pokemon_id": "GOLDEEN", - "cp": 68, - "stamina": 21, - "stamina_max": 21, - "move_1": "MUD_SHOT_FAST", - "move_2": "HORN_ATTACK", - "height_m": 0.6158193349838257, - "weight_kg": 17.450626373291016, - "individual_attack": 14, - "individual_defense": 15, - "individual_stamina": 8, - "cp_multiplier": 0.21573247015476227, - "pokeball": "ITEM_POKE_BALL", - "captured_cell_id": "9926768108050055168", - "creation_time_ms": "1471691494377" - } - } - }, - { - "inventory_item_data": { - "candy": { - "family_id": "FAMILY_PIDGEY", - "candy": 50 - } - } - }, - { - "inventory_item_data": { - "candy": { - "family_id": "FAMILY_RATTATA", - "candy": 27 - } - } - }, - { - "inventory_item_data": { - "pokemon_data": { - "id": "15065989923603533398", - "is_egg": true, - "egg_km_walked_target": 2, - "captured_cell_id": "9926593978110574592", - "creation_time_ms": "1471690777343" - } - } - }, - { - "inventory_item_data": { - "candy": { - "family_id": "FAMILY_SPEAROW", - "candy": 10 - } - } - }, - { - "modified_timestamp_ms": "1471712450083", - "inventory_item_data": { - "pokemon_data": { - "id": "9068626531358460046", - "pokemon_id": "CLEFAIRY", - "cp": 150, - "stamina": 42, - "stamina_max": 42, - "move_1": "ZEN_HEADBUTT_FAST", - "move_2": "BODY_SLAM", - "height_m": 0.6027987003326416, - "weight_kg": 7.181642532348633, - "individual_attack": 14, - "individual_defense": 5, - "individual_stamina": 6, - "cp_multiplier": 0.29024988412857056, - "pokeball": "ITEM_POKE_BALL", - "captured_cell_id": "9926768108050055168", - "creation_time_ms": "1471693717977" - } - } - }, - { - "inventory_item_data": { - "candy": { - "family_id": "FAMILY_EKANS", - "candy": 7 - } - } - }, - { - "inventory_item_data": { - "pokemon_data": { - "id": "5410754902696943229", - "is_egg": true, - "egg_km_walked_target": 5, - "captured_cell_id": "9926767137919074304", - "creation_time_ms": "1471689786531" - } - } - }, - { - "inventory_item_data": { - "pokedex_entry": { - "pokemon_id": "KRABBY", - "times_encountered": 2, - "times_captured": 2 - } - } - }, - { - "inventory_item_data": { - "pokemon_data": { - "id": "14667551044177722023", - "is_egg": true, - "egg_km_walked_target": 2, - "captured_cell_id": "9926767136790806528", - "creation_time_ms": "1471691542366" - } - } - }, - { - "inventory_item_data": { - "pokemon_data": { - "id": "130876558588413914", - "is_egg": true, - "egg_km_walked_target": 5, - "captured_cell_id": "9926767137394786304", - "creation_time_ms": "1471691424962" - } - } - }, - { - "inventory_item_data": { - "item": { - "item_id": "ITEM_INCUBATOR_BASIC_UNLIMITED", - "count": 1, - "unseen": true - } - } - }, - { - "inventory_item_data": { - "candy": { - "family_id": "FAMILY_NIDORAN_FEMALE", - "candy": 7 - } - } - }, - { - "modified_timestamp_ms": "1471779833610", - "inventory_item_data": { - "pokedex_entry": { - "pokemon_id": "EEVEE", - "times_encountered": 2 - } - } - }, - { - "inventory_item_data": { - "candy": { - "family_id": "FAMILY_NIDORAN_MALE", - "candy": 3 - } - } - }, - { - "inventory_item_data": { - "pokedex_entry": { - "pokemon_id": "CUBONE", - "times_encountered": 1, - "times_captured": 1 - } - } - }, - { - "inventory_item_data": { - "pokedex_entry": { - "pokemon_id": "MAGIKARP", - "times_encountered": 4, - "times_captured": 4 - } - } - }, - { - "inventory_item_data": { - "candy": { - "family_id": "FAMILY_CLEFAIRY", - "candy": 7 - } - } - }, - { - "modified_timestamp_ms": "1471779858667", - "inventory_item_data": { - "item": { - "item_id": "ITEM_POTION", - "count": 11 - } - } - }, - { - "inventory_item_data": { - "pokemon_data": { - "id": "1568499254512618339", - "pokemon_id": "PARAS", - "cp": 39, - "stamina": 13, - "stamina_max": 13, - "move_1": "SCRATCH_FAST", - "move_2": "X_SCISSOR", - "height_m": 0.2907119691371918, - "weight_kg": 5.8927106857299805, - "individual_attack": 15, - "individual_defense": 13, - "individual_stamina": 12, - "cp_multiplier": 0.16639786958694458, - "pokeball": "ITEM_POKE_BALL", - "captured_cell_id": "9926594385212866560", - "creation_time_ms": "1471689715056" - } - } - }, - { - "inventory_item_data": { - "pokemon_data": { - "id": "4260700134915739389", - "pokemon_id": "EKANS", - "cp": 96, - "stamina": 21, - "stamina_max": 21, - "move_1": "ACID_FAST", - "move_2": "SLUDGE_BOMB", - "height_m": 1.5886131525039673, - "weight_kg": 3.6353814601898193, - "individual_attack": 12, - "individual_defense": 6, - "individual_stamina": 3, - "cp_multiplier": 0.29024988412857056, - "pokeball": "ITEM_POKE_BALL", - "captured_cell_id": "9926768108050055168", - "creation_time_ms": "1471692372606" - } - } - }, - { - "inventory_item_data": { - "pokemon_data": { - "id": "10573494102072008253", - "pokemon_id": "PIDGEY", - "cp": 10, - "stamina": 10, - "stamina_max": 10, - "move_1": "TACKLE_FAST", - "move_2": "AERIAL_ACE", - "height_m": 0.27786242961883545, - "weight_kg": 1.1178309917449951, - "individual_attack": 15, - "individual_defense": 10, - "individual_stamina": 4, - "cp_multiplier": 0.09399999678134918, - "pokeball": "ITEM_POKE_BALL", - "captured_cell_id": "9926768108050055168", - "creation_time_ms": "1471689794773" - } - } - }, - { - "inventory_item_data": { - "candy": { - "family_id": "FAMILY_JIGGLYPUFF", - "candy": 3 - } - } - }, - { - "inventory_item_data": { - "item": { - "item_id": "ITEM_TROY_DISK", - "count": 1, - "unseen": true - } - } - }, - { - "inventory_item_data": { - "candy": { - "family_id": "FAMILY_ZUBAT", - "candy": 38 - } - } - }, - { - "modified_timestamp_ms": "1471712379214", - "inventory_item_data": { - "pokemon_data": { - "id": "12039497356603358386", - "pokemon_id": "CUBONE", - "cp": 68, - "stamina": 1, - "stamina_max": 22, - "move_1": "MUD_SLAP_FAST", - "move_2": "BONE_CLUB", - "height_m": 0.4713166356086731, - "weight_kg": 7.497816562652588, - "individual_attack": 14, - "individual_defense": 5, - "individual_stamina": 3, - "cp_multiplier": 0.21573247015476227, - "pokeball": "ITEM_POKE_BALL", - "captured_cell_id": "9926768108050055168", - "creation_time_ms": "1471694222080" - } - } - }, - { - "inventory_item_data": { - "pokemon_data": { - "id": "4337346407444660281", - "is_egg": true, - "egg_km_walked_target": 10, - "captured_cell_id": "9926767133913513984", - "creation_time_ms": "1471695633095" - } - } - }, - { - "inventory_item_data": { - "pokedex_entry": { - "pokemon_id": "HORSEA", - "times_encountered": 3, - "times_captured": 3 - } - } - }, - { - "inventory_item_data": { - "candy": { - "family_id": "FAMILY_PARAS", - "candy": 11 - } - } - }, - { - "inventory_item_data": { - "pokedex_entry": { - "pokemon_id": "GOLDEEN", - "times_encountered": 2, - "times_captured": 2 - } - } - }, - { - "inventory_item_data": { - "pokemon_data": { - "id": "17588702568986129255", - "pokemon_id": "HORSEA", - "cp": 102, - "stamina": 21, - "stamina_max": 21, - "move_1": "BUBBLE_FAST", - "move_2": "FLASH_CANNON", - "height_m": 0.38454344868659973, - "weight_kg": 8.013751029968262, - "individual_attack": 15, - "individual_defense": 9, - "individual_stamina": 13, - "cp_multiplier": 0.29024988412857056, - "pokeball": "ITEM_POKE_BALL", - "captured_cell_id": "9926768108050055168", - "creation_time_ms": "1471694597662" - } - } - }, - { - "inventory_item_data": { - "pokemon_data": { - "id": "20428484146157110", - "pokemon_id": "SPEAROW", - "cp": 27, - "stamina": 15, - "stamina_max": 15, - "move_1": "PECK_FAST", - "move_2": "DRILL_PECK", - "height_m": 0.29344871640205383, - "weight_kg": 1.9293220043182373, - "individual_attack": 10, - "individual_defense": 5, - "individual_stamina": 13, - "cp_multiplier": 0.16639786958694458, - "pokeball": "ITEM_POKE_BALL", - "captured_cell_id": "9926594385212866560", - "creation_time_ms": "1471690326729" - } - } - }, - { - "inventory_item_data": { - "pokemon_data": { - "id": "9844476046022103294", - "pokemon_id": "CHARMANDER", - "cp": 12, - "stamina": 10, - "stamina_max": 10, - "move_1": "SCRATCH_FAST", - "move_2": "FLAMETHROWER", - "height_m": 0.7560690641403198, - "weight_kg": 14.30856990814209, - "individual_attack": 10, - "individual_defense": 10, - "individual_stamina": 10, - "cp_multiplier": 0.09399999678134918, - "captured_cell_id": "10781478022840057856", - "creation_time_ms": "1471100247635" - } - } - }, - { - "inventory_item_data": { - "pokedex_entry": { - "pokemon_id": "STARYU", - "times_encountered": 2, - "times_captured": 2 - } - } - }, - { - "modified_timestamp_ms": "1471779858667", - "inventory_item_data": { - "player_stats": { - "level": 8, - "experience": "32875", - "prev_level_xp": "21000", - "next_level_xp": "36000", - "km_walked": 3.921541213989258, - "pokemons_encountered": 75, - "unique_pokedex_entries": 25, - "pokemons_captured": 71, - "poke_stop_visits": 123, - "pokeballs_thrown": 74, - "eggs_hatched": 1, - "big_magikarp_caught": 1, - "pokemon_deployed": 1, - "pokemon_caught_by_type": { - "type": "Buffer", - "data": [ - 0, - 24, - 0, - 26, - 20, - 1, - 0, - 14, - 0, - 0, - 1, - 14, - 3, - 0, - 1, - 0, - 0, - 0, - 3 - ] - } - } - } - }, - { - "inventory_item_data": { - "pokemon_data": { - "id": "11744424908786525656", - "is_egg": true, - "egg_km_walked_target": 10, - "captured_cell_id": "9926593973010300928", - "egg_incubator_id": "EggIncubatorProto-2555040734197054659", - "creation_time_ms": "1471690023913" - } - } - }, - { - "inventory_item_data": { - "pokemon_data": { - "id": "6969639762681983910", - "pokemon_id": "PINSIR", - "cp": 28, - "stamina": 13, - "stamina_max": 13, - "move_1": "FURY_CUTTER_FAST", - "move_2": "SUBMISSION", - "height_m": 1.304322361946106, - "weight_kg": 31.694673538208008, - "individual_attack": 13, - "individual_defense": 2, - "individual_stamina": 15, - "cp_multiplier": 0.09399999678134918, - "pokeball": "ITEM_POKE_BALL", - "captured_cell_id": "9926768108050055168", - "creation_time_ms": "1471695906137" - } - } - }, - { - "inventory_item_data": { - "pokedex_entry": { - "pokemon_id": "PINSIR", - "times_encountered": 1, - "times_captured": 1 - } - } - }, - { - "inventory_item_data": { - "candy": { - "family_id": "FAMILY_GROWLITHE", - "candy": 3 - } - } - }, - { - "inventory_item_data": { - "pokedex_entry": { - "pokemon_id": "CHARMANDER", - "times_encountered": 1, - "times_captured": 1 - } - } - }, - { - "inventory_item_data": { - "item": { - "item_id": "ITEM_INCUBATOR_BASIC", - "count": 1, - "unseen": true - } - } - }, - { - "modified_timestamp_ms": new Date().getTime(), - "inventory_item_data": { - "item": { - "item_id": "ITEM_POKE_BALL", - "count": 209 - } - } - }, - { - "inventory_item_data": { - "pokemon_data": { - "id": "5976745051113111367", - "pokemon_id": "CATERPIE", - "cp": 49, - "stamina": 26, - "stamina_max": 26, - "move_1": "BUG_BITE_FAST", - "move_2": "STRUGGLE", - "height_m": 0.24649560451507568, - "weight_kg": 1.6669996976852417, - "individual_attack": 11, - "individual_defense": 5, - "cp_multiplier": 0.29024988412857056, - "pokeball": "ITEM_POKE_BALL", - "captured_cell_id": "9926768108050055168", - "creation_time_ms": "1471691567691" - } - } - }, - { - "inventory_item_data": { - "pokedex_entry": { - "pokemon_id": "CATERPIE", - "times_encountered": 5, - "times_captured": 5 - } - } - }, - { - "inventory_item_data": { - "pokedex_entry": { - "pokemon_id": "WEEDLE", - "times_encountered": 5, - "times_captured": 5 - } - } - }, - { - "inventory_item_data": { - "pokemon_data": { - "id": "11858657374888779686", - "is_egg": true, - "egg_km_walked_target": 2, - "captured_cell_id": "9926593977120718848", - "creation_time_ms": "1471689730292" - } - } - }, - { - "inventory_item_data": { - "pokedex_entry": { - "pokemon_id": "PIDGEY", - "times_encountered": 13, - "times_captured": 12 - } - } - }, - { - "inventory_item_data": { - "pokedex_entry": { - "pokemon_id": "PIDGEOTTO", - "times_encountered": 1, - "times_captured": 1 - } - } - }, - { - "inventory_item_data": { - "pokemon_data": { - "id": "17367836743335105913", - "is_egg": true, - "egg_km_walked_target": 5, - "captured_cell_id": "9926593976665636864", - "creation_time_ms": "1471689736014" - } - } - }, - { - "inventory_item_data": { - "pokemon_data": { - "id": "276965584718075753", - "pokemon_id": "ZUBAT", - "cp": 62, - "stamina": 23, - "stamina_max": 23, - "move_1": "BITE_FAST", - "move_2": "SLUDGE_BOMB", - "height_m": 0.8217771649360657, - "weight_kg": 8.549221992492676, - "individual_attack": 11, - "individual_defense": 14, - "individual_stamina": 10, - "cp_multiplier": 0.2557200491428375, - "pokeball": "ITEM_POKE_BALL", - "captured_cell_id": "9926768108050055168", - "creation_time_ms": "1471694026807" - } - } - }, - { - "inventory_item_data": { - "pokedex_entry": { - "pokemon_id": "RATTATA", - "times_encountered": 7, - "times_captured": 7 - } - } - }, - { - "inventory_item_data": { - "pokedex_entry": { - "pokemon_id": "SPEAROW", - "times_encountered": 2, - "times_captured": 2 - } + let entries = []; + + entries.push({ + "modified_timestamp_ms": new Date().getTime() - 1e3, + "inventory_item_data": { + "player_stats": { + "level": player.level, + "experience": player.exp, + "prev_level_xp": "21000", + "next_level_xp": "36000", + "km_walked": 3.921541213989258, + "pokemons_encountered": 75, + "unique_pokedex_entries": 25, + "pokemons_captured": 71, + "poke_stop_visits": 123, + "pokeballs_thrown": 74, + "eggs_hatched": 1, + "big_magikarp_caught": 1, + "pokemon_deployed": 1, + "pokemon_caught_by_type": { + "type": "Buffer", + "data": [ + 0, + 24, + 0, + 26, + 20, + 1, + 0, + 14, + 0, + 0, + 1, + 14, + 3, + 0, + 1, + 0, + 0, + 0, + 3 + ] } } - ] - }, - "$unknownFields": [] -}); + } + }); + + for (let key in player.items) { + let amount = parseInt(player.items[key]); + if (amount > 0) { + entries.push({ + "modified_timestamp_ms": new Date().getTime() - 1e3, + "inventory_item_data": { + "item": { + "item_id": "ITEM_" + key.toUpperCase(), + "count": amount + } + } + }); + } + }; + + let party = player.party; + + for (let pkmn of party) { + entries.push({ + "inventory_item_data": { + "pokemon_data": { + "id": pkmn.id, + "pokemon_id": pkmn.pokemon_id, + "cp": pkmn.cp, + "stamina": pkmn.stamina, + "stamina_max": pkmn.stamina_max, + "move_1": pkmn.move_1, + "move_2": pkmn.move_2, + "height_m": pkmn.height_m, + "weight_kg": pkmn.weight_kg, + "individual_attack": pkmn.individual_attack, + "individual_defense": pkmn.individual_defense, + "individual_stamina": pkmn.individual_stamina, + "cp_multiplier": pkmn.cp_multiplier, + "pokeball": pkmn.pokeball, + "captured_cell_id": pkmn.captured_cell_id, + "creation_time_ms": pkmn.creation_time_ms + } + } + }); + }; + + let buffer = ({ + "success": true, + "inventory_delta": { + "new_timestamp_ms": new Date().getTime() - 1e3, + "inventory_items": entries + } + }); return (POGOProtos.serialize(buffer, "POGOProtos.Networking.Responses.GetInventoryResponse")); diff --git a/src/packets/Responses.GetMapObjects.js b/src/packets/Responses.GetMapObjects.js index 9102c63..4ffd64d 100644 --- a/src/packets/Responses.GetMapObjects.js +++ b/src/packets/Responses.GetMapObjects.js @@ -1,1329 +1,194 @@ import proto from "../proto"; import POGOProtos from "pokemongo-protobuf"; -import { - decodeLong -} from "../utils"; - /** * @param {Player} player * @param {Request} request * @return {Object} */ -export default function GetMapObjects(player, request) { +export default function GetMapObjects(player, wild_pkmns, request) { + + let cells = request.cell_id; + let cellsRes = []; + + let pokemon_id = 121; + + cells.forEach((cell) => { + cellsRes.push({ + s2_cell_id: cell, + current_timestamp_ms: new Date().getTime() * 1e3, + forts: [], + spawn_points: [], + deleted_objects: [], + is_truncated_list: false, + fort_summaries: [], + decimated_spawn_points: [], + wild_pokemons: [], + catchable_pokemons: [], + nearby_pokemons: [] + }); + }); + + let latitude = player.latitude; + let longitude = player.longitude; + + let cell = cellsRes[0]; + + cell.forts = [ + { + "id": "108dc9c703a94b619a53a3c29b5c676f.11", + "last_modified_timestamp_ms": "1471621873766", + "latitude": 39.188577, + "longitude": -96.583527, + "enabled": true, + "type": "CHECKPOINT" + }, + { + "id": "1391315b489f421abd52ce10b6da7dd3.16", + "last_modified_timestamp_ms": "1471776325164", + "latitude": 39.188351, + "longitude": -96.582561, + "enabled": true, + "type": "CHECKPOINT" + }, + { + "id": "33ad17c71fff4797b7f25dcfcdca48df.16", + "last_modified_timestamp_ms": "1470755536809", + "latitude": 39.189386, + "longitude": -96.581113, + "enabled": true, + "type": "CHECKPOINT" + }, + { + "id": "40f86138ca6f49cc9e98e18b77d6067a.16", + "last_modified_timestamp_ms": "1471748353301", + "latitude": 39.188351, + "longitude": -96.582209, + "enabled": true, + "type": "CHECKPOINT" + }, + { + "id": "560ef7ed6cb5469db29b543cce7677ae.16", + "last_modified_timestamp_ms": "1469923654520", + "latitude": 39.186848, + "longitude": -96.581267, + "enabled": true, + "type": "CHECKPOINT" + }, + { + "id": "60d2ffcfe9cf4003b4d94bcc9ee0c318.16", + "last_modified_timestamp_ms": "1471811998365", + "latitude": 39.188008, + "longitude": -96.582409, + "enabled": true, + "type": "CHECKPOINT" + }, + { + "id": "637941f1f2494276884ede4fc538c2b2.16", + "last_modified_timestamp_ms": "1471816829142", + "latitude": 39.186868, + "longitude": -96.583295, + "enabled": true, + "type": "CHECKPOINT" + }, + { + "id": "7c0154d02e4f4d91b9b74214eda75abc.16", + "last_modified_timestamp_ms": "1471483788730", + "latitude": 39.187991, + "longitude": -96.581251, + "enabled": true, + "type": "CHECKPOINT" + }, + { + "id": "8a94bf6cd17b43be8b5b42655d23e2f6.16", + "last_modified_timestamp_ms": "1471751252546", + "latitude": 39.187684, + "longitude": -96.583537, + "enabled": true, + "type": "CHECKPOINT" + }, + { + "id": "9b469dbd550f43b5a8e94f941d66bc43.16", + "last_modified_timestamp_ms": "1471243641146", + "latitude": 39.189051, + "longitude": -96.581804, + "enabled": true, + "type": "CHECKPOINT" + }, + { + "id": "bb0e515e3f554b398f1fa9c58435dc78.16", + "last_modified_timestamp_ms": "1471748285036", + "latitude": 39.188823, + "longitude": -96.582742, + "enabled": true, + "type": "CHECKPOINT" + } + ]; + + cell.spawn_points = [ + { + "latitude": 39.188870250798956, + "longitude": -96.58196728549451 + }, + { + "latitude": 39.1889464335866, + "longitude": -96.58205070456887 + }, + { + "latitude": 39.18887496474473, + "longitude": -96.58188386652927 + }, + { + "latitude": 39.18879406783625, + "longitude": -96.58188386652927 + }, + { + "latitude": 39.189284161630674, + "longitude": -96.58180044767312 + } + ]; + + for (let pkmn of wild_pkmns) { + cell.wild_pokemons.push({ + encounter_id: pkmn.encounter_id, + last_modified_timestamp_ms: new Date().getTime(), + latitude: pkmn.latitude, + longitude: pkmn.longitude, + spawn_point_id: "87bdd289c69", + pokemon_data: { + pokemon_id: pkmn.pokemon_id, + cp: pkmn.cp, + stamina: 41, + stamina_max: 41, + move_1: 221, + move_2: 26, + height_m: 0.22802678267819977, + weight_kg: 1.3452539511871338, + individual_attack: 9, + individual_defense: 13, + individual_stamina: 14, + cp_multiplier: 0.5663545199394226 + }, + time_till_hidden_ms: 730176 + }); + cell.catchable_pokemons.push({ + spawn_point_id: "87bdd289c69", + encounter_id: pkmn.encounter_id, + pokemon_id: pkmn.pokemon_id, + latitude: latitude, + longitude: longitude, + expiration_timestamp_ms: (new Date().getTime() + 1e6) * 1e3 + }); + cell.nearby_pokemons.push({ + distance_in_meters: 200.0, + pokemon_id: pkmn.pokemon_id + }); + }; let buffer = ({ - "map_cells": [ - { - "s2_cell_id": "9781205377482752000", - "current_timestamp_ms": new Date().getTime(), - "forts": [ - { - "id": "080edcf9e1ef429f8b29cc30f7723bc4.16", - "last_modified_timestamp_ms": "1471051322524", - "latitude": 39.188289, - "longitude": -96.57824, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "5a19a585c135457ebd5db1e2601211b9.16", - "last_modified_timestamp_ms": "1470031346220", - "latitude": 39.189395, - "longitude": -96.577655, - "enabled": true, - "type": "CHECKPOINT" - } - ], - "spawn_points": [], - "deleted_objects": [], - "fort_summaries": [], - "decimated_spawn_points": [], - "wild_pokemons": [], - "catchable_pokemons": [], - "nearby_pokemons": [] - }, - { - "s2_cell_id": "9781205371040301056", - "current_timestamp_ms": new Date().getTime(), - "forts": [ - { - "id": "023e03844d3c470785bb7ead037cae56.16", - "last_modified_timestamp_ms": "1471744752632", - "latitude": 39.189764, - "longitude": -96.575858, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "1084eede227a4887864a60f3ac71b8e0.16", - "last_modified_timestamp_ms": "1471576408145", - "latitude": 39.189861, - "longitude": -96.577463, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "1e2e673e468f4165aea2c14fdab25a50.16", - "last_modified_timestamp_ms": "1470247256215", - "latitude": 39.189806, - "longitude": -96.57655, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "5b45ce2eb3424088b80188deabb2bf15.16", - "last_modified_timestamp_ms": "1471404572057", - "latitude": 39.192215, - "longitude": -96.577861, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "6cf8d564a7d14cb7a94b75e2bdd0e26c.16", - "last_modified_timestamp_ms": "1471795371065", - "latitude": 39.190364, - "longitude": -96.576983, - "enabled": true, - "owned_by_team": "RED", - "guard_pokemon_id": "GYARADOS", - "gym_points": "12426" - }, - { - "id": "7c59b05b095c48fabb19939fb2c81f85.16", - "last_modified_timestamp_ms": "1471576398808", - "latitude": 39.18987, - "longitude": -96.577752, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "a049481adfff40c0b8e69c270e87ec2d.16", - "last_modified_timestamp_ms": "1471795344448", - "latitude": 39.192228, - "longitude": -96.577043, - "enabled": true, - "type": "CHECKPOINT" - } - ], - "spawn_points": [ - { - "latitude": 39.19219872050884, - "longitude": -96.57746281751568 - } - ], - "deleted_objects": [], - "fort_summaries": [], - "decimated_spawn_points": [], - "wild_pokemons": [], - "catchable_pokemons": [], - "nearby_pokemons": [] - }, - { - "s2_cell_id": "9781199991593762816", - "current_timestamp_ms": new Date().getTime(), - "forts": [ - { - "id": "280ff308f32c47389415a295bfa25570.16", - "last_modified_timestamp_ms": "1471644491787", - "latitude": 39.190921, - "longitude": -96.590022, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "5d5ff9103187497db10a2e78b601fb67.16", - "last_modified_timestamp_ms": "1471800441422", - "latitude": 39.189845, - "longitude": -96.58905, - "enabled": true, - "owned_by_team": "RED", - "guard_pokemon_id": "SNORLAX", - "gym_points": "24751", - "is_in_battle": true - }, - { - "id": "a3ac1ce89c4a4e688d96aa6edb0be076.16", - "last_modified_timestamp_ms": "1471792115365", - "latitude": 39.189731, - "longitude": -96.590123, - "enabled": true, - "type": "CHECKPOINT" - } - ], - "spawn_points": [], - "deleted_objects": [], - "fort_summaries": [], - "decimated_spawn_points": [], - "wild_pokemons": [], - "catchable_pokemons": [], - "nearby_pokemons": [] - }, - { - "s2_cell_id": "9781199985151311872", - "current_timestamp_ms": new Date().getTime(), - "forts": [], - "spawn_points": [], - "deleted_objects": [], - "fort_summaries": [], - "decimated_spawn_points": [], - "wild_pokemons": [], - "catchable_pokemons": [], - "nearby_pokemons": [] - }, - { - "s2_cell_id": "9781199974413893632", - "current_timestamp_ms": new Date().getTime(), - "forts": [], - "spawn_points": [ - { - "latitude": 39.193469215706344, - "longitude": -96.5864720716297 - } - ], - "deleted_objects": [], - "fort_summaries": [], - "decimated_spawn_points": [], - "wild_pokemons": [], - "catchable_pokemons": [], - "nearby_pokemons": [] - }, - { - "s2_cell_id": "9781199967971442688", - "current_timestamp_ms": new Date().getTime(), - "forts": [ - { - "id": "6d585fd260a14672a6c8e81a5ef1c00f.16", - "last_modified_timestamp_ms": "1471026510451", - "latitude": 39.192223, - "longitude": -96.584249, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "7eefc291c5684a58bd430d00bb4a02fa.16", - "last_modified_timestamp_ms": "1471782735236", - "latitude": 39.192495, - "longitude": -96.586269, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "93301f0081ba479195e2e8199d245319.16", - "last_modified_timestamp_ms": "1470677059027", - "latitude": 39.192929, - "longitude": -96.583742, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "9ef09b3d6de848bc85345a8ed87eaadd.16", - "last_modified_timestamp_ms": "1471557306995", - "latitude": 39.194114, - "longitude": -96.58532, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "ac607a7add254949b1793a333c14b5ee.16", - "last_modified_timestamp_ms": "1470754949012", - "latitude": 39.19312, - "longitude": -96.585216, - "enabled": true, - "type": "CHECKPOINT" - } - ], - "spawn_points": [ - { - "latitude": 39.19275534975167, - "longitude": -96.58622179738788 - }, - { - "latitude": 39.19327371754913, - "longitude": -96.5856378279749 - }, - { - "latitude": 39.19351638961815, - "longitude": -96.5856378279749 - } - ], - "deleted_objects": [], - "fort_summaries": [], - "decimated_spawn_points": [], - "wild_pokemons": [], - "catchable_pokemons": [], - "nearby_pokemons": [] - }, - { - "s2_cell_id": "9781199980856344576", - "current_timestamp_ms": new Date().getTime(), - "forts": [ - { - "id": "0375a78fbe6d47d4a218835fb2cf2526.16", - "last_modified_timestamp_ms": "1471038056307", - "latitude": 39.188371, - "longitude": -96.584562, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "4cc6cfa975874931bf3377c999359c56.16", - "last_modified_timestamp_ms": "1470936587696", - "latitude": 39.186824, - "longitude": -96.584704, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "98ee4e63753347dca11ae6e6aa204867.16", - "last_modified_timestamp_ms": "1469037682295", - "latitude": 39.187161, - "longitude": -96.585232, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "9c7333626aff4c9a995ae8ae5b859bc0.11", - "last_modified_timestamp_ms": "1471757750681", - "latitude": 39.186809, - "longitude": -96.583773, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "ef51b905d9594d52a6c0df2bccfd7a40.16", - "last_modified_timestamp_ms": "1471749668125", - "latitude": 39.187588, - "longitude": -96.585254, - "enabled": true, - "type": "CHECKPOINT" - } - ], - "spawn_points": [], - "deleted_objects": [], - "fort_summaries": [], - "decimated_spawn_points": [], - "wild_pokemons": [], - "catchable_pokemons": [], - "nearby_pokemons": [] - }, - { - "s2_cell_id": "9781199983003828224", - "current_timestamp_ms": new Date().getTime(), - "forts": [ - { - "id": "f25f5bb62ee74185b35180024f17434c.16", - "last_modified_timestamp_ms": "1471550764849", - "latitude": 39.186555, - "longitude": -96.586559, - "enabled": true, - "type": "CHECKPOINT" - } - ], - "spawn_points": [], - "deleted_objects": [], - "fort_summaries": [], - "decimated_spawn_points": [], - "wild_pokemons": [], - "catchable_pokemons": [], - "nearby_pokemons": [] - }, - { - "s2_cell_id": "9781199976561377280", - "current_timestamp_ms": new Date().getTime(), - "forts": [], - "spawn_points": [], - "deleted_objects": [], - "fort_summaries": [], - "decimated_spawn_points": [], - "wild_pokemons": [], - "catchable_pokemons": [], - "nearby_pokemons": [] - }, - { - "s2_cell_id": "9781199978708860928", - "current_timestamp_ms": new Date().getTime(), - "forts": [ - { - "id": "03a289706b324e5ca289e77d0f03733f.16", - "last_modified_timestamp_ms": "1471298173282", - "latitude": 39.190998, - "longitude": -96.584099, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "601d019e865b46e9a62934a4417dc4ee.16", - "last_modified_timestamp_ms": "1471555931903", - "latitude": 39.190639, - "longitude": -96.584886, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "614e1b214a1844849dfbc8d14ee9e443.11", - "last_modified_timestamp_ms": "1471651642493", - "latitude": 39.190475, - "longitude": -96.584527, - "enabled": true, - "type": "CHECKPOINT", - "cooldown_complete_timestamp_ms": "1471780158665" - }, - { - "id": "97dad10ec7c74b498e3ce449cf167fe8.16", - "last_modified_timestamp_ms": "1471732087850", - "latitude": 39.190583, - "longitude": -96.586108, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "ac4ab9e172c440f18ae0f37855d45efc.16", - "last_modified_timestamp_ms": "1471800306431", - "latitude": 39.19038, - "longitude": -96.584106, - "enabled": true, - "owned_by_team": "RED", - "guard_pokemon_id": "VAPOREON", - "gym_points": "22697" - }, - { - "id": "f810680ded144b9c9e258cad59584932.11", - "last_modified_timestamp_ms": "1470559731922", - "latitude": 39.189884, - "longitude": -96.584104, - "enabled": true, - "type": "CHECKPOINT", - "cooldown_complete_timestamp_ms": "1471780084584" - } - ], - "spawn_points": [], - "deleted_objects": [], - "fort_summaries": [], - "decimated_spawn_points": [], - "wild_pokemons": [], - "catchable_pokemons": [], - "nearby_pokemons": [] - }, - { - "s2_cell_id": "9781199955086540800", - "current_timestamp_ms": new Date().getTime(), - "forts": [ - { - "id": "14e9f2671f2a44f68011ad29f2207018.16", - "last_modified_timestamp_ms": "1470316275511", - "latitude": 39.191213, - "longitude": -96.581955, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "282d96b677a74610a4d5ee7815009411.16", - "last_modified_timestamp_ms": "1470487074907", - "latitude": 39.190158, - "longitude": -96.58178, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "53a79f5b2cdd44718e31b9c40013da7b.16", - "last_modified_timestamp_ms": "1471585616392", - "latitude": 39.192012, - "longitude": -96.581328, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "5999459ff2d340078828ef072ec0ef9c.16", - "last_modified_timestamp_ms": "1470234749934", - "latitude": 39.191629, - "longitude": -96.58323, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "99b7abe5c415420fa76eca762921a252.11", - "last_modified_timestamp_ms": "1471622037923", - "latitude": 39.190233, - "longitude": -96.58131, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "a4fa0dde26464b30b1cde9ab98be0918.11", - "last_modified_timestamp_ms": "1471718373154", - "latitude": 39.190089, - "longitude": -96.58322, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "ad6f130078154fbb922cc525ab30d106.11", - "last_modified_timestamp_ms": "1471405146419", - "latitude": 39.189808, - "longitude": -96.581257, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "c86bc747a0fe48bc96aa9008622540f8.16", - "last_modified_timestamp_ms": "1470561775245", - "latitude": 39.189609, - "longitude": -96.58247, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "f566caf28e1047a6bad2ac0d654239ac.16", - "last_modified_timestamp_ms": "1471529893584", - "latitude": 39.191381, - "longitude": -96.581713, - "enabled": true, - "type": "CHECKPOINT" - } - ], - "spawn_points": [ - { - "latitude": 39.1896124600141, - "longitude": -96.58171702892608 - }, - { - "latitude": 39.189726350923266, - "longitude": -96.58113310075188 - }, - { - "latitude": 39.19181546751814, - "longitude": -96.58138335502902 - }, - { - "latitude": 39.19198668072476, - "longitude": -96.58121651873516 - }, - { - "latitude": 39.19182960806035, - "longitude": -96.58113310075188 - }, - { - "latitude": 39.19196311246427, - "longitude": -96.58163361028815 - }, - { - "latitude": 39.191967826248934, - "longitude": -96.58155019175932 - }, - { - "latitude": 39.19198196720522, - "longitude": -96.58129993682753 - }, - { - "latitude": 39.19190578772032, - "longitude": -96.58121651873516 - }, - { - "latitude": 39.19150132114832, - "longitude": -96.58121651873516 - }, - { - "latitude": 39.191753428225304, - "longitude": -96.58104968287773 - }, - { - "latitude": 39.19126806675631, - "longitude": -96.58104968287773 - }, - { - "latitude": 39.19183432144186, - "longitude": -96.58104968287773 - }, - { - "latitude": 39.19134896059277, - "longitude": -96.58104968287773 - }, - { - "latitude": 39.19159164148224, - "longitude": -96.58104968287773 - }, - { - "latitude": 39.19109685199338, - "longitude": -96.58121651873516 - }, - { - "latitude": 39.19116831898037, - "longitude": -96.58138335502902 - }, - { - "latitude": 39.189811960033076, - "longitude": -96.58104968287773 - }, - { - "latitude": 39.18996432461859, - "longitude": -96.58121651873516 - } - ], - "deleted_objects": [], - "fort_summaries": [], - "decimated_spawn_points": [], - "wild_pokemons": [], - "catchable_pokemons": [], - "nearby_pokemons": [] - }, - { - "s2_cell_id": "9781199957234024448", - "current_timestamp_ms": new Date().getTime(), - "forts": [ - { - "id": "155dc7e5f0054faa81ea56c6e8c54f68.16", - "last_modified_timestamp_ms": "1471458301136", - "latitude": 39.189603, - "longitude": -96.578715, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "217e9c24680541e89b8a432a7552ae1b.16", - "last_modified_timestamp_ms": "1471787760082", - "latitude": 39.1905, - "longitude": -96.579088, - "enabled": true, - "owned_by_team": "RED", - "guard_pokemon_id": "VAPOREON", - "gym_points": "18423" - }, - { - "id": "30f6dbee9eeb4e0e979a99741cf3304d.16", - "last_modified_timestamp_ms": "1471573445404", - "latitude": 39.191939, - "longitude": -96.578589, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "4807de0920154dabaadf0cad98b3d0b9.16", - "last_modified_timestamp_ms": "1471630498363", - "latitude": 39.190973, - "longitude": -96.580973, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "5408fa0fd76145c8a3c5c61b1ea2bceb.11", - "last_modified_timestamp_ms": "1471465165042", - "latitude": 39.190004, - "longitude": -96.579479, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "5b451cde8f18433f88414789ae7ce55f.11", - "last_modified_timestamp_ms": "1471719704625", - "latitude": 39.191467, - "longitude": -96.580898, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "62d85d9b92654a99aae85980d62aa895.16", - "last_modified_timestamp_ms": "1471411498696", - "latitude": 39.19141, - "longitude": -96.579584, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "6b8ac3edccc64837b9898b9a1029761a.16", - "last_modified_timestamp_ms": "1471650819287", - "latitude": 39.191529, - "longitude": -96.579846, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "a2710e9d1a3f440bb3796a8e0d0f7653.12", - "last_modified_timestamp_ms": "1471720350458", - "latitude": 39.190489, - "longitude": -96.580542, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "a319260fdfa04545b4d09c5f4d649d1a.11", - "last_modified_timestamp_ms": "1471463408586", - "latitude": 39.189828, - "longitude": -96.580015, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "f01cb9e600444afc8f4681977ce2930e.16", - "last_modified_timestamp_ms": "1471645573471", - "latitude": 39.192106, - "longitude": -96.579022, - "enabled": true, - "type": "CHECKPOINT" - } - ], - "spawn_points": [ - { - "latitude": 39.19008763820493, - "longitude": -96.58046576081381 - }, - { - "latitude": 39.18998789088006, - "longitude": -96.58079942990994 - }, - { - "latitude": 39.1913772393915, - "longitude": -96.58054917792418 - }, - { - "latitude": 39.191201312497725, - "longitude": -96.58079942990994 - }, - { - "latitude": 39.18999260393353, - "longitude": -96.58071601247224 - }, - { - "latitude": 39.189906995279046, - "longitude": -96.58079942990994 - }, - { - "latitude": 39.189559067794576, - "longitude": -96.57979842785916 - }, - { - "latitude": 39.190163820750165, - "longitude": -96.58054917792418 - }, - { - "latitude": 39.19135367389158, - "longitude": -96.58096626511268 - }, - { - "latitude": 39.19154373969393, - "longitude": -96.58046576081381 - }, - { - "latitude": 39.19122016447811, - "longitude": -96.58046576081381 - }, - { - "latitude": 39.19169138774681, - "longitude": -96.58071601247224 - }, - { - "latitude": 39.19169610079146, - "longitude": -96.58063259514365 - }, - { - "latitude": 39.191943493468735, - "longitude": -96.58054917792418 - }, - { - "latitude": 39.191372526424075, - "longitude": -96.58063259514365 - }, - { - "latitude": 39.1901732464041, - "longitude": -96.58038234381257 - } - ], - "deleted_objects": [], - "fort_summaries": [], - "decimated_spawn_points": [], - "wild_pokemons": [], - "catchable_pokemons": [], - "nearby_pokemons": [] - }, - { - "s2_cell_id": "9781199950791573504", - "current_timestamp_ms": new Date().getTime(), - "forts": [ - { - "id": "3ddc92da8fba4e24b967d5216da68d8a.16", - "last_modified_timestamp_ms": "1470507065167", - "latitude": 39.189333, - "longitude": -96.58045, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "48715a49e53f406d96f77e22b5f91415.11", - "last_modified_timestamp_ms": "1471717500458", - "latitude": 39.187914, - "longitude": -96.580012, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "57b640b14e234607bfb04d3d66d841fd.16", - "last_modified_timestamp_ms": "1471039597671", - "latitude": 39.187895, - "longitude": -96.579301, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "88e61d1f13294c6098122e3213780f0b.16", - "last_modified_timestamp_ms": "1471525597252", - "latitude": 39.187657, - "longitude": -96.578385, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "c1ba5f8eda744d0aa49ca389c23c60d5.11", - "last_modified_timestamp_ms": "1471551825715", - "latitude": 39.188057, - "longitude": -96.58098, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "ce7fae6154004f21a986aa0483d829ae.16", - "last_modified_timestamp_ms": "1471790729135", - "latitude": 39.189402, - "longitude": -96.578673, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "d4547cbebd4f400dbf150af82347ef08.16", - "last_modified_timestamp_ms": "1470111292530", - "latitude": 39.189, - "longitude": -96.57907, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "d9a15d395b0e42efb8641af0f9070f7f.16", - "last_modified_timestamp_ms": "1469915007418", - "latitude": 39.188439, - "longitude": -96.580529, - "enabled": true, - "type": "CHECKPOINT" - } - ], - "spawn_points": [ - { - "latitude": 39.18870768769649, - "longitude": -96.58054917792418 - }, - { - "latitude": 39.189330515225215, - "longitude": -96.5795481798016 - }, - { - "latitude": 39.18877366101736, - "longitude": -96.57938134830886 - }, - { - "latitude": 39.18740389337131, - "longitude": -96.58071601247224 - }, - { - "latitude": 39.188307913149515, - "longitude": -96.58046576081381 - }, - { - "latitude": 39.188992791848875, - "longitude": -96.57979842785916 - }, - { - "latitude": 39.188017309051496, - "longitude": -96.57988184409656 - }, - { - "latitude": 39.18825529074279, - "longitude": -96.57996526044312 - }, - { - "latitude": 39.18826942753547, - "longitude": -96.57971501173085 - }, - { - "latitude": 39.188250578346015, - "longitude": -96.58004867689877 - }, - { - "latitude": 39.18863150324239, - "longitude": -96.58046576081381 - } - ], - "deleted_objects": [], - "fort_summaries": [], - "decimated_spawn_points": [], - "wild_pokemons": [], - "catchable_pokemons": [], - "nearby_pokemons": [] - }, - { - "s2_cell_id": "9781199952939057152", - "current_timestamp_ms": new Date().getTime(), - "forts": [ - { - "id": "108dc9c703a94b619a53a3c29b5c676f.11", - "last_modified_timestamp_ms": "1471621873766", - "latitude": 39.188577, - "longitude": -96.583527, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "1391315b489f421abd52ce10b6da7dd3.16", - "last_modified_timestamp_ms": "1471776325164", - "latitude": 39.188351, - "longitude": -96.582561, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "33ad17c71fff4797b7f25dcfcdca48df.16", - "last_modified_timestamp_ms": "1470755536809", - "latitude": 39.189386, - "longitude": -96.581113, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "40f86138ca6f49cc9e98e18b77d6067a.16", - "last_modified_timestamp_ms": "1471748353301", - "latitude": 39.188351, - "longitude": -96.582209, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "560ef7ed6cb5469db29b543cce7677ae.16", - "last_modified_timestamp_ms": "1469923654520", - "latitude": 39.186848, - "longitude": -96.581267, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "60d2ffcfe9cf4003b4d94bcc9ee0c318.16", - "last_modified_timestamp_ms": "1471743176808", - "latitude": 39.188008, - "longitude": -96.582409, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "637941f1f2494276884ede4fc538c2b2.16", - "last_modified_timestamp_ms": "1471757787582", - "latitude": 39.186868, - "longitude": -96.583295, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "7c0154d02e4f4d91b9b74214eda75abc.16", - "last_modified_timestamp_ms": "1471483788730", - "latitude": 39.187991, - "longitude": -96.581251, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "8a94bf6cd17b43be8b5b42655d23e2f6.16", - "last_modified_timestamp_ms": "1471751252546", - "latitude": 39.187684, - "longitude": -96.583537, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "9b469dbd550f43b5a8e94f941d66bc43.16", - "last_modified_timestamp_ms": "1471243641146", - "latitude": 39.189051, - "longitude": -96.581804, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "bb0e515e3f554b398f1fa9c58435dc78.16", - "last_modified_timestamp_ms": "1471748285036", - "latitude": 39.188823, - "longitude": -96.582742, - "enabled": true, - "type": "CHECKPOINT" - } - ], - "spawn_points": [ - { - "latitude": 39.188870250798956, - "longitude": -96.58196728549451 - }, - { - "latitude": 39.1889464335866, - "longitude": -96.58205070456887 - }, - { - "latitude": 39.18887496474473, - "longitude": -96.58188386652927 - }, - { - "latitude": 39.18879406783625, - "longitude": -96.58188386652927 - }, - { - "latitude": 39.189284161630674, - "longitude": -96.58180044767312 - } - ], - "deleted_objects": [], - "fort_summaries": [], - "decimated_spawn_points": [], - "wild_pokemons": [ - { - "encounter_id": "15124390125922157165", - "last_modified_timestamp_ms": new Date().getTime(), - "latitude": 39.1882905753091, - "longitude": -96.58363568771144, - "spawn_point_id": "87bdcd88cb5", - "pokemon_data": { - "pokemon_id": "MEWTWO" - }, - "time_till_hidden_ms": 20000 - }, - { - "encounter_id": "15124390125922157169", - "last_modified_timestamp_ms": new Date().getTime(), - "latitude": 39.1884905743091, - "longitude": -96.58363568761144, - "spawn_point_id": "87bdcd88cb5", - "pokemon_data": { - "pokemon_id": "MEW" - }, - "time_till_hidden_ms": 30000 - }, - { - "encounter_id": "15124390125922157129", - "last_modified_timestamp_ms": new Date().getTime(), - "latitude": 39.1884905743091, - "longitude": -96.58343568761143, - "spawn_point_id": "87bdcd88cb5", - "pokemon_data": { - "pokemon_id": "ZAPDOS" - }, - "time_till_hidden_ms": 40000 - } - ], - "catchable_pokemons": [ - { - "spawn_point_id": "87bdcd88cb5", - "encounter_id": "15124390125922157165", - "pokemon_id": "MEWTWO", - "expiration_timestamp_ms": "1471800475092", - "latitude": 39.1882905753091, - "longitude": -96.58363568771144 - }, - { - "spawn_point_id": "87bdcd88cb5", - "encounter_id": "15124390125922157169", - "pokemon_id": "MEW", - "expiration_timestamp_ms": "1471800475092", - "latitude": 39.1884905743091, - "longitude": -96.58363568761144 - }, - { - "spawn_point_id": "87bdcd88cb5", - "encounter_id": "15124390125922157129", - "pokemon_id": "ZAPDOS", - "expiration_timestamp_ms": "1471800475092", - "latitude": 39.1884905743091, - "longitude": -96.58343568761143 - } - ], - "nearby_pokemons": [] - }, - { - "s2_cell_id": "9781199965823959040", - "current_timestamp_ms": new Date().getTime(), - "forts": [ - { - "id": "2715ee21d0844c6fbb0fda3a2029e945.16", - "last_modified_timestamp_ms": "1471710797897", - "latitude": 39.192669, - "longitude": -96.583311, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "4cd3b930af1a4f248f6c01af748115bd.16", - "last_modified_timestamp_ms": "1471575743600", - "latitude": 39.192082, - "longitude": -96.582129, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "66fd7861f1794235a8b4ab9e75abdff8.16", - "last_modified_timestamp_ms": "1471364750124", - "latitude": 39.193544, - "longitude": -96.583396, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "80948d46cb744685b00f3f6923ac65bc.16", - "last_modified_timestamp_ms": "1471293569339", - "latitude": 39.194292, - "longitude": -96.582015, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "b54e269be87c49478d27d8bef6018f58.11", - "last_modified_timestamp_ms": "1470692404303", - "latitude": 39.192906, - "longitude": -96.581716, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "ded8ab4bc4a9473a9679d3c12f0ea852.16", - "last_modified_timestamp_ms": "1471585725951", - "latitude": 39.192085, - "longitude": -96.581052, - "enabled": true, - "type": "CHECKPOINT" - } - ], - "spawn_points": [ - { - "latitude": 39.192044005351725, - "longitude": -96.58163361028815 - }, - { - "latitude": 39.192020435420545, - "longitude": -96.58205070456887 - } - ], - "deleted_objects": [], - "fort_summaries": [], - "decimated_spawn_points": [], - "wild_pokemons": [], - "catchable_pokemons": [], - "nearby_pokemons": [] - }, - { - "s2_cell_id": "9781199959381508096", - "current_timestamp_ms": new Date().getTime(), - "forts": [ - { - "id": "751ec666414247d78fd259028f701590.16", - "last_modified_timestamp_ms": "1471012618815", - "latitude": 39.194234, - "longitude": -96.579903, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "7f4aa8a610aa4d9db68a36bec83fd745.16", - "last_modified_timestamp_ms": "1471573864363", - "latitude": 39.192719, - "longitude": -96.579799, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "bbdf4444583546d9b2b729ec5d45537e.11", - "last_modified_timestamp_ms": "1471797235873", - "latitude": 39.193056, - "longitude": -96.579455, - "enabled": true, - "owned_by_team": "BLUE", - "guard_pokemon_id": "VAPOREON", - "gym_points": "4000" - }, - { - "id": "d7812fa64a4942d2ab6d7df3190cd0a6.11", - "last_modified_timestamp_ms": "1471645568026", - "latitude": 39.192212, - "longitude": -96.579514, - "enabled": true, - "type": "CHECKPOINT" - } - ], - "spawn_points": [ - { - "latitude": 39.1944071543913, - "longitude": -96.57846378290101 - }, - { - "latitude": 39.19441186573404, - "longitude": -96.5783803685187 - } - ], - "deleted_objects": [], - "fort_summaries": [], - "decimated_spawn_points": [], - "wild_pokemons": [], - "catchable_pokemons": [], - "nearby_pokemons": [] - }, - { - "s2_cell_id": "9781199937906671616", - "current_timestamp_ms": new Date().getTime(), - "forts": [], - "spawn_points": [], - "deleted_objects": [], - "fort_summaries": [], - "decimated_spawn_points": [], - "wild_pokemons": [], - "catchable_pokemons": [], - "nearby_pokemons": [] - }, - { - "s2_cell_id": "9781199940054155264", - "current_timestamp_ms": new Date().getTime(), - "forts": [ - { - "id": "116fe592ee124bc782189e3b236543b9.16", - "last_modified_timestamp_ms": "1471789051235", - "latitude": 39.186487, - "longitude": -96.585603, - "enabled": true, - "owned_by_team": "RED", - "guard_pokemon_id": "DRAGONITE", - "gym_points": "10034" - }, - { - "id": "7516ab5a89b2456fa3b3454d94308c2f.16", - "last_modified_timestamp_ms": "1471569169549", - "latitude": 39.185858, - "longitude": -96.585593, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "9315a6c61b294fffa453593262784d42.16", - "last_modified_timestamp_ms": "1470527342920", - "latitude": 39.186378, - "longitude": -96.584565, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "ca827e78a2514218ab70bb407ef0b798.16", - "last_modified_timestamp_ms": "1471781381973", - "latitude": 39.186659, - "longitude": -96.583743, - "enabled": true, - "type": "CHECKPOINT" - } - ], - "spawn_points": [], - "deleted_objects": [], - "fort_summaries": [], - "decimated_spawn_points": [], - "wild_pokemons": [], - "catchable_pokemons": [], - "nearby_pokemons": [] - }, - { - "s2_cell_id": "9781199948644089856", - "current_timestamp_ms": new Date().getTime(), - "forts": [ - { - "id": "0c73510c66ed4bcfa92f77df2d7dc7f0.11", - "last_modified_timestamp_ms": "1470924273803", - "latitude": 39.186695, - "longitude": -96.580794, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "111a01218f71427482ef2afb4655110b.16", - "last_modified_timestamp_ms": "1471495631668", - "latitude": 39.185378, - "longitude": -96.578626, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "1af804d6d5214911913d88b33af581ad.16", - "last_modified_timestamp_ms": "1471799300878", - "latitude": 39.186628, - "longitude": -96.578443, - "enabled": true, - "owned_by_team": "YELLOW", - "guard_pokemon_id": "FLAREON", - "gym_points": "4000" - }, - { - "id": "77feee0994214897a3b6dce58a3ad4dd.16", - "last_modified_timestamp_ms": "1471765255682", - "latitude": 39.185924, - "longitude": -96.578763, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "7b1208b02f6843889c52fb7d1d569ecc.11", - "last_modified_timestamp_ms": "1470039557132", - "latitude": 39.186489, - "longitude": -96.579886, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "cc692d8b24f64244884d9481e9c83ebd.16", - "last_modified_timestamp_ms": "1468345908021", - "latitude": 39.186268, - "longitude": -96.579524, - "enabled": true, - "type": "CHECKPOINT" - } - ], - "spawn_points": [], - "deleted_objects": [], - "fort_summaries": [], - "decimated_spawn_points": [], - "wild_pokemons": [], - "catchable_pokemons": [], - "nearby_pokemons": [] - }, - { - "s2_cell_id": "9781199942201638912", - "current_timestamp_ms": new Date().getTime(), - "forts": [ - { - "id": "1e81f35de1f34fd994c320332497705f.16", - "last_modified_timestamp_ms": "1471781376676", - "latitude": 39.186289, - "longitude": -96.583305, - "enabled": true, - "type": "CHECKPOINT" - }, - { - "id": "cd1b34b754cb4a33add1dacb7f161177.16", - "last_modified_timestamp_ms": "1471726904495", - "latitude": 39.18591, - "longitude": -96.581364, - "enabled": true, - "type": "CHECKPOINT" - } - ], - "spawn_points": [ - { - "latitude": 39.18646686734363, - "longitude": -96.58155019175932 - } - ], - "deleted_objects": [], - "fort_summaries": [], - "decimated_spawn_points": [], - "wild_pokemons": [], - "catchable_pokemons": [], - "nearby_pokemons": [] - } - ], - "status": "SUCCESS", - "$unknownFields": [] -}); + status: "SUCCESS", + map_cells: cellsRes + }); return (POGOProtos.serialize(buffer, "POGOProtos.Networking.Responses.GetMapObjectsResponse")); diff --git a/src/packets/Responses.GetPlayer.js b/src/packets/Responses.GetPlayer.js index 9a40a0c..455fb01 100644 --- a/src/packets/Responses.GetPlayer.js +++ b/src/packets/Responses.GetPlayer.js @@ -85,48 +85,15 @@ function buildPlayerData(obj) { } -/** - * @param {Object} obj - * @return {Object} - */ export default function GetPlayer(obj) { let data = buildPlayerData(obj); + let packet = getPlayerDataPacket(data); let buffer = { - "success": true, - "player_data": { - "creation_timestamp_ms": "1471096437979", - "username": "Administrator", - "team": "YELLOW", - "tutorial_state": [ - "LEGAL_SCREEN", - "AVATAR_SELECTION", - "POKEMON_CAPTURE", - "NAME_SELECTION", - "FIRST_TIME_EXPERIENCE_COMPLETE" - ], - "avatar": {}, - "max_pokemon_storage": 250, - "max_item_storage": 350, - "daily_bonus": {}, - "equipped_badge": {}, - "contact_settings": { - "send_marketing_emails": true - }, - "currencies": [ - { - "name": "POKECOIN", - "amount": 1339 - }, - { - "name": "STARDUST", - "amount": 7681 - } - ] - }, - "$unknownFields": [] + success: true, + player_data: packet }; return (POGOProtos.serialize(buffer, "POGOProtos.Networking.Responses.GetPlayerResponse")); diff --git a/src/packets/Responses.ItemTemplates.js b/src/packets/Responses.ItemTemplates.js index 1025763..691b18d 100644 --- a/src/packets/Responses.ItemTemplates.js +++ b/src/packets/Responses.ItemTemplates.js @@ -5,8 +5,9 @@ import proto from "../proto"; import POGOProtos from "pokemongo-protobuf"; /** + * @param {Buffer} master * @return {Object} */ -export default function ItemTemplates() { - return (fs.readFileSync("data/game_master")); +export default function ItemTemplates(master) { + return (master); } \ No newline at end of file diff --git a/src/packets/Responses.ShopData.js b/src/packets/Responses.ShopData.js new file mode 100644 index 0000000..2d3bea7 --- /dev/null +++ b/src/packets/Responses.ShopData.js @@ -0,0 +1,71 @@ +import proto from "../proto"; +import POGOProtos from "pokemongo-protobuf"; + +import CFG from "../../cfg"; + +/** + * @return {Object} + */ +export default function ShopData() { + + let buffer = ({ + "response_type": 5, + "unknown2": { + "unknown1": "1", + "items": [ + { + "item_id": "pgorelease.pokeball.100", + "currency_to_buy": { + "name": "POKECOIN", + "amount": 460 + }, + "yields_item": { + "count": 100 + }, + "tags": [ + { + "key": "CATEGORY", + "value": "ITEMS" + }, + { + "key": "SORT", + "value": "2" + } + ] + }, + { + "item_id": "pgorelease.pokecoin.100", + "is_iap": true, + "yields_currency": { + "name": "POKECOIN", + "amount": 100 + }, + "tags": [ + { + "key": "CATEGORY", + "value": "POKECOINS" + }, + { + "key": "SORT", + "value": "1" + } + ], + "unknown7": 1 + } + ], + "player_currencies": [ + { + "name": "POKECOIN" + }, + { + "name": "STARDUST", + "amount": 7681 + } + ], + "unknown4": "ZCgldzCNR+0pbImyvzykby/6+iA=" + } + }); + + return (buffer); + +} \ No newline at end of file diff --git a/src/packets/index.js b/src/packets/index.js index d6462a3..f4903aa 100644 --- a/src/packets/index.js +++ b/src/packets/index.js @@ -26,12 +26,17 @@ export SetAvatar from "./Responses.SetAvatar"; export SfidaActionLog from "./Responses.SfidaActionLog"; +export CheckChallenge from "./Responses.CheckChallenge"; + export Encounter from "./Responses.Encounter"; +export CatchPokemon from "./Responses.CatchPokemon"; export NicknamePokemon from "./Responses.NicknamePokemon"; export UpgradePokemon from "./Responses.UpgradePokemon"; export EvolvePokemon from "./Responses.EvolvePokemon"; export SetFavoritePokemon from "./Responses.SetFavoritePokemon"; +export ShopData from "./Responses.ShopData"; + export AuthTicket from "./Envelopes.AuthTicket"; export ResponseEnvelope from "./Envelopes.ResponseEnvelope"; export ResponseEnvelopeAuth from "./Envelopes.ResponseEnvelope.Auth"; \ No newline at end of file diff --git a/src/player.js b/src/player.js index 05b6842..94ed025 100644 --- a/src/player.js +++ b/src/player.js @@ -25,9 +25,10 @@ class Player { constructor(obj) { this.uid = -1; + this.owner_id = -1; this.email = null; - this.username = "undefined"; + this.username = null; this.latitude = 0; this.longitude = 0; @@ -37,6 +38,7 @@ class Player { this.send_push_notifications = false; this.exp = 0; + this.level = 0; this.stardust = 0; this.pokecoins = 0; @@ -53,6 +55,36 @@ class Player { this.gender = 0; this.backpack = 0; + this.items = { + poke_ball: 0, + great_ball: 0, + ultra_ball: 0, + master_ball: 0, + potion: 0, + super_potion: 0, + hyper_potion: 0, + max_potion: 0, + revive: 0, + max_revive: 0, + lucky_egg: 0, + incense_ordinary: 0, + incense_spicy: 0, + incense_cool: 0, + incense_floral: 0, + troy_disk: 0, + razz_berry: 0, + bluk_berry: 0, + nanab_berry: 0, + wepar_berry: 0, + pinap_berry: 0, + incubator_basic: 0, + incubator_basic_unlimited: 0, + pokemon_storage_upgrade: 0, + storage_upgrade: 0 + }; + + this.party = []; + this.tutorial_state = []; this.badges = null; @@ -77,6 +109,8 @@ class Player { this.loggedIn = obj.loggedIn || false; this.authenticated = false; + this.authentications = 0; + } /** @@ -105,10 +139,18 @@ class Player { if (this.hasOwnProperty(key)) { if (key === "send_marketing_emails" || key === "send_push_notifications") { this[key] = !!obj[key]; - } else { + } + else { this[key] = obj[key]; } } + else if (key.substring(0, 5) === "item_") { + let name = key.substring(5, key.length); + this.items[name] = obj[key]; + } + else if (key === "id") { + this.owner_id = obj[key]; + } }; } @@ -151,6 +193,19 @@ class Player { } +/** + * @param {String} name + * @return {Boolean} + */ +export function validPlayerName(name) { + return !( + name === null || + name === void 0 || + typeof name === "string" && + name.length <= 1 + ); +} + /** * @param {Player} player */ @@ -254,17 +309,44 @@ export function removePlayer(player) { } +/** + * @param {String} name + * @param {String} pkmn + */ +export function spawnPkmnAtPlayer(name, pkmn, amount) { + + if (!this.validPlayerName(name)) { + this.print(`Invalid player name!`, 31); + return void 0; + } + + let spawn = null; + let player = this.getPlayerByName(name); + + if (player !== null) { + let index = 0; + while (++index < amount) { + spawn = { + pokemon_id: pkmn.toUpperCase(), + cp: Math.random() * 1e3 << 0, + encounter_id: Math.random() * 1e5 << 0, + latitude: player.latitude + parseFloat((Math.random() / 1e3).toFixed(5)), + longitude: player.longitude + parseFloat((Math.random() / 1e3).toFixed(5)) + }; + this.wild_pokemons.push(spawn); + }; + this.print(`Spawned ${amount}x ${pkmn}'s to ${name} at ${spawn.latitude.toFixed(7)}:${spawn.longitude.toFixed(7)}!`); + } + else this.print(`Failed to spawn ${pkmn} to player ${name}!`, 31); + +} + /** * @param {String} name */ export function kickPlayer(name) { - if ( - name === null || - name === void 0 || - typeof name === "string" && - name.length <= 1 - ) { + if (!this.validPlayerName(name)) { this.print(`Invalid player name!`, 31); return void 0; } @@ -301,7 +383,9 @@ export function removeAllPlayers() { export function savePlayer(player) { return new Promise((resolve) => { if (player.authenticated) { - this.updateUser(player).then(resolve); + this.updateUser(player).then(() => { + this.updateUserItems(player).then(resolve); + }); } }); } @@ -338,10 +422,14 @@ export function forwardPlayer(player) { export function loginPlayer(player) { return new Promise((resolve) => { - this.getUserByEmail(player.email).then((doc) => { - player.updateByObject(doc); - let buffer = GetPlayer(player); - resolve(buffer); + this.getUserByEmail(player.email).then((user) => { + user = user[0]; + this.getPkmnByColumn("owner_id", user.id).then((party) => { + player.updateByObject(user); + player.party = party || []; + let buffer = GetPlayer(player); + resolve(buffer); + }); }); }); diff --git a/src/process.js b/src/process.js index c6d4c39..51edbb4 100644 --- a/src/process.js +++ b/src/process.js @@ -38,6 +38,9 @@ export function processCommand(cmd, data) { var length = this.clients.length; this.print(`Saved ${length} player${length === 1 ? "": "s"} into database!`); break; + case "/spawn": + this.spawnPkmnAtPlayer(data[1], data[2], data[3] || 1); + break; case "/update": eval(fs.readFileSync("update.js", "utf8")); break; diff --git a/src/request.js b/src/request.js index b624a21..23df257 100644 --- a/src/request.js +++ b/src/request.js @@ -8,11 +8,10 @@ import CFG from "../cfg"; import { ResponseEnvelope, - AuthTicket + AuthTicket, + ShopData } from "./packets"; -const REQUEST = proto.Networking.Requests.RequestType; - /** * @param {Request} req * @param {Response} res @@ -52,22 +51,6 @@ export function routeRequest(req, res) { } -/** - * @param {Request} req - * @return {String} - */ -export function getRequestType(req) { - - for (let key in REQUEST) { - if (REQUEST[key] === req.request_type) { - return (key); - } - }; - - return ("INVALID"); - -} - export function parseProtobuf(buffer, path) { try { return POGOProtos.parseWithUnknown(buffer, path); @@ -104,10 +87,7 @@ export function onRequest(req) { let request = this.parseProtobuf(req.body, "POGOProtos.Networking.Envelopes.RequestEnvelope"); - if (!request.requests.length) { - this.print("Received invalid request!", 31); - return void 0; - } + request.requests = request.requests || []; if (CFG.DEBUG_LOG_REQUESTS) { console.log("#####"); @@ -121,8 +101,21 @@ export function onRequest(req) { return void 0; } - this.processRequests(player, request.requests).then((answer) => { - let msg = this.envelopResponse(1, request.request_id, answer, !!request.auth_ticket, request); + if (!request.requests.length) { + // send shop data + if (request.unknown6 && request.unknown6.request_type === 6) { + let msg = this.envelopResponse(1, [], request, !!request.auth_ticket, true); + player.sendResponse(msg); + } + // otherwise invalid + else { + this.print("Received invalid request!", 31); + return void 0; + } + } + + this.processRequests(player, request.requests).then((returns) => { + let msg = this.envelopResponse(1, returns, request, !!request.auth_ticket, false); if (CFG.DEBUG_DUMP_TRAFFIC) { this.dumpTraffic(req.body, msg); } @@ -133,18 +126,33 @@ export function onRequest(req) { /** * @param {Number} status - * @param {Long} id - * @param {Array} response + * @param {Array} returns + * @param {Request} req * @param {Boolean} auth + * @param {Boolean} shop * @return {Buffer} */ -export function envelopResponse(status, id, response, auth, req) { +export function envelopResponse(status, returns, req, auth, shop) { let buffer = req; delete buffer.requests; - buffer.returns = response; + buffer.returns = returns; + + if (auth) buffer.auth_ticket = AuthTicket(); + if (shop) buffer.unknown6 = [ShopData()]; + + if (buffer.unknown6 && !shop) { + buffer.unknown6 = [{ + "response_type": 6, + "unknown2": { + "unknown1": "1", + "items": [], + "player_currencies": [] + } + }]; + } buffer.status_code = 1; diff --git a/src/response.js b/src/response.js index d04a05b..58375f4 100644 --- a/src/response.js +++ b/src/response.js @@ -1,4 +1,5 @@ import proto from "./proto"; +import POGOProtos from "pokemongo-protobuf"; import CFG from "../cfg"; @@ -10,6 +11,7 @@ import { DownloadRemoteConfigVersion, GetPlayerProfile, ItemTemplates, + GetPlayer, GetAssetDigest, GetDownloadUrls, GetMapObjects, @@ -21,11 +23,13 @@ import { MarkTutorialComplete, LevelUpRewards, Encounter, + CatchPokemon, NicknamePokemon, UpgradePokemon, EvolvePokemon, SetFavoritePokemon, - ClaimCodeName + ClaimCodeName, + CheckChallenge } from "./packets"; import { _toCC } from "./utils"; @@ -58,14 +62,23 @@ export function processResponse(player, req) { try { switch (req.request_type) { case "GET_PLAYER": + player.authentications++; + if (player.authentications >= 2) { + buffer = GetPlayer(player); + resolve(buffer); + return void 0; + } this.forwardPlayer(player).then((res) => resolve(res)); return void 0; break; + case "CHECK_CHALLENGE": + buffer = CheckChallenge(); + break; case "GET_HATCHED_EGGS": buffer = GetHatchedEggs(); break; case "GET_INVENTORY": - buffer = GetInventory(msg); + buffer = GetInventory(player); break; case "CHECK_AWARDED_BADGES": buffer = CheckAwardedBadges(); @@ -74,7 +87,7 @@ export function processResponse(player, req) { buffer = DownloadSettings(); break; case "DOWNLOAD_ITEM_TEMPLATES": - buffer = ItemTemplates(); + buffer = ItemTemplates(this.master); break; case "DOWNLOAD_REMOTE_CONFIG_VERSION": buffer = DownloadRemoteConfigVersion(msg); @@ -87,7 +100,7 @@ export function processResponse(player, req) { break; case "GET_MAP_OBJECTS": player.updatePosition(msg); - buffer = GetMapObjects(player, msg); + buffer = GetMapObjects(player, this.wild_pokemons, msg); this.savePlayer(player).then(() => { resolve(buffer); }); @@ -131,7 +144,11 @@ export function processResponse(player, req) { buffer = FortDetails(msg); break; case "FORT_SEARCH": - buffer = FortSearch(); + buffer = FortSearch(player); + this.updateUserItems(player).then(() => { + resolve(buffer); + }); + return void 0; break; case "SET_CONTACT_SETTINGS": player.updateContactSettings(msg); @@ -142,7 +159,31 @@ export function processResponse(player, req) { return void 0; break; case "ENCOUNTER": - buffer = Encounter(msg); + buffer = Encounter(this.getEncounterPkmn(msg).pkmn, msg); + break; + case "CATCH_POKEMON": + let encounter = this.getEncounterPkmn(msg); + let result = CatchPokemon(encounter.pkmn, player, msg); + // save pkmn into player party + if (result.status !== "CATCH_MISSED") { + result.pkmn.owner_id = player.owner_id; + player.exp += 100; + player.stardust += 100; + this.wild_pokemons.splice(encounter.index, 1); + this.createOwnedPokemon(result.pkmn).then(() => { + // make sure it got saved, also get db id + this.getQueryByColumnFromTable("creation_time_ms", result.pkmn.creation_time_ms, CFG.MYSQL_OWNED_PKMN_TABLE).then((query) => { + player.party.push(query[0]); + result.buffer.captured_pokemon_id = query[0].id; + result = POGOProtos.serialize(result.buffer, "POGOProtos.Networking.Responses.CatchPokemonResponse"); + resolve(result); + }); + }); + } + else { + resolve(POGOProtos.serialize(result, "POGOProtos.Networking.Responses.CatchPokemonResponse")); + } + return void 0; break; case "NICKNAME_POKEMON": buffer = NicknamePokemon(msg); @@ -168,4 +209,25 @@ export function processResponse(player, req) { }); +} + +export function getEncounterPkmn(req) { + + let ii = 0; + let length = this.wild_pokemons.length; + + let pkmn = null; + + for (; ii < length; ++ii) { + pkmn = this.wild_pokemons[ii]; + if (pkmn.encounter_id === parseInt(req.encounter_id)) { + break; + } + }; + + return ({ + pkmn: pkmn, + index: ii + }); + } \ No newline at end of file diff --git a/src/setup.js b/src/setup.js index cbe434d..bdef4e6 100644 --- a/src/setup.js +++ b/src/setup.js @@ -2,6 +2,7 @@ import fs from "fs"; import fse from "fs-extra"; import pogo from "pogo-asset-downloader"; import proto from "./proto"; +import POGOProtos from "pokemongo-protobuf"; import CFG from "../cfg"; @@ -27,7 +28,7 @@ export function setup() { this.print(`Downloaded assets are valid! Proceeding..`); this.asset = this.parseAssetDigest(); - this.master = this.parseGameMaster(); + this.master = POGOProtos.serialize(this.parseGameMaster(), "POGOProtos.Networking.Responses.DownloadItemTemplatesResponse"); this.setupDatabaseConnection().then(() => { if (CFG.PORT < 1) { @@ -58,7 +59,13 @@ export function validateAssets() { return new Promise((resolve, reject) => { - // validate asset digest + // validate asset digests + /*if (!this.fileExists(CFG.DUMP_ASSET_PATH + "asset_digest_ios")) { + return reject("File asset_digest_ios"); + } + if (!this.fileExists(CFG.DUMP_ASSET_PATH + "asset_digest_android")) { + return reject("File asset_digest_android"); + }*/ if (!this.fileExists(CFG.DUMP_ASSET_PATH + "asset_digest")) { return reject("File asset_digest"); } @@ -110,20 +117,69 @@ export function onFirstRun(resolve) { username: CFG.DOWNLOAD_USERNAME, password: CFG.DOWNLOAD_PASSWORD }).then((res) => { - let asset = res.asset; - this.print(`Dumping asset digest..`, 35); + let client = res.client; // create data dir, if login successed fse.ensureDirSync(CFG.DUMP_ASSET_PATH); - fs.writeFileSync(CFG.DUMP_ASSET_PATH + "asset_digest", res.asset.toBuffer()); + // write game master fs.writeFileSync(CFG.DUMP_ASSET_PATH + "game_master", res.master.toBuffer()); - this.dumpPkmnModels(() => { - resolve(); + // get and write asset digests + this.dumpAssetDigests(client).then(() => { + // dump pkmn models + this.dumpPkmnModels(() => { + resolve(); + }); }); }).catch((e) => { this.print(e, 31); }); } +export function dumpAssetDigests(client) { + + this.print(`Dumping asset digests..`, 35); + + let platforms = [ + { + name: "ios", + platform: 1, + manufacturer: "Apple", + model: "iPhone8,1", + locale: "", + version: 3300 + }, + { + name: "android", + platform: 2, + manufacturer: "LGE", + model: "Nexus 5", + locale: "", + version: 3300 + } + ]; + + return new Promise((resolve, reject) => { + let ii = 0; + let index = 0; + for (; ii < platforms.length; ++ii) { + let key = platforms[ii]; + client.getAssetDigest( + key.platform, + key.manufacturer, + key.model, + key.locale, + key.version + ).then((asset) => { + this.print(`Dumping ${key.name} asset digest..`, 35); + fs.writeFileSync(CFG.DUMP_ASSET_PATH + "asset_digest_" + key.name, asset.toBuffer()); + if (++index >= platforms.length) { + resolve(); + } + }); + }; + }); + +} + export function dumpPkmnModels(resolve) { let limit = CFG.MAX_POKEMON_NATIONAL_ID;