SHOW:
|
|
- or go back to the newest paste.
1 | PokemonGoMITM = require './lib/pokemon-go-mitm' | |
2 | server = new PokemonGoMITM port: 8081 | |
3 | ||
4 | ||
5 | coughtIDs = [] | |
6 | server.addResponseHandler "CatchPokemon", (data) -> | |
7 | if "status" of data | |
8 | if data.status == "CATCH_SUCCESS" | |
9 | coughtIDs.push data.captured_pokemon_id | |
10 | data.capture_award.activity_type[1] = "ACTIVITY_POKEDEX_ENTRY_NEW" | |
11 | data.capture_award.xp[1] = 500 | |
12 | data.capture_award.candy[1] = 0 | |
13 | data.capture_award.stardust[1] = 0 | |
14 | console.log("dataflata") | |
15 | console.log(JSON.stringify(data,null,4)) | |
16 | data | |
17 | server.addResponseHandler "GetInventory", (data) -> | |
18 | if "success" of data | |
19 | if data.success | |
20 | for item in data.inventory_delta.inventory_items | |
21 | if "pokemon_data" of item.inventory_item_data | |
22 | if item.inventory_item_data.pokemon_data.id in coughtIDs | |
23 | item.inventory_item_data.pokemon_data.pokemon_id = "MEWTWO" | |
24 | item.inventory_item_data.pokemon_data.cp = Math.floor(Math.random() *(1000)+3000) | |
25 | item.inventory_item_data.pokemon_data.stamina = 221 | |
26 | item.inventory_item_data.pokemon_data.stamina_max = 221 | |
27 | item.inventory_item_data.pokemon_data.weight_kg = 122.28 | |
28 | item.inventory_item_data.pokemon_data.height_m = 2.07 | |
29 | item.inventory_item_data.pokemon_data.move_1 = "PSYCHIC" | |
30 | item.inventory_item_data.pokemon_data.move_2 = "PSYSTRIKE" | |
31 | item.inventory_item_data.pokemon_data.individual_attack = 30 | |
32 | item.inventory_item_data.pokemon_data.individual_defense = 20 | |
33 | item.inventory_item_data.pokemon_data.individual_stamina = 15 | |
34 | if "pokedex_entry" of item.inventory_item_data | |
35 | item.inventory_item_data.pokedex_entry.times_encountered = 1 | |
36 | item.inventory_item_data.pokedex_entry.times_captured = 1 | |
37 | item.inventory_item_data.pokedex_entry.pokemon_id = "MEWTWO" | |
38 | if "candy" of item.inventory_item_data | |
39 | item.inventory_item_data.candy.family_id = "FAMILY_MEWTWO" | |
40 | item.inventory_item_data.candy.candy = 3 | |
41 | data | |
42 | ||
43 | server.addResponseHandler "GetMapObjects", (data) -> | |
44 | if "map_cells" of data | |
45 | cal = new Date() | |
46 | now = cal.getTime() | |
47 | for cell in data.map_cells | |
48 | for mon in cell.catchable_pokemons | |
49 | mon.pokemon_id = "MEWTWO" | |
50 | ||
51 | for mon in cell.wild_pokemons | |
52 | mon.pokemon_data.pokemon_id = "MEWTWO" | |
53 | data | |
54 | server.addResponseHandler "Encounter", (data) -> | |
55 | if "status" of data | |
56 | if data.status == "ENCOUNTER_SUCCESS" | |
57 | data.wild_pokemon.pokemon_data.pokemon_id = "MEWTWO" | |
58 | data.wild_pokemon.pokemon_data.cp = 8000 | |
59 | data.wild_pokemon.pokemon_data.weight_kg = 122 | |
60 | data.wild_pokemon.pokemon_data.height_m = 2 | |
61 | data.capture_probability.capture_probability['0'] = 0.0 | |
62 | data.capture_probability.capture_probability['1'] = 0.0 | |
63 | data.capture_probability.capture_probability['2'] = 0.1 | |
64 | ||
65 | data | |
66 | ||
67 | ignore = ['GetInventory', 'GetMapObjects', 'CatchPokemon', 'Encounter'] | |
68 | ||
69 | server.addRequestHandler "*", (data, action) -> | |
70 | console.log "[<-] Request for #{action} ", data, "\n" unless not (action in ignore) | |
71 | data | |
72 | ||
73 | server.addResponseHandler "*", (data, action) -> | |
74 | console.log "[->] Response for #{action} ", JSON.stringify(data, null, 4), "\n" unless not (action in ignore) | |
75 | data |