PokemonGo-Bot icon indicating copy to clipboard operation
PokemonGo-Bot copied to clipboard

[Suggestions] Only release low CP pokemon if you already caught it

Open tstumm opened this issue 10 years ago • 8 comments

Why should we release a low CP Pokemon if it's the first time we caught it?

tstumm avatar Jul 21 '16 10:07 tstumm

Currently just dumps anything lower level - you will normally always catch it again! :)

eggins avatar Jul 21 '16 10:07 eggins

Easy to implement, snippet below works for me.

def transfer_unique_pokemon(api):
    api.get_inventory()
    response_dict = api.call()
    pokemons = []
    #print('Response dictionary: \n\r{}'.format(json.dumps(response_dict, indent=2)))
    if response_dict and 'responses' in response_dict:
        if 'GET_INVENTORY' in response_dict['responses']:
            if 'inventory_delta' in response_dict['responses']['GET_INVENTORY']:
                if 'inventory_items' in response_dict['responses']['GET_INVENTORY']['inventory_delta']:
                    for item in response_dict['responses']['GET_INVENTORY']['inventory_delta']['inventory_items']:
                        #print('item {}'.format(item))
                        if 'inventory_item_data' in item:
                            if 'pokemon' in item['inventory_item_data']:
                                pokemon = item['inventory_item_data']['pokemon']
                                if 'is_egg' in pokemon:
                                    continue
                                pokemons = pokemons + [(pokemon['pokemon_id'], pokemon['cp'],pokemon['id'])]

    #Magic reverse sorts (poke_id, CP, uq_id)
    pokemons.sort(reverse=True)
    print pokemons
    pokemons_seen = []
    for pokemon in pokemons:
        if pokemon[0] in pokemons_seen:
            print('Already captured this pokemon, delete it:'+str(pokemon))
            api.release_pokemon(pokemon_id=pokemon[2])
            print('Response dictionary: \n\r{}'.format(json.dumps(response_dict, indent=2)))
            time.sleep(1.2)
        else:
            pokemons_seen = pokemons_seen + [pokemon[0]]

rvanvenetie avatar Jul 21 '16 10:07 rvanvenetie

@rvanvenetie Can you do a pull request so everyone can profit easily?

tstumm avatar Jul 21 '16 10:07 tstumm

@rvanvenetie would you like to make a pull-request for this? More than happy to implement if you do :)

eggins avatar Jul 21 '16 10:07 eggins

Actually, I do not have the time to properly implement this atm. I've simply ignored the cp parameter, and replaced the call to `transfer_low_cp_pokomon' with a call to snippet above.

rvanvenetie avatar Jul 21 '16 10:07 rvanvenetie

Really want to see this one implemented. It would be nice to keep at least one of each pokemon. CP might not interest everyone. Although transferring the lower CP duplicate would be preferred.

corrupt3k avatar Jul 22 '16 02:07 corrupt3k

Related: #142

jtdroste avatar Jul 22 '16 10:07 jtdroste

Closing to avoid duplication spam. ON the works in https://github.com/PokemonGoF/PokemonGo-Bot/pull/274.

douglascamata avatar Jul 22 '16 20:07 douglascamata