Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
tstumm opened this issue Jul 21, 2016 · 8 comments
Closed

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

tstumm opened this issue Jul 21, 2016 · 8 comments

Comments

@tstumm
Copy link
Contributor

tstumm commented Jul 21, 2016

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

@eggins
Copy link
Contributor

eggins commented Jul 21, 2016

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

@rvanvenetie
Copy link

rvanvenetie commented Jul 21, 2016

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]]

@tstumm
Copy link
Contributor Author

tstumm commented Jul 21, 2016

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

@eggins
Copy link
Contributor

eggins commented Jul 21, 2016

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

@rvanvenetie
Copy link

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.

@corrupt3k
Copy link

corrupt3k commented Jul 22, 2016

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.

@jtdroste
Copy link
Contributor

Related: #142

@douglascamata
Copy link
Member

Closing to avoid duplication spam. ON the works in #274.

nbq pushed a commit that referenced this issue Nov 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants