forked from rastapasta/pokemon-go-mitm
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample.pokemonIVdisplay.coffee
More file actions
30 lines (25 loc) · 1011 Bytes
/
example.pokemonIVdisplay.coffee
File metadata and controls
30 lines (25 loc) · 1011 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
###
Pokemon Go(c) MITM node proxy
by Michael Strassburger <codepoet@cpan.org>
Append the hidden IV% to the end of Pokémon names in our inventory
###
PokemonGoMITM = require './lib/pokemon-go-mitm'
changeCase = require 'change-case'
server = new PokemonGoMITM port: 8081
# Always get the full inventory
#.addRequestHandler "GetInventory", (data) ->
# data.last_timestamp_ms = 0
# data
# Append IV% to existing Pokémon names
.addResponseHandler "GetInventory", (data) ->
if data.inventory_delta
for item in data.inventory_delta.inventory_items when item.inventory_item_data
if pokemon = item.inventory_item_data.pokemon_data
id = changeCase.titleCase pokemon.pokemon_id
name = pokemon.nickname or id.replace(" Male", "♂").replace(" Female", "♀")
atk = pokemon.individual_attack or 0
def = pokemon.individual_defense or 0
sta = pokemon.individual_stamina or 0
iv = Math.round((atk + def + sta) * 100/45)
pokemon.nickname = "#{name} #{iv}%"
data